🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25598

[PATCH RFC net v9 0/6] more virtio-net csum hardening

#25598
From: Showta Ishizaki
Date: Wed, 02 Dec 2026 04:00
64 lines
10320 bytes
Michael's series again, now v9. Patches 1-4 and 6 are his; patch 5 is
mine. The only change since v8 is in patch 4, addressing the two points
the Sashiko AI review raised on it; what I changed is noted above my
sign-off there.

Changes since v8:
- Patch 4: has_eth is now derived from dev_has_header() as well as
  dev->type. TUNSETLINK can set an IFF_TUN device to ARPHRD_ETHER while
  its frames still start with the L3 header and it has no header-create
  op, so dev->type alone had packet_vnet_hdr_to_skb() validate csum_start
  against a phantom layout 14 bytes in.
- Patch 4: virtio_net_l3_start() records skb->protocol when it resolves
  it from the frame, so a later virtio_net_hdr_set_proto() cannot relabel
  an IPv6 frame as IPv4 for GSO_UDP_L4.

The two issues Michael listed as open in v7 are still open, hence the
RFC: the inner packet of a tunnel can have a valid header at
inner_nh_offset that overlaps the real transport header, and completing
the checksum at input breaks nf/BPF programs that edit the payload and
rely on CHECKSUM_PARTIAL.

For the has_eth change I put a kprobe on __dev_queue_xmit and sent, over
a TUNSETLINK'd tun via AF_PACKET with csum_start=34, a frame that is a
genuine IPv4/UDP datagram at offset 0 but whose source-address bytes also
read as an inner header (src 8.0.69.1 so bytes 12-13 are 0x0800 and the
bytes at offset 14 parse as an unfragmented IPv4/UDP header). Without the
change __dev_queue_xmit sees it with CHECKSUM_PARTIAL kept and csum_start
at offset 34, into the payload; with the change it is resolved, and a
plain partial checksum at the real offset is kept either way.

Patches 1-3, 5 and 6 are unchanged from v8 and were tested as described
there. Based on net e6474ead54b8, the same base as v8 and where the tests
ran; it also applies to current net (250b42eb17b7).

Michael S. Tsirkin (5):
  net: account for ingress-resolved virtio net hdr state
  um: vector: trim skbs before verifying the header
  virtio_net: parse tunnel csum_start little-endian
  net: resolve uncommon partial checksums at ingress
  net: add a sysctl to opt out of virtio net hdr checksum validation

Showta Ishizaki (1):
  net: virtio: compute the outer checksum of non-GSO tunnel packets

 Documentation/admin-guide/sysctl/net.rst |  19 ++
 arch/um/drivers/vector_kern.c            |   6 +-
 arch/um/drivers/vector_transports.c      |   4 +-
 drivers/net/tap.c                        |   4 +-
 drivers/net/tun.c                        |  44 +++-
 drivers/net/tun_vnet.h                   |   4 +-
 drivers/net/virtio_net.c                 |   2 +-
 include/linux/virtio_net.h               | 255 ++++++++++++++++++++++-
 include/net/netns/core.h                 |   1 +
 net/core/dev.c                           |   7 +
 net/core/net_namespace.c                 |   1 +
 net/core/sysctl_net_core.c               |  50 +++++
 net/packet/af_packet.c                   |  21 +-
 13 files changed, 394 insertions(+), 24 deletions(-)


base-commit: e6474ead54b8acecb8b0462dde2d77f46d2b7dc1
-- 
2.54.0 (Apple Git-157)
Technical Details
Message-ID: <20261202.rfcv9.41657.0.zakinko@snowrabbit.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375532-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375532-linux-kernel-netdev=dewy.ru
From: zakinko@snowrabbit.org (Showta Ishizaki)
Newsgroups: linux.kernel.netdev
Subject: [PATCH RFC net v9 0/6] more virtio-net csum hardening
Date: Wed, 02 Dec 2026 13:00:00 +0900
Organization: Usenet Network
Message-ID: <20261202.rfcv9.41657.0.zakinko@snowrabbit.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1880835"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:09q11/G7ccK705aud8N3d78P00g= sha256:B8x+lsD0Zg+3TFNS/MOo3VhRXX4s6+ljnnx+rxUC5Qg=
	sha1:SPR4NuB2mhzzpuL1y/4ooB6Ne3Q= sha256:vJ51cRGaMOEOPgmJT0yn9dQL2P3PPAUIz+OOkxgY48A=
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 8B1D211754F; Wed,  2 Dec 2026 06:50:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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-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 1pWGhlsKBmQ4;
	Wed,  2 Dec 2026 06:50:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375532-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=snowrabbit.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 0D70E117549; Wed,  2 Dec 2026 06:50:27 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 149B127290; Wed,  2 Dec 2026 03:50:25 +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=1796183421;
	b=KapG5sV/vLranZtLTE8825d/8XOTwgZZHJHaCzLxV0iaffxMoaSG1x4Ogf9SD0P18DLK
	 RhYsXlcXwIBSj0CAnV5vMZxgvWzCEvuZEAPlL00b/BEIzB2iOkk0P5TmgBskJ40xHmlln
	 zkEsytTw3ZN4gvmn0zmAOar4WP6opGRo4Y7isE7IDhtN57tHgnit85UPXeFD5EtWMzkEv
	 KVmZqYRih0703OXE3R5cnS6OF90toYet6KCo7DTv+SSpzX/vWsxd8GhwAi7VwznKdm/WQ
	 E3m+2r4hqyQbrO4d2NEev7XJSUFwdToZR9H7u6MTseg4437SVBAyhoRG/9L4nZ0Epgg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796183421;
	h=X-Original-To:Received:DMARC-Filter:Received:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=Z0ezdayaNaf+krwCNdMa5gtNv+iaKeyLdTGEp5wBJGI=;
	b=R0B7GaAuVG1NhULtx9OVTMbOQZVDa/dPe5jBW+Vn0O1fMyTG4ZZe0ALWBIbwfrtmUBCG
	 YUNNUxj8Q/9z0yL9lTzGWLt7Qy33D6K54bIBdBatJ/oAoR6CBLO0LjKXjE68bgldYYQYa
	 nuBdV5H2UgLy9/k0WaHCnfJI992iCJxMQxNVo9Lo5r8eg4rx9NbTrazwqktxXDdvYXFBg
	 628qQdcdBMMCscXqbexuBDq6r3HYHIgYJbWoQE8U8mYaX495lFVj8udSabG3ajhrGOIPa
	 3CItgg6qeTeDM3Vl4Mzc5MGLrC14GdE988P0DcsC+Nzu6RDsR8IoRrs8cu7scAe8Z1A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=snowrabbit.org;
	spf=pass smtp.mailfrom=snowrabbit.org;
	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 50DFA606A6A0;
	Wed,  2 Dec 2026 03:50:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=182.48.54.220
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796183420;
	b=yz6/1u+Twbf1a0+XF3XjU2/9q4oVlQVNWdPgQ7tNgzdh3iiG465IFK9H42Fz0g11nNcF
	 q3BUaAPRVSWPyPm69ObPE/h0nNcPwgBftbJFRj/wXl34sKBC1fuLhqSft5UxUfkaNX0HM
	 DNddJ7W00avGIrfnUMx5Yzdh1KeLzSVrXRBXWBvyujFPu45SAnDtxXFkpa0goejKHDXG1
	 4Ne2I3raV2HXPhLt8VGg8lKDZuruZiGBrDtcTLGLXGYAwreoBET8I9HGmfETIH+ANhDfQ
	 Epphjk+rA7M1zkA+1GaiSiiiftuE1aUMwMHz5Ffflap+TmqGLPRkiVYh4vC4tl2yzbw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796183420;
	h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID:
	 MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=Z0ezdayaNaf+krwCNdMa5gtNv+iaKeyLdTGEp5wBJGI=;
	b=r3W0ec7O7d/41DXKxIIU9Mg2LiX0n41I1v9gkDz2GUJIg2ECAp79dzx/tnrS6DuJl506
	 HT0iwzJzWOYMcifrHoMocUGoVz3kvrSKs2ka9bATWw5EZDQnqox3heQmiEFhct91z2Oz4
	 sCVfqSHybenu8BBXs7UdxtJIJtHgNKe3RcnxziayjxQOxvFPNn/sYV/fcfBUGv3gDD1n6
	 zQCNTNdFNoNvjLTvwRPa3WUrcMsO0qF+3QPgWhFjTL61WTsrqjI4Lyxla/6Z5YQHUQfRT
	 hAQPqj2ZOGrFUlQ8m/L9WawCK4tO4WIyCq/mTh+mQRLZs4rzmyfduyXpcYaMotdKRKw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=snowrabbit.org;
	spf=pass smtp.mailfrom=snowrabbit.org;
	arc=none smtp.remote-ip=182.48.54.220
X-Received: from bambi.snowrabbit.org (bambi.snowrabbit.org [182.48.54.220])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DC0F606A33D;
	Wed,  2 Dec 2026 03:50:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9DC0F606A33D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=snowrabbit.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=snowrabbit.org
X-Received: by bambi.snowrabbit.org (Postfix, from userid 3001)
	id 76E05C92FA; Wed,  2 Dec 2026 12:50:18 +0900 (JST)
X-Cc: Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Simon Horman <horms@kernel.org>,
	Eugenio Pérez <eperezma@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Richard Weinberger <richard@nod.at>,
	Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Chris Arges <carges@cloudflare.com>,
	Paulos Yibelo <habte.yibelo@gmail.com>,
	Björn Töpel <bjorn@kernel.org>,
	virtualization@lists.linux.dev,
	linux-um@lists.infradead.org,
	linux-doc@vger.kernel.org,
	Showta Ishizaki <zakinko@snowrabbit.org>
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