πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10788

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

#10788
From: Eric Dumazet
Date: Wed, 04 Nov 2026 05:01
48 lines
9617 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 rest of that series (checksum validation and
completion) is left to Michael.

Patch 2 fixes a selftest helper computing UDP checksums over a length
in network byte order.

Patch 3 adds tun selftests, on tap and IFF_TUN devices: valid outer
IPv4 frames (plain and VLAN tagged) are accepted, mismatched or non-IP
outer headers are rejected.

v2:
- Patch 1: 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).
- Patch 2: clear udph->check before summing and send 0xffff instead
  of a zero checksum (Willem).
- Patch 3: clear the reused buffer before building each frame (Willem).
  Add IFF_TUN tests, where skb->protocol comes from the tun_pi header.

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

Eric Dumazet (3):
  net: virtio: validate outer protocol of UDP tunnel GSO packets
  selftests: net: tuntap: fix UDP checksum length in
    build_udp_packet_csum()
  selftests: net: tun: test outer protocol of UDP tunnel GSO packets

 include/linux/virtio_net.h                   | 169 ++++++++++++
 tools/testing/selftests/net/tun.c            | 269 +++++++++++++++++++
 tools/testing/selftests/net/tuntap_helpers.h |  10 +-
 3 files changed, 447 insertions(+), 1 deletion(-)


base-commit: 787268686c64be60023743b527645a907e38ccca
-- 
2.53.0
Technical Details
Message-ID: <20261104050131.629967-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-356191-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-356191-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 0/3] net: virtio: validate outer protocol of UDP tunnel GSO packets
Date: Wed,  4 Nov 2026 06:01:28 +0100
Organization: Usenet Network
Message-ID: <20261104050131.629967-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3328811"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ujQzvS1hQGgA7PKBVtMEsbqzCaw= sha256:M2sThOo/6IMXWRcLO+vuB/rmCAzhaNCpJx/TZ4T1/mo=
	sha1:hd0f6srcPYhmIi5/jrWhFiN0wjI= sha256:cloU0aIrpd7+Pi+psa0acHN5X/8PVYmB9JH4dUkcc/o=
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 B1372112ADD; Wed,  4 Nov 2026 08:02:05 +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 Etqz2hyesWO6;
	Wed,  4 Nov 2026 08:02:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-356191-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 BE1D3112ADB; Wed,  4 Nov 2026 08:01:52 +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 2E74927397; Wed,  4 Nov 2026 05:01:45 +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=1793768504;
	b=zPUt2JgJd63kS9DGhjioqr8IhRrl8ZRGMODFVZQqDl9nUy3uXIaKY4dRQoZkBWTGjbB7
	 c2yOfo9GShqdEHdZkHXdzu8HO3/9+o9piiMAU6Z+qJjIGh/xtDmEDDlIKnXnx8H2nUwj1
	 gOdaVV9LklXyXw4kt8lFR/CFCoIznwcjuxz1fudgro5PcbRgLT7gvf5vaMsQwkHXDQo7U
	 ZGmC4LAAwYbD9WTGOAkUBgnQl+LyDDLAYYcTnfbpQ2y16ydR8CHJ9uM0ToFoKYg54unRx
	 j4guNzSnE9J1naRkNePFLbuaT/v7Z+r/237xWoSiCXSI8OlZH8AlZbIodKcpok5jmow==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793768504;
	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=0wPtjYOAhIeZugd2ESPq1FOUrzmTQoQ46TekB4ReUyc=;
	b=ilJgVf6XuRPulK2PfE6lmFX40TsIxDWHVOaX6YJkwMYobCdMwcLTEUON6u2n6DcCCQa8
	 5N4Jp79V/QUPyHz6Q2lNV9SM1J4MoYycwqMwmO6Yz+1uxMe1KMNl7YD++LHxHGkrbFm/f
	 F4yS2uT/DUQGHUwGFLZOVVFoxQ/K7j2BM3f9yJTvI2vvRZ36RFCbSuW1THcjx7IlvEdX1
	 bKzCawK/AVwZOLwg23B044nGDJR8ttfOeIXtQ+syBNWxpJgbg7XM+SoeewFJtUKm5FhtY
	 5X2AQ1D1T90NAQiP3xWe0ZJvvK9vg2r8+HG8LA55mI5Ub2tLEEM8avriEXUwava6SZA==
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=CtRmgpZy;
	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 DB402606A334;
	Wed,  4 Nov 2026 05:01:43 +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=CtRmgpZy
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=1793768498;
	b=VDy7K4AenIq4DV+9EZKRvCZalwmeVFvcAfcW1DGpT2B+cC2MEyxjCQ643WK1FJfDEITq
	 NA37vDB5Rh501C3i4aQyTAABZoOYjD/1vhSIMLgpaKqgDEiKE6I1ziQe7OElBReeMF9Ax
	 aD8fluZZbMu/Od7jIOYW9XLDGLFkgP6AEh8m/6uzqEJM8wFTHd++qj3GFtaT9An7gVgTZ
	 ZDJwHY60iP3uaHMZaAxmU3KHv099cu1j/gzT6pSZNv3ad8CceL6EDELTF0QMgZHGhXo6b
	 vbbuKV6zFBEg4NAgtBOt94OHYqC4hXiG2T3AK0qObPcsAIevJzTfMJGe0ajbKAqd5cQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793768498;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding;
	bh=0wPtjYOAhIeZugd2ESPq1FOUrzmTQoQ46TekB4ReUyc=;
	b=3i9/fY9YI70DvwMaB9hrIYuKWJAt1OtWdL5mTTIAdfsVIv06zKZWSiS51Vu0BKtkbuyd
	 G4o1KnTM3Gs9/bf7/GkPVaeVeOihJCYJsVM3j01T2Z1t/H0/USKv8K4F7w1dFzD0RfsjT
	 EVunKy9peDWnZViMOYKk7qWKgzNZiWtKkyypbHFxf50+O8CqRdzd1I6IiCdonJctStT1h
	 VcpYmH4k9W2jnrJtH3haP0YGcocQXAooutcYWS78XlwK3qMjZG1RyTN/Z0iF9jY8HOq8r
	 yz8zX9WaYNRyng0Ikba02Rl5w49Kk/KO26juYL6U9OrwFXrcvLaqDK565RTH9J1Y9Sg==
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=CtRmgpZy;
	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 B6BA7606A326;
	Wed,  4 Nov 2026 05:01:37 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0095B1F000C1;
	Wed,  4 Nov 2026 05:01:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793768497;
	bh=0wPtjYOAhIeZugd2ESPq1FOUrzmTQoQ46TekB4ReUyc=;
	h=From:To:Cc:Subject:Date;
	b=CtRmgpZyrIgh/V5uGJm1gNFDDHYYe0cxTv3xIBOYXyhDknpdO5c/gPdu5Vro1Q05Y
	 2ltnQt3AjXx3RZWvDeItvo90XY7wVSpKMs8s3QduRRt5Yme/w9SYQ8Hj0et8Uzmn5F
	 PX2wBa5sqaYtZQt5MeEiAJc1PmA0gFUOg4mMSfSClOkUnFSd2bBxRT2aWbbFxEHAsa
	 XlExbJhunu+f3dtg93Bvi2nj9PSyM0BuCbn6Jpxn05X0QRKlKNN9RrNpNLIcXKs2oW
	 UOQqsBZdm9fcrM8z5ZkAqLYBJtC6Wyth3Klve/vgA2wLoayWFKizvvhL2IwZY7gqWx
	 RcOob2BdXvGNQ==
X-Cc: Eric Dumazet <edumazet@kernel.org>,
	Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	"Michael S. Tsirkin" <mst@redhat.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