git: 14a634df53d2 - main - cxgbe: Mark received packets as initialized for KMSAN

Mark Johnston markj at FreeBSD.org
Fri Sep 24 18:37:22 UTC 2021


The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=14a634df53d2de65233e490d0bfa806a05baff7c

commit 14a634df53d2de65233e490d0bfa806a05baff7c
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-09-24 18:35:38 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-09-24 18:37:05 +0000

    cxgbe: Mark received packets as initialized for KMSAN
    
    The KMSAN runtime needs to have its shadow maps updated when devices
    update host memory, otherwise it assumes that device-populated memory is
    uninitialized.  For most drivers this is handled transparently by
    busdma, but cxgbe doesn't make use of dma maps for receive buffers and
    so requires special treatment.
    
    Reported by:    mjg
    Tested by:      mjg
    Reviewed by:    np
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D32102
---
 sys/dev/cxgbe/t4_sge.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index 8a502907d172..c2f2f0a13f5b 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>
 #include <sys/ktls.h>
 #include <sys/malloc.h>
+#include <sys/msan.h>
 #include <sys/queue.h>
 #include <sys/sbuf.h>
 #include <sys/taskqueue.h>
@@ -1754,6 +1755,7 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset,
 			return (NULL);
 	}
 	m->m_len = len;
+	kmsan_mark(payload, len, KMSAN_STATE_INITED);
 
 	if (sc->sc_do_rxcopy && len < RX_COPY_THRESHOLD) {
 		/* copy data to mbuf */


More information about the dev-commits-src-main mailing list