git: 24fe46128495 - main - ether: Add a KMSAN check for transmitted frames
Mark Johnston
markj at FreeBSD.org
Wed Aug 11 20:44:49 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=24fe46128495fc32b31729d9bba86dd7c5280ce3
commit 24fe46128495fc32b31729d9bba86dd7c5280ce3
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-08-11 20:23:12 +0000
Commit: Mark Johnston <markj at 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));
}
More information about the dev-commits-src-main
mailing list