From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f50.google.com (mail-yx1-f50.google.com [74.125.224.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25A0234A766 for ; Fri, 20 Mar 2026 19:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774034658; cv=none; b=f+e5W1hBYbOR5B2PtaPLot/1EirhMP9rYzfFJ/AQ1XnyPY0tYz1ETBo5gi6+FjXR56vq/TZABDEaNNroZxC1n+lz+81+zEIR11ztHpNc6C1DZPmUwDeueuyVUfvVgjWqT2/vhsVjR0LMY1x+/iY1Ke/2b1mE0J0VQ6GbkrwuBu4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774034658; c=relaxed/simple; bh=AAoHi3E3pYFmtsInfUBOH0hYPsWqRWTaH/bElid2KBg=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=sqevO8NXtZOaiZ+LdT++/0ItUjstxM7sjOQab2KbIhRbSN3aCij0Q+oFQ7v41n6TTD5297oELLpOsoRUxWy5HBOYj/3rxFI//Vk/We/C+PtyNBzFO8CP5C+dmJ6tj821U0yz+Ac2KpVhNNDNYQDeruBkWOUaDnYv80DHii8X/E0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Jq9yuy3f; arc=none smtp.client-ip=74.125.224.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Jq9yuy3f" Received: by mail-yx1-f50.google.com with SMTP id 956f58d0204a3-64ca4dfdd88so977930d50.0 for ; Fri, 20 Mar 2026 12:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774034656; x=1774639456; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=E67JCelcxEnCX3a2Sq4H2/xp+XhNrkqey+wbQ7vBedE=; b=Jq9yuy3fgc6yQxHh696rEoGPgeronstHV9GAA1xO03L880S4GdS+zvymEZK6wjzlIU 0dgOkOuGaL0VSymsfXft/D/OUtTjSJPRcUFGyf8a1A4pHcfcL0qEJ+eVjXpF0IRD4CP3 xIPzJSAbH1hw1eox+141mio5zf9i614rXIrHD7jcx4Id/QELJ2rVbXUpSsgQ+xdNb5fG 5zqG5vmgzOcrs3IhkGqkOM8tw6nNH7pn1QT9yw9KWj7epj7FbkQTePX0ZqTIH927pPYC wSiklDb8juBhg3017w+fnDB6b3F2yNH6kXBxNb7JyNMg8RczwM9nc4XO6Y2/tr4EIU0A K/hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774034656; x=1774639456; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=E67JCelcxEnCX3a2Sq4H2/xp+XhNrkqey+wbQ7vBedE=; b=XTQYsnA0lp7wq3J5CCyWCcrTLEnL2Bz9oOPILOb3pe848D3qa7sTJcGZU2PVsvh9lQ dZeDGTp4+qSQdfOrFeiFNCcbgbUcrdIcIFy6NNeg9HVuwU7LM60XPArtqE/NzwqZxBPD tHKu0sBOveal+robnUZZjSFGMw7Y8j38izcr0VDbE4IwWvWjYirdHc51PinOniKkDDQT QOTSPFERJ9P+dhUhgy2JahCg6p1Y/tFo53hK8cKbxxfoUTtnYNR2uIMe/0nKjJUoorxI lrLWWjavXOSVS1nrVQRmN/oLZMl1/lqyHUcTLd/B06mhxrz5WwmgVzOmAAa10dsnH1k7 D9bw== X-Forwarded-Encrypted: i=1; AJvYcCX3A4bMAVbkk5niy+sSqBMXm58f06ptLcbAi4XoRdHA4fQ0HePZFvgKQVmKyZlsNCJX/8PcJdsiGMjDoAg=@vger.kernel.org X-Gm-Message-State: AOJu0YxBJCuFUjATv9to6hwGR2tnYVzI3L/J5rX5Ucg6g8wYOT/YTpmu 6cyPozLLRJCGaMLUfz2wa/O6uhNcPZriG22VrPaiZZ2BCpcnR9LQsP0h X-Gm-Gg: ATEYQzxrvWG9rUORFT+Kyr+iiMaoGc1FAocxs5y+1YIp3Epv2FWYopAZUHV8uCNFLz0 CnMvTXcKtNl0jeKY49rX9GxaJM/M7+mpHmsIKwOC/1y5ZPqMywZJFIU5Xads1g5BWewrKpI6r/4 HgAzA9vjXlIuHM0e+VKgXc0wZKabRRgBvv5oEM3HNYt6Ezu4Tq4PllfanujpBg4Jso7Aa/5A5Ut lknaDr8ILf4ZMDXjhrwmgUO8stdSHEU2D9umLIOtzPxnOl0G5a2dSS0kt6RP23BE4Q4F/seWJjm /vrqNvOFrUTuSZXBi6bgDZN5ixOlci5Fxu/KJuGrWQsTRQqaoI/3Z/5Iyamyni+GhpkDdezLkqB QruT+hf/d0Ybv0YBMTeywdrgV17MOvBZ/jHZ95OCIv8JppNpXqP4++aVxJZoxcgsJ4DQ3eTYMLS Q6uAGs/dYRMkR/9KgJFxwrind4YB7MJ8yltrhUHEQ16Jce/B1p6bcvnpsw/Mp0tAuSmXDfEvHUg QFs X-Received: by 2002:a05:690e:1583:10b0:64a:d1bd:8c66 with SMTP id 956f58d0204a3-64eaa6df7bcmr3852436d50.29.1774034655988; Fri, 20 Mar 2026 12:24:15 -0700 (PDT) Received: from gmail.com (180.134.85.34.bc.googleusercontent.com. [34.85.134.180]) by smtp.gmail.com with UTF8SMTPSA id 956f58d0204a3-64eabd3e317sm2064774d50.4.2026.03.20.12.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 12:24:14 -0700 (PDT) Date: Fri, 20 Mar 2026 15:24:14 -0400 From: Willem de Bruijn To: Guoyu Su , edumazet@google.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: willemdebruijn.kernel@gmail.com, netdev@vger.kernel.org, horms@kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com, Guoyu Su Message-ID: In-Reply-To: <20260320141459.9691-1-yss2813483011xxl@gmail.com> References: <20260320141459.9691-1-yss2813483011xxl@gmail.com> Subject: Re: [PATCH net v5] net: use skb_header_pointer() only for DODGY TCPv4 GSO skbs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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. The fix looks fine, but the AI review of an earlier revision brings up a good point: __virtio_net_hdr_to_skb calls pskb_may_pull in all paths to ensure the network header is fully in skb linear. What kind of packet is this that managed to escape those checks? > 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 > --- > v5: > - Move nhoff into the SKB_GSO_DODGY branch. > - Drop the explicit nhoff < 0 check. > > v4: https://lore.kernel.org/netdev/20260319005421.14908-1-yss2813483011xxl@gmail.com/ > 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..be0cc69fa534 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); > + const struct iphdr *iph; > + struct iphdr _iph; > > - if (!(iph->frag_off & htons(IP_DF))) > + if (unlikely(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) { > + int nhoff = skb->encapsulation ? > + skb_inner_network_offset(skb) : > + skb_network_offset(skb); > + > + iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); > + } else { > + iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); > + } > + > + if (!iph || !(iph->frag_off & htons(IP_DF))) > features &= ~dev->mangleid_features; > } > > -- > 2.34.1 >