From nobody Tue Apr 7 16:32:13 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 989B530BBAE for ; Thu, 12 Mar 2026 10:44:09 +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=1773312251; cv=none; b=o551HKUOkcwLRMHLZBozLrPZ0FR92bXI1+QMc/Bj41HRcOZvDF++XJdtlwgF1/tlpNlrUPgX7nsaQSBU4FLslviqIUNkJbFfkCzP/IBpy6hAUxKLzNMs5aNMabHZSWGgcF/uYQgK1ew0LWBtpgKuwMT0p/jCU00d18DCPI/ZRWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773312251; c=relaxed/simple; bh=Orz40UWyMu/DDc6OQ5Hx2UVKCN31H6OCVGLhTx/94lI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nMiSVxoxHNY5ftWYEoP532cCZk6HK1dKyV5d8g+IdGNrrJeCYkdHY4q0motEcezlbBRfcsjwP2WR5mUdF8bybnaB1eQmoQesjYChrtblt4Ayx4EvyHVjDBDbTGe5+/ClQPXZg3nuqHuxmECRnZEa0wpcG2eB6lI2tmLYSf2nV3M= 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=HpDhM3bH; 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="HpDhM3bH" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-354bc7c2c46so543347a91.0 for ; Thu, 12 Mar 2026 03:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773312249; x=1773917049; 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=vhvJAlYXK6QIgKv+j9fZb4MsfQCzPTuvZ8nlIAaEfTc=; b=HpDhM3bHcn7SUaLe9uxPr7pS3OhfrUoqh5BxKJpOgSbks2HKe04yXLgWEs/bxVxkEW 2xAyi4dNVpOTFBGcX+nG1Nrk0+4IUUe2RqZFRnWjZDFvym37Xc+AcvRZr+IFBrIoyvLT o52T/S1iBt2q90AScUihJcRIE5LjV2rWhTtxWcajbpTlHrRwn7qAer23UuI/zFGO7zKA DIaK9JcrnVhVp4oNVMxnr9DGUAom2jACXJ2ZNPGfWV8oOIc+rflvfFLmk6/IvkDeL6o4 FYAULLlPQ13oGF6wWZb9BIT602VpKf7o70Rw73ZGDYFOofVzjF2biNV+lc0lNFeHn4ve FMyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773312249; x=1773917049; 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=vhvJAlYXK6QIgKv+j9fZb4MsfQCzPTuvZ8nlIAaEfTc=; b=I+idSqyXxiqoxvmJWqUSwk8f5NTdPr0Ri4pldr6uu89oo1Mmn1iKAmoRq8RAc7iLNS VV+ZM16flttrp4LgNDtwxMvYXoIdezumXiQue7F6IgG/jhuHANcWf0m8tpUaaUlgMDq8 9/D3B4Nzuyy3uoP9O1cTx6REQQXMJm/ZTeg7BkjCDYs8RKIXhImX1wvMtahAXUyTvXxS zeeRZNYQOk/nX07Y530KZHvZuqoUv+Mr/ROWjl79Y2jaZaK44pxW1RUETjYtMqjjyDld qc3IincxNAYtuYb7iWgBCQMFrtZ3sczyfCap4QGbyvbCQp7llPVZ2KzZeEPvFCotxjt1 SmyA== X-Forwarded-Encrypted: i=1; AJvYcCV+dMdqQLHZIzVC1ogYhW8njH1LSgiVBwISXQOJ3emsQ0RBB96uUicAkDZlxikEInCpv+T2OdAW+TXtLCg=@vger.kernel.org X-Gm-Message-State: AOJu0YxOorJkNbdF3PiuwhlO5RXrkFBLidbuH8ffc/G0o3dQ0NVEeAXz kcMaT8+nfcKW6EIBC7BFbOR0e8GKRC8YY1A2OPDY+pL5sdHkO4/ZaFkI X-Gm-Gg: ATEYQzy+mrqWNLNZIAa3HFAT3IZvRSvx8L+xaGe3b6UdlnwtKfC44kSr3kBNvoktyN6 YFcqsILqGmojIFbR5WY+Mvm+Ncsv76U33eBZJfeFAZE/cszn7pUZyV08MwMpHU2by1vgYnessbL nhm6+bOSq30QG//UYFlJ4SJNFNpKVyqUrrLEBlUD4HaZp6emVAalY0FiHNIIVrctM9KhkQZUicx tB50OxNRI8+A8eY5plSR0d3jN9Nlt6JXOZf7C4x3XH4Qi7Na3819gbhdbG8TszHqpN4azB226dv Py+jcxY9oHmRxHpB2QG7cX0WDEWRDcsOhBrw4/7yti9kecEgwOhZNIVABjs9vOvRGg0ugP9EdtH smM7kgZBkYj0rx5Oc3An646HyTXmxM+FqzKvcgzSVctDbJtW1b7AxZ9PJx6wIilS6MZuakZcHKI EYczly6uAyzGtrZwEY8OFPbqFejmoyrsFmeO+eGL1WpG5CnWn8/xWOjqQ4ChZjxdWpVEv5zXA9g vDvN8YDt7YxDQvsPqITSSKuo5YeVPZQZQM= X-Received: by 2002:a17:90b:2691:b0:359:8c01:674 with SMTP id 98e67ed59e1d1-35a012eb057mr5428728a91.22.1773312248808; Thu, 12 Mar 2026 03:44:08 -0700 (PDT) Received: from DellG15.lan (2001-b030-8069-ff8d-2d87-7642-b84f-7a21.hinet-ip6.hinet.net. [2001:b030:8069:ff8d:2d87:7642:b84f:7a21]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35a022710edsm2576730a91.5.2026.03.12.03.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 03:44:08 -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 v3] net: use skb_header_pointer() only for DODGY TCPv4 GSO skbs Date: Thu, 12 Mar 2026 18:43:51 +0800 Message-Id: <20260312104351.185370-1-yss2813483011xxl@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260310174841.5f5671c5@kernel.org> References: <20260310174841.5f5671c5@kernel.org> 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 --- v3: - Use skb_header_pointer() only for SKB_GSO_DODGY packets. - Keep direct ip_hdr()/inner_ip_hdr() access for non-DODGY packets. - Fix AF_PACKET/PACKET_VNET_HDR reproducer where skb->len is sufficient but the IPv4 header is not fully available as initialized linear data. 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 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 14a83f2035b9..f3340d7dd87c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3805,10 +3805,21 @@ 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; =20 - if (!(iph->frag_off & htons(IP_DF))) + if (unlikely(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) { + struct iphdr _iph; + + 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); + } + + if (!iph || !(iph->frag_off & htons(IP_DF))) features &=3D ~dev->mangleid_features; } =20 --=20 2.34.1