From: Eric Dumazet <edumazet@kernel.org>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, edumazet@kernel.org
Subject: [PATCH v2 net 0/2] net: always dissect GSO packets in __virtio_net_hdr_to_skb()
Date: Mon, 28 Sep 2026 14:42:51 +0000 [thread overview]
Message-ID: <20260928144254.3361044-1-edumazet@kernel.org> (raw)
This series fixes a bypass of untrusted GSO flow dissection in
__virtio_net_hdr_to_skb() when VIRTIO_NET_HDR_F_NEEDS_CSUM is not set,
and adds a kselftest covering VLAN-tagged GSO packets without NEEDS_CSUM:
- Patch 1 initializes skb->dev and skb->network_header before calling
virtio_net_hdr_*_to_skb() in tun_get_user(), tun_xdp_one(),
virtnet_receive_done(), and raw_verify_header(), removes the
'&& skb->network_header' condition and the unvalidated
'else if (gso_type)' fallback in __virtio_net_hdr_to_skb(), and moves
virtio_net_hdr_match_proto() after skb_flow_dissect_flow_keys_basic()
so it validates the dissected L3 protocol (keys.basic.n_proto) rather
than the outer L2 protocol.
- Patch 2 adds a kselftest in tools/testing/selftests/net/tun.c verifying
that VLAN-tagged (802.1Q) TCPv4 GSO packets without NEEDS_CSUM (both
flags = 0 and flags = VIRTIO_NET_HDR_F_DATA_VALID) are accepted on a
TAP device, and that mismatched GSO types and truncated headers without
NEEDS_CSUM are rejected with -EINVAL.
v2:
- Patch 1: drop the pre-dissection virtio_net_hdr_match_proto() check
inside 'if (!skb->protocol)' so VLAN-tagged GSO frames without
NEEDS_CSUM are not rejected before flow dissection (Michael S. Tsirkin).
- Patch 1: clarify the changelog regarding why skb->network_header was 0
in those callers and why skb_reset_mac_header() is dropped in
tun_get_user() for IFF_TUN (Michael S. Tsirkin).
- Patch 2: add selftest in tools/testing/selftests/net/tun.c based on
Michael's reproducer.
- Link to v1: https://lore.kernel.org/netdev/20260927195536.2489079-1-edumazet@google.com/
Eric Dumazet (2):
net: always dissect GSO packets in __virtio_net_hdr_to_skb()
selftests: net: tun: add test for VLAN-tagged GSO without NEEDS_CSUM
arch/um/drivers/vector_transports.c | 1 +
drivers/net/tun.c | 23 +++---
drivers/net/virtio_net.c | 2 +
include/linux/virtio_net.h | 60 +++++++---------
tools/testing/selftests/net/tun.c | 107 ++++++++++++++++++++++++++++
5 files changed, 149 insertions(+), 44 deletions(-)
--
2.56.0.rc1.315.gc6ed9934b7-goog
next reply other threads:[~2026-09-28 14:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 14:42 Eric Dumazet [this message]
2026-09-28 14:42 ` [PATCH v2 net 1/2] net: always dissect GSO packets in __virtio_net_hdr_to_skb() Eric Dumazet
2026-10-01 17:52 ` netdev-bot+sashiko
2026-10-01 18:34 ` Eric Dumazet
2026-09-28 14:42 ` [PATCH v2 net 2/2] selftests: net: tun: add test for VLAN-tagged GSO without NEEDS_CSUM Eric Dumazet
2026-09-28 19:17 ` Willem de Bruijn
2026-09-28 19:43 ` Eric Dumazet
2026-09-28 20:22 ` Willem de Bruijn
2026-10-01 17:52 ` netdev-bot+sashiko
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=20260928144254.3361044-1-edumazet@kernel.org \
--to=edumazet@kernel.org \
--cc=davem@davemloft.net \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.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