Skip to content

RFC more virtio-net csum hardening

Showta Ishizaki linux-doc linux-um netdev virtualization 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 RFC Latest6 patches 0 repliesNew
  2. v10 RFC6 patches 3 repliesSuperseded
  3. v9 RFC6 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v8 RFC6 patches1 replySuperseded

Changes in v11 from the cover letter

- Patch 4: AF_PACKET took has_eth from dev->type, which TUNSETLINK can also change on an IFF_TAP device that still builds Ethernet headers. Its frames were then validated from the network header, so a non-IP EtherType with an IPv4 header behind it kept CHECKSUM_PARTIAL and a VLAN-tagged frame lost it. A device with eth_header_ops now counts as Ethernet too. Sashiko found this.

Patches in v11 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6net: account for ingress-resolved virtio net hdr statearch/um/drivers/vector_transports.c drivers/net/tap.c drivers/net/tun.c +2 more+48 -100 replies
2/6um: vector: trim skbs before verifying the headerarch/um/drivers/vector_kern.c+3 -30 replies
3/6virtio_net: parse tunnel csum_start little-endianinclude/linux/virtio_net.h+1 -10 replies
4/6net: resolve uncommon partial checksums at ingressarch/um/drivers/vector_transports.c drivers/net/tun_vnet.h include/linux/virtio_net.h +1 more+156 -120 replies
5/6net: virtio: compute the outer checksum of non-GSO tunnel packetsinclude/linux/virtio_net.h+106 -70 replies
6/6net: add a sysctl to opt out of virtio net hdr checksum validationDocumentation/admin-guide/sysctl/net.rst include/linux/virtio_net.h include/net/netns/core.h +3 more+100 -00 replies

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchWillem de Bruijn
1/6R-b
2/6R-b
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v11 thread

Cover letter [PATCH RFC net v11 0/6] more virtio-net csum hardening

Michael's series again, now v11. Patches 1-4 and 6 are his; patch 5 is mine. The only change since v10 is in patch 4.

Changes since v10:
- Patch 4: AF_PACKET took has_eth from dev->type, which TUNSETLINK can also change on an IFF_TAP device that still builds Ethernet headers. Its frames were then validated from the network header, so a non-IP EtherType with an IPv4 header behind it kept CHECKSUM_PARTIAL and a VLAN-tagged frame lost it. A device with eth_header_ops now counts as Ethernet too. Sashiko found this.

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.

Patches 1-3, 5 and 6 are unchanged from v10 and were tested as described there. For patch 4 I sent, through AF_PACKET with a vnet header on a tap that TUNSETLINK made ARPHRD_NONE, a plain IPv4/UDP frame, one with EtherType 0x88cc and an IPv4/UDP header after it, and an 802.1Q-tagged one, and looked at the skb at __dev_queue_xmit(): v11 keeps the partial checksum on the first and the third and completes the second. The TUNSETLINK'd IFF_TUN case from v9 behaves as before. Based on net e6474ead54b8, the same base as v10; it also applies to current net (90ae4042bd9f).

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               | 263 ++++++++++++++++++++++-
 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                   |  24 ++-
 13 files changed, 405 insertions(+), 24 deletions(-)

base-commit: e6474ead54b8acecb8b0462dde2d77f46d2b7dc1

Signature · 1 line
2.54.0 (Apple Git-157)