πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12117

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

#12117
From: Eric Dumazet
Date: Fri, 06 Nov 2026 09:53
60 lines
10167 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 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.

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

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

v4:
- 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 (2):
  net: virtio: validate outer protocol of UDP tunnel GSO packets
  tun: clear stale skb->protocol of NAPI frags skbs

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


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

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357903-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v4 0/2] net: virtio: validate outer protocol of UDP tunnel GSO packets
Date: Fri,  6 Nov 2026 10:53:38 +0100
Organization: Usenet Network
Message-ID: <20261106095340.2113683-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3840989"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Hq65/LcvqFemmW/TJuHy0GEA12g= sha256:u4DjdC2EFSfboadPAS1EakmL0h1dltKf+Gko4iAeFjY=
	sha1:3aVlQlvIwQn4OztllOxbDTiasAo= sha256:VHXFGbzc3SQLgS1oYkErBSxFVHc1X6FEz3/xZ4JfGjk=
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 DB1081131E4; Fri,  6 Nov 2026 12:55:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[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 3CJkf_KqvaYH;
	Fri,  6 Nov 2026 12:55:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-357903-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 2F6211131B3; Fri,  6 Nov 2026 12:55:01 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 5F6CF602048; Fri,  6 Nov 2026 09:53:47 +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=1793958826;
	b=iJuvQJ0VhKMOFMR2Kbinr+c5g0YU5ukgc6Q+RyuWAsPYx6Tl0h4/oWslvmL+asOLFxkT
	 nUwD+U6HR9hAidvnDso6oh9/iUGl9V7pgK/a90mvI/kAAV+fV12v/r6ru4rbeev78PtXG
	 Vx92J7zSjh7Ji3AxjBBxWGHrpZfjHLJ3+LqKEEHpekvfZCo1WYvEcptDw4qE8lLKxNXol
	 bq2BOTnKoRQAY2WSbeQmEIBJoq6XPPH1f/rdQ0IXPcyUVFdpHx4fieD3o83Hi0BzRhE+/
	 5x89rM5C1nweeFLdWK5v0vnn3rQv98mCfwF0oLnWVkG7aJayZoS8BcPkJ5aq+UYSOjQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793958826;
	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=7LvVlJp3mLceHmkPiQDvM+GblBTrhCafJwX1Eszwuqw=;
	b=VI6mBGto/8vR/UXSBE23f2KK7AWnPCx+pRSPZzt0HjAEM2l9+wKyLSGQO4fJlPgsfSu2
	 8CoKjRyiB6BJPCTcJxiElfw59yiyHDM4L8rSG3Xp7Ok3KlcgOfH7PeM0PM+qR0KQluxhF
	 aHQMr1red1w/Bnx5jc4HxjKmrRvFnnGtpNBQJjfU+m8cEB9pb4b+Hx9crqvZc+c/oU/IX
	 Gg8hX7QuHVBOAHWOUayJpsiS6O7vA8U9xN4Lt20NIMiLLf4HbUS17A2xpTTUGeVSmQuT0
	 clFOq/qUJ4OrVckvF5eWPnGbqKbZFxnMR8NKovE/6o3FJdwhlXQeKwr2l1cAMyXsIrg==
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=BYkgwOdw;
	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 F3818606A333;
	Fri,  6 Nov 2026 09:53:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BYkgwOdw
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=1793958825;
	b=dvaspFP+RZ0/IjEDb0Jr2Q7Pey/3MDaNBzzg07d9n5JnJA9ow/+rl1vXhCm4nOjjKu1g
	 uw3GGyk02WaVDTCRGpYVVldg+apizBH3hxqxMEkPUCrPzbyUNKmdSVKEgGeaGcFJPmLxx
	 rQ9mqEJHWKXah3Xf7ZZDpPZgGjRJpbXDBUn9Bm4YTC7sLNoOOGE9s/20Zkg5igXR7WcNI
	 Nj2mYwsnEtj44qI5CZ9b8hvyZ8A1Uo4qnOR5jfxq0oN2GCG+lZt/+PIVxh0PZ5zedFm4e
	 jMyYkXBL8TIMMMkNqhnqINpPSZ4ab9PLF+lPsSVxQoNCBvg9q1JHWY6ZoDS473pQCFA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793958825;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding;
	bh=7LvVlJp3mLceHmkPiQDvM+GblBTrhCafJwX1Eszwuqw=;
	b=tdNytj8Ic4s/hn3Ci3AgRuD5xIKR52mIvJV+iQgjqEL+TuQRdLp7Xe3o1qAwN6/y9Oe/
	 mTf0ku4WSDFnI7cK3Wl8DxT6HDbVE3qMeufXMtW3ddxUuvAngox9Hp3Gfg4RLA3Tq6RJd
	 tpR5g/1eQd6Wwg1IxHv1A/VCN9ROWO6dqIqpvkOiWpYrxhbZiVnx/nDidykyZL5VaaPU0
	 KxUjfFHI/7cdv3wSanb4m7HJrmraBf556Xl3eTXbRbkyqqkt30wacRMeic9h1LIZIWhgp
	 p7oPLhf7zN0ci6gEHlh5/eGejxL2NMQpHW5Vbc/sCNAt9lSKLezIt1ZFiRg2VFKCG0g==
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=BYkgwOdw;
	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 D5B02606A326;
	Fri,  6 Nov 2026 09:53:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0162F1F0089F;
	Fri,  6 Nov 2026 09:53:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793958824;
	bh=7LvVlJp3mLceHmkPiQDvM+GblBTrhCafJwX1Eszwuqw=;
	h=From:To:Cc:Subject:Date;
	b=BYkgwOdw2m9hOp3ksqjkAN4XkpR1giNPd1iA3qw9qvB/Z0ECdvks88iO7YYJjow4t
	 3d6nMMYfyZIW9HPhE/YEURCaDTtjB2ImnbMkNYetRFGtTTsj4kKPyI4/OZeUeO3kE6
	 merqIcgsdrORaUw5i6E+r6NgpxIWTJ9BY6u9S32/DmwIjVojmoighBE3PTQw23iaEE
	 1Siph14EnQYJK+EjgKFWM8aCiO43oJvbcADiLC7+BWHX3FeUQnDzhG9fonipcysWKg
	 8ZisfmpwGl83tKj594Fwo7J8NIjlBFK00JNrnmWkdBVcD7AjQ5ILaqrvozBuR3FV9O
	 vHNpAZi/Z1ErA==
X-Cc: Eric Dumazet <edumazet@kernel.org>,
	Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowangio@gmail.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