Date: Wed, 11 Aug 2021 20:44:49 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 710c055673b3 - main - virtio: Add KMSAN hooks for network and block devices Message-ID: <202108112044.17BKinoG092318@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=710c055673b3a39ff6e5fdf0bef49437d1e0c9a3 commit 710c055673b3a39ff6e5fdf0bef49437d1e0c9a3 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-08-11 20:23:25 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-08-11 20:41:38 +0000 virtio: Add KMSAN hooks for network and block devices This ensures that host-written data is marked as initialized. Sponsored by: The FreeBSD Foundation --- sys/dev/virtio/block/virtio_blk.c | 3 +++ sys/dev/virtio/network/if_vtnet.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 8a5558f4571d..e4a20bfc3031 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bio.h> #include <sys/malloc.h> #include <sys/module.h> +#include <sys/msan.h> #include <sys/sglist.h> #include <sys/sysctl.h> #include <sys/lock.h> @@ -1151,6 +1152,8 @@ vtblk_bio_done(struct vtblk_softc *sc, struct bio *bp, int error) bp->bio_resid = bp->bio_bcount; bp->bio_error = error; bp->bio_flags |= BIO_ERROR; + } else { + kmsan_mark_bio(bp, KMSAN_STATE_INITED); } if (bp->bio_driver1 != NULL) { diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index e65914c5184f..bbda5cb90707 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -36,9 +36,10 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/kernel.h> #include <sys/sockio.h> -#include <sys/mbuf.h> #include <sys/malloc.h> +#include <sys/mbuf.h> #include <sys/module.h> +#include <sys/msan.h> #include <sys/socket.h> #include <sys/sysctl.h> #include <sys/random.h> @@ -2107,6 +2108,8 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) continue; } + kmsan_mark_mbuf(m, KMSAN_STATE_INITED); + /* * Save an endian swapped version of the header prior to it * being stripped. The header is always at the start of the
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108112044.17BKinoG092318>