virtio: Add KMSAN hooks for network and block devices
This ensures that host-written data is marked as initialized. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
24fe461284
commit
710c055673
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user