🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22655

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

#22655
From: Showta Ishizaki
Date: Wed, 25 Nov 2026 16:06
77 lines
10748 bytes
Michael wrote in v7 that he would be on other things for a while and
posted it in case anyone wants to take it up, so here it is, rebased and
with the review comments addressed. Michael, if you already have a newer
version, I am happy to drop this one in favor of it. Patches 1-4 and 6
are yours; what I changed is noted above my sign-off.

Changes since v7:
- Rebased. Commit 73e08d50eb13 ("net: virtio: validate outer protocol of
  UDP tunnel GSO packets") has the header parsing helpers and the outer
  header checks, so those are gone from patch 4.
- Patch 4: has_eth is passed to virtio_net_hdr_to_skb() as well, instead
  of looking at the device type. I dropped Chris' Tested-by, as this is
  no longer what he tested.
- Patch 4: the tnl_csum_negotiated check is ahead of the validation
  again, as Willem pointed out.
- Patch 5 is new: the outer checksum of tunnel packets that are too small
  to segment. Willem asked for it as a separate patch.
- Patch 6: the sysctl does not turn off the outer header checks, which
  are in the tree unconditionally now. I turned the Reviewed-by tags into
  Cc, as that changes what was reviewed.

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.

I compared no patches, 1-4 and 1-6 on arm64 (qemu, TCG) with frames
written to a tap:

- Non-GSO UDP tunnel packets that ask for the outer checksum, over IPv4
  and IPv6, go out with a wrong one without the series and with 1-4, and
  with a correct one with 1-6.
- When the inner packet is a fragment, 1-4 reject them with EINVAL, and
  1-6 send them with a correct checksum.
- GSO behind an IPv6 AH is accepted without the series, and rejected
  with 1-4 and with 1-6.
- A plain UDP packet with csum_offset at the destination port is
  completed at input and counted in rx_csum_sw. One with good metadata is
  not counted.

The objects touched build on x86_64 with W=1 after each patch. At the end
of the series I also built the um objects, and linked an arm64 kernel
with CONFIG_INET=n and VIRTIO_NET=y.

Based on net e6474ead54b8, where the tests were run as well.

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               | 247 ++++++++++++++++++++++-
 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                   |  16 +-
 13 files changed, 381 insertions(+), 24 deletions(-)


base-commit: e6474ead54b8acecb8b0462dde2d77f46d2b7dc1
-- 
2.54.0
Technical Details
Message-ID: <20261126.rfcv8.99797.0.zakinko@snowrabbit.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371511-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371511-linux-kernel-netdev=dewy.ru
From: zakinko@snowrabbit.org (Showta Ishizaki)
Newsgroups: linux.kernel.netdev
Subject: [PATCH RFC net v8 0/6] more virtio-net csum hardening
Date: Thu, 26 Nov 2026 01:06:41 +0900
Organization: Usenet Network
Message-ID: <20261126.rfcv8.99797.0.zakinko@snowrabbit.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network; logging-data="250112"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:f4VYTbLvqs+7pPYs2U3YqJ8minE= sha256:Akfot53EEhNhqRd6ebL5M90To23xpuNjUckeu/mvP7o= sha1:XpaT9S5VT/zHz284AyBbOMQvhzY= sha256:i+Lwe5kNGB9WD5T34nfJoW+eAACvL72BjQz58HzWJT4=
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 0FD88125E80; Wed, 25 Nov 2026 19:07:27 +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 Rnof_QMEOyad; Wed, 25 Nov 2026 19:07:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371511-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 8068D125E81; Wed, 25 Nov 2026 19:07:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 4A6023BDBA; Wed, 25 Nov 2026 16:07:00 +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=1795622818; b=PebfnNLLY16qM+2M2jlpK3BRJd6oyAPt7f025Xeo0YvUTfzTJDLIkUaczg8E5JKb5Mbs 9tP5ct6ozB0chUyHbITENlGEpCm5ZmuFJcM/k0SMAxzzXNxrtxxLseduSy0u34JTbOSvI fIv0CehtOtN5UKpfOIW+3uAPYIGYNMSPgLmWFYSufcqz1lJwnzgEdyKmA2w7pLDFEFW+g zT4Brzg2e/qKTi7xyvAYmlkBSFYl+gnU7pNFXWgsXA0rjCVedUfKB4qiaUE8PrxKUX4jl LlPx47BTZWS+RYKTMUVQ6logKIdOdBwkBG+crQghwovfUuskjxlbgWNAA2DGedywcfw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795622818; 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=tbHtq4u5qNw0coKzM67hn3NfizR9DRcO7y7V+ZSUs48=; b=E2QsFdo/lKFflongVIU/l86mJpHYvyRbukaS2EF8QKL2wYaRwpzfONzH6VcYQELVAlR6 JCkDII90ANDywPHpwjjXeC+FKwfaucTRoHzkXSimEt4kyM8PvK4b+uo2sI17C4nBFFxvP mhhIVWB9HkekJQago0g0cFKEEfD5fG52jaumISbfFEUwAopfle+9pMw03Re3/wDRhOSjr uT9/AHpps1copoyyPcbhlKIrZfF7yjMTEzmKd223m0uoLIpCp3LdIyM2iSmuaoE8jSKQA UbO8XQwySwMsnBJ+2kAftY5r6oIRfg5zLoyhtPVr1pBUN792hpx1IExMVP/RID/ssFA==
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 3FD5E606A690; Wed, 25 Nov 2026 16:06:58 +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=1795622817; b=pQh3DlbFLIUBmyPNX0vNI+S1fdKBwsJohUJHNkTU9miQI8eO9k96LIU3c4qrXsskYK6t wxjslImzu8hjV8KsgTtWVUuaIGB7jl3uQCdMw2xxN2/8U5XXlZCMP0Moxh5aFdd5WU06H VGhCCv2cYJlAxw+JjqsdUfbHcsSl/30ZGQM21+Ule/4C2++HWZtqfrJIWCGA0ewtDRB/6 6D5ud2ZJJviHZnJJohqx04o0xAe0X+mYbrnumpoDc9fU6X3GW+Pit0X7aMGZYosmW1RfY xFaEkDZDNQIrdoRBIh95FOXqu91pd0kV2LihWj8RwmvhwrIHpbUhOQtbCjMABNqwOhQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795622817; h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=tbHtq4u5qNw0coKzM67hn3NfizR9DRcO7y7V+ZSUs48=; b=ZECnogIVvElSmgTG2ss5S3NW+19bwiq/IetMS6ipwlcgJ+DL5iauCZDyvpHoSlpUxYJ6 yDVOQRYJKeNgweQafm7SWhOWnjJygBH6QfvBXX7leSGkPGhKKLHnm4hOfPHxqEVR9wfjl NXcLuNBhrptuiGPr5hgPVZhwqkn92JBzjVWgW3D19Ee7a4IzSv0RP1PK33gshtSOH8I1z 8XgYvCBct0ehoFbCKO0CTN439Xqml0AFxlTUwwx3Z6srM2WV1SXWUCYiQ0MkXrXvVMqGT eHE0PYKlgeEtEYrq4eWwwJN4GnZNh3hFhFmihOt5oSgTa3eta8R2olDMIP3FaZmgLaA==
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 81B88606A680; Wed, 25 Nov 2026 16:06:56 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 81B88606A680
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 2B33CC9300; Thu, 26 Nov 2026 01:06:55 +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