πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14206

[PATCH net v6 0/3] net: virtio: validate outer protocol of UDP tunnel GSO packets

#14206
From: Eric Dumazet
Date: Tue, 10 Nov 2026 21:36
84 lines
11421 bytes
virtio_net_hdr_tnl_to_skb() does not check that a UDP tunnel GSO
packet really has outer IPv4/IPv6 and UDP headers matching the
declared tunnel type. A guest, or any tap writer, can send a frame
with another outer ethertype (NSH in the report), and the GSO stack
then builds segments with skb->data before skb->head. The host
crashes in skb_under_panic() as soon as a header is pushed.

Patch 1 fixes the producer side, virtio_net_hdr_tnl_from_skb(), for
VLAN tagged packets:
- the tunnel offsets did not account for the VLAN tag tun inserts in
  the frame, and were 4 bytes short.
- the outer family came from skb->protocol, which is the VLAN protocol
  when the tag is in the packet data, so an outer IPv6 header was
  reported as IPv4.
Without it, patch 3 would drop such packets. Kernels without this fix
still send such headers, so it should go to stable along with patch 3.

Patch 2 clears a stale skb->protocol left on recycled NAPI frags skbs,
which could make the checks of patch 3 reject valid frames.

Patch 3 validates the outer headers, using the parsing helpers from
Michael's series "net: resolve uncommon partial checksums at ingress",
as Willem suggested. The callers tell whether frames start with an
Ethernet header, as the device type of a tun device can be changed
with TUNSETLINK. The rest of Michael's series (checksum validation and
completion) is left to him.

The selftests of v3 will follow in a separate series, with the fixes
Sashiko found in them.

v6:
- Patch 1: also take the outer family from vlan_get_protocol()
  instead of skb->protocol (Sashiko). New title.
- Move the tun skb->protocol fix (now patch 2) before the outer
  protocol check (now patch 3), so that no commit rejects valid frames
  (Sashiko). Reword its changelog accordingly.
- No change to patch 3.

v5: https://lore.kernel.org/netdev/20261109163507.3102091-1-edumazet@kernel.org/
- New patch 1: account for the VLAN tag in the tunnel offsets built by
  virtio_net_hdr_tnl_from_skb() (Sashiko).
- Patch 2: add Michael's Acked-by, no code change.

v4: https://lore.kernel.org/netdev/20261106095340.2113683-1-edumazet@kernel.org/
- Squash v3 patch 2 into patch 1 (Willem). Dropped Michael's Acked-by,
  as virtio_net_l3_start() now takes a has_eth argument.
- Patch 2: clear skb->protocol in tun_napi_alloc_frags(), the only
  place that needs it (Willem).
- Drop the selftests from this series (Willem).

v3: https://lore.kernel.org/netdev/20261105115715.1466924-1-edumazet@kernel.org/
- Patch 1: fix a comment, ipv6_find_hdr() stops at AH (Sashiko).
- New patch 2: do not use the device type to find the outer L3 header,
  TUNSETLINK can change it (Sashiko).
- New patch 3: clear a stale skb->protocol on IFF_NAPI_FRAGS skbs
  (Sashiko).
- More selftests, and big-endian fixes for them (Sashiko).

v2: https://lore.kernel.org/netdev/20261104050131.629967-1-edumazet@kernel.org/
- Use Michael's helpers instead of a new one: find the L3 header from
  the device type instead of assuming Ethernet when skb->protocol is
  unset, do not trust skb->protocol when it disagrees with the frame,
  and require UDP exactly at outer_th_offset. Stop at IPv6 AH headers
  (Willem).
- Selftest fixes, IFF_TUN tests.

v1: https://lore.kernel.org/netdev/20261103203113.550604-1-edumazet@kernel.org/

Eric Dumazet (3):
  net: virtio: fix UDP tunnel GSO header of VLAN tagged packets
  tun: clear stale skb->protocol of NAPI frags skbs
  net: virtio: validate outer protocol of UDP tunnel GSO packets

 drivers/net/tun.c          |  15 ++-
 drivers/net/tun_vnet.h     |   5 +-
 drivers/net/virtio_net.c   |   2 +-
 include/linux/virtio_net.h | 181 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 195 insertions(+), 8 deletions(-)


base-commit: fdca4b030c78fa2773a94fda3a6dc3ce5558a727
-- 
2.53.0
Technical Details
Message-ID: <20261110213628.3476051-1-edumazet@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360635-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360635-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v6 0/3] net: virtio: validate outer protocol of UDP tunnel GSO packets
Date: Tue, 10 Nov 2026 22:36:25 +0100
Organization: Usenet Network
Message-ID: <20261110213628.3476051-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="707806"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:oyPR/DkgLSfjSENGoW4wYO85BZA= sha256:Zwlw10/xbnlXG5sC69wQDBaSx5ZK89vvZVzLRg17HPQ=
	sha1:8AHXaSa488uNB0tw6w4LI88FbXE= sha256:VS/T4PaWE5qlqoOc9Rzvh8Nh3PF1jP6x1lOSrstxE98=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id A7861113D49; Wed, 11 Nov 2026 00:37:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id FltmD2e8EMaq;
	Wed, 11 Nov 2026 00:37:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-360635-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id F02B6113D46; Wed, 11 Nov 2026 00:36:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 7D187624FE; Tue, 10 Nov 2026 21:36:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794346600;
	b=j6JboF+TnGmnnAX7PkQP9XuiWgFfQ7APjzskhg7bNoq5E16+K93uMKciRMhDT/a8B7yr
	 Dm4iy96cfJzhTxzsH2NrwpyswusUwa2R9Dc2LMzsCSA3osrOa08Jv+X8jLXEz2ZJV+bu6
	 dz/OtzQDnOrAf1Nd1EvZ3kR/8VXoDHGoGBxY/uRncMeu0Ytw5F+jpAub9Z6WH5rb8AHss
	 smcamG7BjnH4NufJAS/KfMMvd3e4q2aRIMdP4ap6ueXBfWfd+0wjPlta0LxUbuwNyQTte
	 Ctgmkw+WUq8mKnbYlb1FFUxsnFKSBEuyARvUpzMWOJHwjNqYfHNah8o8EGfwse4gT1Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794346600;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=8n0le04FNg/0rCa83fIxN5EOqJ6nyAusJtI49zdt4g8=;
	b=NjchIRhmdrSt56KV13518zxywRk0MX4cCd7KRnZOQqThDVnHiBxz43itqOmTnkyloP13
	 P6X/Y7h0BIRXcT16F5F8tIhQVrqtbAhxNjnOwIAgHCKIzao6PD1jluNQv43sxunmVZtzn
	 xz6/hVEHrQ4GVfsSksuNS/isVHM4bJ050wZqWaaF9QRho3uFr1nqOkjz8ohLJTg7qkjyf
	 xeGTogayfcyQhYx+pkhTBFIcs9fHG7KKx8B8s7cLoPESTGORTjq+hgvs0Dn+X+z9Kqd5a
	 Kuj5YLdMmP7J9AUNqerOzZmL/VrGaLPg29x3l0YaeomWAamd8osP7eZId8zK7SkscOw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QF7n+VSI;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 70A3B606A320;
	Tue, 10 Nov 2026 21:36:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QF7n+VSI
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794346594;
	b=Eihz4/sw6CRx/NigVuHCuzwT56pnc2o7MQjSi8n8uSvzh/Btjmax9NVmsmSk92o3LpnC
	 qZFlYaf71z5l+x0pFttzhDSDlfiP+Jf8i042ZyLWVRUbugDGP0dbAPcK7VVtWKZoo9nhS
	 nVbaqMU4FdEkF58rZo3wkLHzG8hPLXvwb+602iMjXJ/JrERJ1S6ieIBVxUlQb+d4eMGjY
	 ghLPiv5jZqKrqJ2prAJZNpsbnCufZkp/vviicIBpDvO2vpSXjnAbhj+xmvF3TG8Hefxin
	 lqyG6R5nKJlCjQyUAhY/tTMfBJ+8enzDhugZMVnLnkGIIdfeZ6qtN0LMlmfS/2iDGVg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794346594;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding;
	bh=8n0le04FNg/0rCa83fIxN5EOqJ6nyAusJtI49zdt4g8=;
	b=gcIrrsE5YRZLhYtES7mESwMR584hPTkVkxfrV2gdkm3DTswW2RoTcaMMitio9NOfYT13
	 LrPKjAxfISVvIT3+6TvnfmczZiU/14NbuGwPd2reCBqsXyetvJpX8cjsreFRY2qFOJwc5
	 ovNzrXy+k4p9RLt2RNmuz7/2aUCR6DAL9KoKk5ReDEGbp7jNuy5uPB7p54Y2tiuau+SGJ
	 e5XV5nS0DEqOra3RB1+YaXANDEXhROLDgQjXfWQwj6JK25rX+TPp1B2uXKy4W7X2kNqpQ
	 J9K/KlsXSxsIj/SFtlHooF275cr7dLu/MddxUPyryn2TSgr12DMnACDpGTPM7e58ojw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QF7n+VSI;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D07B606A31C;
	Tue, 10 Nov 2026 21:36:34 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CB371F0089F;
	Tue, 10 Nov 2026 21:36:31 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794346593;
	bh=8n0le04FNg/0rCa83fIxN5EOqJ6nyAusJtI49zdt4g8=;
	h=From:To:Cc:Subject:Date;
	b=QF7n+VSIlcNx++it9DojKYSHFZSvlbPfny89ikkS0toDmJdJpI9KWh71wwzN7RFcN
	 LTC4fPbylf62bDQSxLDzJiDZ0pr49hNFKybYXXypetI9EuMLCsC2IHnZ/NsvxHwEq0
	 1XsGAsEbgI/ROxmtyOALdZZAtMspIlHJSBhiqZgcLmi8VUpUA9wHA7oyg6TEkQn6hG
	 fpT/wuza7a5deViRxeVNR2x1gerJpyjuHJfHKhQxw1fIsqEd3gx3P0YTU5Ck7YRopE
	 UWycLgYQZk55YZ/Ed1cJbSXpAXIsWyL6266lpX7nl8vv31CHlTHX5dd0kgHdXMlwZ3
	 WtsO5D5aGsTVA==
X-Cc: Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	edumazet@kernel.org,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowangio@gmail.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Eugenio PΓ©rez <eperezma@redhat.com>,
	Hassan Sultan <hassansultan@google.com>,
	virtualization@lists.linux.dev
X-Mailer: git-send-email 2.53.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list