Netdev List
 help / color / mirror / Atom feed
From: Showta Ishizaki <zakinko@snowrabbit.org>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Jason Wang <jasowangio@gmail.com>,
	netdev@vger.kernel.org
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>
Subject: [PATCH RFC net v9 0/6] more virtio-net csum hardening
Date: Wed, 02 Dec 2026 13:00:00 +0900	[thread overview]
Message-ID: <20261202.rfcv9.41657.0.zakinko@snowrabbit.org> (raw)

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)


             reply	other threads:[~2026-12-02  3:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  4:00 Showta Ishizaki [this message]
2026-12-02  4:00 ` [PATCH RFC net v9 2/6] um: vector: trim skbs before verifying the header Showta Ishizaki
2026-12-02  4:00 ` [PATCH RFC net v9 4/6] net: resolve uncommon partial checksums at ingress Showta Ishizaki
2026-12-02  4:00 ` [PATCH RFC net v9 5/6] net: virtio: compute the outer checksum of non-GSO tunnel packets Showta Ishizaki
2026-12-02 21:06   ` Chris Arges
2026-12-02  4:00 ` [PATCH RFC net v9 6/6] net: add a sysctl to opt out of virtio net hdr checksum validation Showta Ishizaki
2026-12-02  4:00 ` [PATCH RFC net v9 1/6] net: account for ingress-resolved virtio net hdr state Showta Ishizaki
2026-12-02  4:00 ` [PATCH RFC net v9 3/6] virtio_net: parse tunnel csum_start little-endian Showta Ishizaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202.rfcv9.41657.0.zakinko@snowrabbit.org \
    --to=zakinko@snowrabbit.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=bjorn@kernel.org \
    --cc=carges@cloudflare.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=habte.yibelo@gmail.com \
    --cc=horms@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=richard@nod.at \
    --cc=skhan@linuxfoundation.org \
    --cc=virtualization@lists.linux.dev \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox