From nobody Sat Apr 4 07:50:08 2026 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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 8B27E284896 for ; Fri, 20 Mar 2026 14:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774016135; cv=none; b=HiKY+VmTqSruVL07JllKBmju1IaMQhHBuqNY3Vj/0QAsrVlsHcjsj+32/GKJbR2cb4q/S4goiZ9qpY2XtDjAUZ4Kdbf4Cn9jXvyRnKNEBDn6XDPUoKCR/0PCeQ2iozIBvpxCPWUeWCrgfuHTFuyoxmw/LeWCQa0usNMo+8QMkFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774016135; c=relaxed/simple; bh=4I3Gu/m6+PyLRyI8ZpPfl0UW8vRvYK8wawDdcjka2bE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AS+NjF9vySFm/lafEJXXIrpDsYv7EaMZQncSibsZqa7eZbwzmhiLC/maAUWOsu/ZIDo9re+BqlqV+yP2OkeeV+Kz2sjFEAi3E3JxJ+94Y3YJsnnpgaA+HeXn6UP4QLdMYjVpwA5uPueHMH8rRlrv1guQJiR6nRasJibawrYLzg4= 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=D37JZ78H; arc=none smtp.client-ip=209.85.215.172 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="D37JZ78H" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-c70ea5e9e9dso282884a12.1 for ; Fri, 20 Mar 2026 07:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774016133; x=1774620933; 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=vXuWvTQVp0L/2Sb42ubq5GFx/aw501bQtxZ0KpV3t18=; b=D37JZ78H80qQfDH+/zHM6KoX7RnIUMMu/kty9KE1S8IY/OCGX4yO7Bn8pLoc10XQfl rXrXpRbZMXpX0GsIFKL9ibb8FBbZX8K71bu3FKAqGWEcvDwLQKGPnZRq9GQusj0RSKhY iDwJxDMw5fks68+wDaF+WFdoTsjBVm9adChGQOXWrpm4tJHW24IKHNZHlevwCuhaPyla zilYguVTzg8ujYsDNSuXlTuHscfnc4+MhsIQvvVmca4f785W+v/ZH8EJc2OLH2FN9pDB VqAloq9LZ10ncJaJCxaoZ8Bzu4v/FjCATi0Epu8ZD0mS3uOaXg3KuP+3GA9ewcVPqPIY 9u5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774016133; x=1774620933; 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=vXuWvTQVp0L/2Sb42ubq5GFx/aw501bQtxZ0KpV3t18=; b=d9urNAj6BSzdFlW9pnOn8ZUKR/uOM81Ieu1qN1Gm1q3bpD3g44ao/P6MxrtdKmft8I MSwWj6FsBj+164isrJTJF6vxV2mf7ATs/Jb3RupKmZ+KqEQaxka2kD5s+YS2xea6VrFa zTR+260YGEitvc8j2m/7Cwfrrb0UKwnhNEEY8EyOlpMYOF/ywTHrr2ddv9QdjUGayNWn 9yDWVVV2klBJ9eR50DYTBg/WIP7l7EOWo+P0V/7BUmjuK8vkPmHXyJbbIhxnttz06VX9 4Oh/P/hnVF2+GB5r+CCqVrIyPXmszh5clyDYASWAWmsXRaem4a65Kj9X9hweJG0yXrdZ ljMA== X-Forwarded-Encrypted: i=1; AJvYcCVG93mfcShEBSTgArVtMN2ScyyIxKFwdXn8DL1L6hlf7cK9e1BSDnvdEXuq2UyOXunLXw4M/u73k37/LsM=@vger.kernel.org X-Gm-Message-State: AOJu0Ywuwin0WUYR/Xm5MMgzkbcIdRKtdeo7MuECKSr0B9EyxtiehNuT SzWEe41G2J2ruercq3c/ig+bhuFkbP84er+k78B8pyT77aekMID+86Sz X-Gm-Gg: ATEYQzy9kMoa+kTuGt0kihMGc+qDyhswvyeGN3kElLhMBc7KVw+F3m5A1aqKWBCkLsl /Ic3QD0vAbDqS5HKcWsqtxyP51rcPST4m9sabw7ywMzUiuaHIs+pu+unG//SPMOBW8DXkImAeOc 5ieU23z6OSN9mus90V+d/RC/NrED7FXWk2ECQjoFz6702MxxslpID6RK8ECF8vWDLQ6RsQsBLx2 rCZgTW3ABt7C1M3uJ3cbadwFG4/0tELLRL6p62xHhioPKk4NwDWBqNI+FFx25WgPddzvhw6KcBq 8ZYXcvW1etInIz6hfAQ/2Xjx0srJDhn/IMjvnSmzIIMrJ0TWZb0knNj00OcJT3Ows75kvDv5aYT /CTxD1jl1y4CDONXavmY4ZMxxx28nMTe6xh19H2H5EEqq1GbGsvbarWxrQOdfP4fU7PGvu8M/bO tGlcXdE/Kvjd+p7L4BkmilaGJZt4ubVT3kNj2F/AaZKM2tkJdaUBry0soLErcQdOGKpJkeCfAPJ cB7ixJSrDHYMFM6gmL0O9jFUwhrxiALJxc6F5Rm5S8fFKpON8H4O9IUWBUd6QZGngQOs0nxie/m lq2orveXTDo= X-Received: by 2002:a05:6a20:244f:b0:35d:5d40:6d79 with SMTP id adf61e73a8af0-39bce9b60d1mr3175667637.12.1774016132564; Fri, 20 Mar 2026 07:15:32 -0700 (PDT) Received: from DellG15.localdomain (2001-b030-8055-ffc7-2d87-7642-b84f-7a21.hinet-ip6.hinet.net. [2001:b030:8055:ffc7:2d87:7642:b84f:7a21]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c743a7ff529sm2027246a12.2.2026.03.20.07.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 07:15:32 -0700 (PDT) From: Guoyu Su To: 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 Subject: [PATCH net v5] net: use skb_header_pointer() only for DODGY TCPv4 GSO skbs Date: Fri, 20 Mar 2026 22:14:59 +0800 Message-Id: <20260320141459.9691-1-yss2813483011xxl@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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 --- 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-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..be0cc69fa534 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); + const struct iphdr *iph; + struct iphdr _iph; =20 - if (!(iph->frag_off & htons(IP_DF))) + if (unlikely(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) { + int nhoff =3D skb->encapsulation ? + skb_inner_network_offset(skb) : + skb_network_offset(skb); + + iph =3D 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