Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2021 20:44:48 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: 24fe46128495 - main - ether: Add a KMSAN check for transmitted frames
Message-ID:  <202108112044.17BKimmt092290@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=24fe46128495fc32b31729d9bba86dd7c5280ce3

commit 24fe46128495fc32b31729d9bba86dd7c5280ce3
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-08-11 20:23:12 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-08-11 20:33:41 +0000

    ether: Add a KMSAN check for transmitted frames
    
    This helps ensure that outbound packet data is initialized per KMSAN.
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/net/if_ethersubr.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 718de9625044..bdb5b07635b7 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -46,8 +46,9 @@
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
-#include <sys/module.h>
 #include <sys/mbuf.h>
+#include <sys/module.h>
+#include <sys/msan.h>
 #include <sys/proc.h>
 #include <sys/priv.h>
 #include <sys/random.h>
@@ -502,9 +503,13 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m)
 #endif
 
 	/*
-	 * Queue message on interface, update output statistics if
-	 * successful, and start output if interface not yet active.
+	 * Queue message on interface, update output statistics if successful,
+	 * and start output if interface not yet active.
+	 *
+	 * If KMSAN is enabled, use it to verify that the data does not contain
+	 * any uninitialized bytes.
 	 */
+	kmsan_check_mbuf(m, "ether_output");
 	return ((ifp->if_transmit)(ifp, m));
 }
 



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