From 24fe46128495fc32b31729d9bba86dd7c5280ce3 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 11 Aug 2021 16:23:12 -0400 Subject: [PATCH] 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 #include #include -#include #include +#include +#include #include #include #include @@ -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)); }