From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Guoyu Su <yss2813483011xxl@gmail.com>,
edumazet@google.com, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com
Cc: netdev@vger.kernel.org, horms@kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com,
Guoyu Su <yss2813483011xxl@gmail.com>
Subject: Re: [PATCH net v4] net: use skb_header_pointer() only for DODGY TCPv4 GSO skbs
Date: Thu, 19 Mar 2026 09:17:59 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.c0bb5d182993@gmail.com> (raw)
In-Reply-To: <20260319005421.14908-1-yss2813483011xxl@gmail.com>
Guoyu Su wrote:
> Syzbot reported a KMSAN uninit-value warning in gso_features_check()
> called from netif_skb_features() [1].
>
> The current direct skb->len check is not sufficient for SKB_GSO_DODGY
> packets. In the AF_PACKET/PACKET_VNET_HDR path, packet_snd() can build
> a DODGY GSO skb whose total length is large enough, while the IPv4
> header is not fully available as initialized linear data for a direct
> iph->frag_off access.
>
> Use skb_header_pointer() to fetch the IPv4 header only for DODGY packets
> and clear mangleid_features conservatively if the header cannot be
> accessed or the DF bit is not set.
>
> Keep the existing direct ip_hdr()/inner_ip_hdr() access for non-DODGY
> packets so that buggy internal callers are still exposed.
>
> [1] https://syzkaller.appspot.com/bug?extid=1543a7d954d9c6d00407
>
> Fixes: cbc53e08a793 ("GSO: Add GSO type for fixed IPv4 ID")
> Reported-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=1543a7d954d9c6d00407
> Tested-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com
> Signed-off-by: Guoyu Su <yss2813483011xxl@gmail.com>
> ---
> v4:
> - Move struct iphdr _iph to the outer scope so a pointer returned by
> skb_header_pointer() remains valid when iph->frag_off is checked.
>
> v3: https://lore.kernel.org/netdev/20260312104351.185370-1-yss2813483011xxl@gmail.com/
> v2: https://lore.kernel.org/netdev/20260308083319.1255118-1-yss2813483011xxl@gmail.com/
> v1: https://lore.kernel.org/netdev/20260307162905.3697050-1-yss2813483011xxl@gmail.com/
>
> net/core/dev.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 14a83f2035b9..d47bf7b1fa99 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3805,10 +3805,20 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
> * segmentation-offloads.rst).
> */
> if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) {
> - struct iphdr *iph = skb->encapsulation ?
> - inner_ip_hdr(skb) : ip_hdr(skb);
> + int nhoff = skb->encapsulation ?
> + skb_inner_network_offset(skb) :
> + skb_network_offset(skb);
can be moved inside the unlikely branch
> + const struct iphdr *iph;
> + struct iphdr _iph;
> +
> + if (unlikely(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) {
> + iph = nhoff < 0 ? NULL :
why the negative check?
> + skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
> + } else {
> + iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb);
> + }
>
> - if (!(iph->frag_off & htons(IP_DF)))
> + if (!iph || !(iph->frag_off & htons(IP_DF)))
> features &= ~dev->mangleid_features;
> }
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-03-19 13:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 16:29 [PATCH net] net: clear mangleid_features for SKB_GSO_DODGY TCPv4 Guoyu Su
2026-03-07 16:43 ` Eric Dumazet
2026-03-08 8:33 ` [PATCH net v2] net: use skb_header_pointer() in gso_features_check() for TCPv4 GSO Guoyu Su
2026-03-11 0:48 ` Jakub Kicinski
2026-03-12 10:43 ` [PATCH net v3] net: use skb_header_pointer() only for DODGY TCPv4 GSO skbs Guoyu Su
2026-03-17 10:22 ` Paolo Abeni
2026-03-19 0:54 ` [PATCH net v4] " Guoyu Su
2026-03-19 13:17 ` Willem de Bruijn [this message]
2026-03-20 14:14 ` [PATCH net v5] " Guoyu Su
2026-03-20 19:24 ` Willem de Bruijn
2026-03-21 1:36 ` Willem de Bruijn
2026-03-21 15:31 ` Scars
2026-03-21 20:58 ` Willem de Bruijn
2026-03-22 4:26 ` Guoyu Su
2026-03-23 3:36 ` Willem de Bruijn
2026-03-24 10:40 ` Guoyu Su
2026-03-26 3:12 ` Willem de Bruijn
2026-03-26 12:18 ` [PATCH net v6] net: use skb_header_pointer() for TCPv4 GSO frag_off Guoyu Su
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=willemdebruijn.kernel.c0bb5d182993@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=yss2813483011xxl@gmail.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