Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Sep 2021 18:37:22 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: 14a634df53d2 - main - cxgbe: Mark received packets as initialized for KMSAN
Message-ID:  <202109241837.18OIbMdX090978@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=14a634df53d2de65233e490d0bfa806a05baff7c

commit 14a634df53d2de65233e490d0bfa806a05baff7c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-09-24 18:35:38 +0000
Commit:     Mark Johnston <markj@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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109241837.18OIbMdX090978>