From: Daniel Yang <danielyangkang@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"GitAuthor: Daniel Yang" <danielyangkang@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: syzbot+346474e3bf0b26bd3090@syzkaller.appspotmail.com
Subject: [PATCH] Fix KMSAN infoleak, initialize unused data in pskb_expand_head
Date: Tue, 1 Oct 2024 22:38:42 -0700 [thread overview]
Message-ID: <20241002053844.130553-1-danielyangkang@gmail.com> (raw)
pskb_expand_head doesn't initialize extra nhead bytes in header and
tail bytes, leading to KMSAN infoleak error. Fix by initializing data to
0 with memset.
Reported-by: syzbot+346474e3bf0b26bd3090@syzkaller.appspotmail.com
Tested-by: Daniel Yang <danielyangkang@gmail.com>
Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
---
net/core/skbuff.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 74149dc4e..348161dcb 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2286,6 +2286,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
skb_shinfo(skb),
offsetof(struct skb_shared_info, frags[skb_shinfo(skb)->nr_frags]));
+ /* Initialize newly allocated headroom and tailroom
+ */
+ memset(data, 0, nhead);
+ memset(data + nhead + skb->tail, 0, skb_tailroom(skb) + ntail);
+
/*
* if shinfo is shared we must drop the old head gracefully, but if it
* is not we can just drop the old head and let the existing refcount
--
2.39.2
next reply other threads:[~2024-10-02 5:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 5:38 Daniel Yang [this message]
2024-10-02 7:27 ` [PATCH] Fix KMSAN infoleak, initialize unused data in pskb_expand_head Eric Dumazet
2024-10-02 11:55 ` Daniel Borkmann
2024-10-03 4:42 ` Daniel Yang
2024-10-03 7:56 ` Eric Dumazet
2024-10-05 4:59 ` Daniel Yang
2024-10-04 7:59 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241002053844.130553-1-danielyangkang@gmail.com \
--to=danielyangkang@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+346474e3bf0b26bd3090@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).