The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=645b7efd496d649211056be0e2d3525ef21dc53d
commit 645b7efd496d649211056be0e2d3525ef21dc53d Author: Mark Johnston <ma...@freebsd.org> AuthorDate: 2021-08-11 20:22:26 +0000 Commit: Mark Johnston <ma...@freebsd.org> CommitDate: 2021-08-11 20:33:41 +0000 geom_disk: Add KMSAN checks - In g_disk_start(), verify that the data to be written is initialized according to KMSAN shadow state. - In g_disk_done(), verify that the block driver updated shadow state as expected, so as to catch sources of false positives early. Sponsored by: The FreeBSD Foundation --- sys/geom/geom_disk.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 2f0e72fad52d..9877243fa36e 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <sys/devctl.h> #include <sys/fcntl.h> #include <sys/malloc.h> +#include <sys/msan.h> #include <sys/sbuf.h> #include <sys/devicestat.h> @@ -239,6 +240,9 @@ g_disk_done(struct bio *bp) bp2->bio_error = bp->bio_error; bp2->bio_completed += bp->bio_length - bp->bio_resid; + if (bp->bio_cmd == BIO_READ) + kmsan_check(bp2->bio_data, bp2->bio_completed, "g_disk_done"); + switch (bp->bio_cmd) { case BIO_ZONE: bcopy(&bp->bio_zone, &bp2->bio_zone, sizeof(bp->bio_zone)); @@ -445,6 +449,10 @@ g_disk_start(struct bio *bp) KASSERT((dp->d_flags & DISKFLAG_UNMAPPED_BIO) != 0 || (bp->bio_flags & BIO_UNMAPPED) == 0, ("unmapped bio not supported by disk %s", dp->d_name)); + + if (bp->bio_cmd == BIO_WRITE) + kmsan_check_bio(bp, "g_disk_start"); + off = 0; bp3 = NULL; bp2 = g_clone_bio(bp); _______________________________________________ dev-commits-src-main@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"