From nobody Mon Apr 6 15:52:16 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 A6D1F264A97 for ; Thu, 19 Mar 2026 00:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773881707; cv=none; b=WpBA/OOzYp03yHNcZAOJl3iyOTLyauIDpu21ml/9hZPPgHcihxh3rLO/QZGRYecms8+mdOE7ZESFS+uoLz7cEwiPXIm95fzjMppQ5xWy0FC8RywHty3napp0WFZtCcWV+w+r6eRO6O3BtuPWiDP2ug6VOEYGF3BCqXPi9aVg/2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773881707; c=relaxed/simple; bh=9ChrqgqzLxv0HG6d+sVJ8ZSrEehv96eJRupsVAvr+Tc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I/hpAeOR2jvcDngXkG47nY/0p/0WhKl1NJ0OlKY9Nmj0Uor/PHEqZShIsLcIRNyvHr0RU9mmSqcbGBLEnfW62hAKNHR4UCNa810ZoXuUFd1fiPxxcZNNuo7c2sP+ulm9T0JJ682AW+fQdkqDoP113UvbwCgv4CRGswu1rozr0mo= 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=InVUC79S; arc=none smtp.client-ip=209.85.216.49 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="InVUC79S" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-35a211df8e3so333499a91.2 for ; Wed, 18 Mar 2026 17:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773881704; x=1774486504; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AqJVnNKLFkL+jq1ernliZYc8SMaYZ+fQvvfgLT6r30I=; b=InVUC79SeCKFpxRjV+c+SJe/7DLtmAWCtGe8jRVK7AWLOeStJkaoESfs6Qo/YJ/4gt 5eFD/ZWX3Rms8UMXhaRo+EMRKcZq2GboPzar8GGy06HRj/O/MW5cI0gnrbLkaHrl7AzS rrkAd25Yo1N+xKw05OGlo/cURCjYy885QHiuITNF4EH5+aREDetRLUNiaoNROuVHC7Ke rbA+jy+zrMP1WMtOPWTbIoeby9bJY36lG7zXPNHecS2aKLuj5aOxZlx5yjfdyoTCcKjp Ac+TaNFPTK1Yw5RSUt6XW1ItTPB82DKee5eQUOG6bqLvdT4/JkZQC3B2kvhvVpNcT0fZ F9nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773881704; x=1774486504; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AqJVnNKLFkL+jq1ernliZYc8SMaYZ+fQvvfgLT6r30I=; b=ClM3cow/5GXxnIy8I98kZyNygGN5kyU4/H/knl6bFXexOZQMQ5+aWY+uDhOPKBRD9J vUr4Eoual5TcDrN7ZKOWbjscKgaQM/Te0juh89Dn0oEToXf0QpDRo9S5zf1gAQNYPM8o S+qaLbNghJqlzrKMyDppvuigZJ7GotBnYV6d2cMIhKeU3lvD9J4bUbOwYNs+7hhWVjDS teCQsfke0BYUsTEF10D88KFtTgUZcnERAeS7dXBKYBhNAKFvB9CdV+kR+F2Qg4WAPkem eOs/Gt5oWs0brzKlU8VPX4fo8+FJpDcfJT4XJlz9FNgGN04YiA3bnarCuwPM9n3CmQ2q +62w== X-Forwarded-Encrypted: i=1; AJvYcCVFrOVtHLG2QwtuZ9+THojZAVYI5IJLacUq8wFWZlxHEKn3L7AbVvnp81oc46yuj8sMHaEeOzxvZauoFWY=@vger.kernel.org X-Gm-Message-State: AOJu0YxIpUqG6fXjcd0uBqCDxnxvCDSM+V6MGTUn56f6HwHIfKgN7k7a rFNhlDeAB/BYrCJOWNpn2euxHfZjVdWV/V+jBpkyGfOO4PjOPPvQuM/6 X-Gm-Gg: ATEYQzzU5ryyz5FY+4raazqdILKuCWnRf3DBZ03Hp9hMVIevDfSyrUYqawWVWVRcMBj DYkjpLf0PATsfr91ROFTkQNMwigbcnjezVHt3ejYTwGpoDBmiZuwFtNC7hYHELiWBD/18JbaqeA r+R+khp/Ys+0K8Of9WXuyQpeZzj0+z6JbgQnRZ5AKP5NHg8yASgs2GVnsbmFBYGGU47+EV05bw9 5D+/gogA5Kclr18iqL9VhAkt68tHDNKazw+2DblmVo5Zm5DRjX2uAupVVnJ0/ZBffaQKgnCJKGN 2Vwg3KLwBIVSlU32tW0Pwf8KatLadafnFWjpA+vdbbMIzACb1bQh6S4uv+2VpesBDSJHwBqy1Hl POYwVv305tklhyQE9VbBpKgDZApUL1FZcVwEywnWqfP+EEpJ5+bvhjj+1zy+F5WL3bFrzQiNVM/ anxpSoZpIZgzf1alMW3kY1JoZ7LZ8RIO9NnhE4m8RFJXvbx9Jk3s+LmcirPigTj6ek5nJa3SkdL RITVJ9lV3wheq1IIdPtujt3eN/eV5zW+LEHKWeKeL8= X-Received: by 2002:a17:90a:d604:b0:35b:982a:28c4 with SMTP id 98e67ed59e1d1-35bb9e3d04dmr4936496a91.3.1773881703854; Wed, 18 Mar 2026 17:55:03 -0700 (PDT) Received: from DellG15.lan (2001-b030-804d-ff67-2d87-7642-b84f-7a21.hinet-ip6.hinet.net. [2001:b030:804d:ff67:2d87:7642:b84f:7a21]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35bc62e4506sm860182a91.6.2026.03.18.17.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 17:55:03 -0700 (PDT) From: Guoyu Su To: 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 Subject: [PATCH net v4] net: use skb_header_pointer() only for DODGY TCPv4 GSO skbs Date: Thu, 19 Mar 2026 08:54:21 +0800 Message-Id: <20260319005421.14908-1-yss2813483011xxl@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <0a25f57e-fe08-4fe9-9722-e1c6adb81e91@redhat.com> References: <0a25f57e-fe08-4fe9-9722-e1c6adb81e91@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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=3D1543a7d954d9c6d00407 Fixes: cbc53e08a793 ("GSO: Add GSO type for fixed IPv4 ID") Reported-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D1543a7d954d9c6d00407 Tested-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com Signed-off-by: Guoyu Su --- 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-yss2813483011xx= l@gmail.com/ v1: https://lore.kernel.org/netdev/20260307162905.3697050-1-yss2813483011xx= l@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 s= truct sk_buff *skb, * segmentation-offloads.rst). */ if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { - struct iphdr *iph =3D skb->encapsulation ? - inner_ip_hdr(skb) : ip_hdr(skb); + int nhoff =3D skb->encapsulation ? + skb_inner_network_offset(skb) : + skb_network_offset(skb); + const struct iphdr *iph; + struct iphdr _iph; + + if (unlikely(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) { + iph =3D nhoff < 0 ? NULL : + skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); + } else { + iph =3D skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); + } =20 - if (!(iph->frag_off & htons(IP_DF))) + if (!iph || !(iph->frag_off & htons(IP_DF))) features &=3D ~dev->mangleid_features; } =20 --=20 2.34.1