Netdev List
 help / color / mirror / Atom feed
From: Philipp Sudakas <filzador@gmail.com>
To: ronak.doshi@broadcom.com, bcm-kernel-feedback-list@broadcom.com
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	sdf@fomichev.me, u9012063@gmail.com,
	Philipp Sudakas <filzador@gmail.com>
Subject: [PATCH net v2 0/5] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset
Date: Mon, 23 Nov 2026 15:48:50 +0300	[thread overview]
Message-ID: <20261123124855.1021-1-filzador@gmail.com> (raw)

Fixes for native XDP on vmxnet3. A single frame from any host on the
same L2 segment can crash a guest that has an XDP program attached;
any device reset silently stops XDP; and the attach error path leaves
the driver with a program it holds no reference to.

Patch 1: the rx data ring XDP path leaves rx_ctx.skb pointing at the
ring head page after a non-PASS verdict. Patch 4 relies on rx_ctx.skb
being NULL between frames.

Patch 2: vmxnet3_xdp_set() releases the old program before the device
is active again and does not roll back on failure. Keep the old
program on failure. Patch 5 removes the side effect that used to hide
this.

Patch 3: with an MTU between 3051 and VMXNET3_XDP_MAX_MTU, full-sized
frames do not fit the 3072-byte rx head buffer. Limit the XDP MTU so
that they do.

Patch 4: a frame that does not fit in one XDP rx buffer (sop without
eop) reaches the skb path, which takes the page_pool page for an skb:
kernel BUG in skb_put(). With MTU 1500, a single untagged frame of
1523..1526 bytes is enough. Drop such frames.

Patch 5: vmxnet3_rq_cleanup_all() clears xdp_bpf_prog on every quiesce
(MTU change, down/up, ring resize, reset). XDP stops being called while
the program is still reported as attached, and its reference leaks.

Reproduced with stock modules on Debian kernels 6.12.113, 6.12.117 and
7.2.12 (7.2.12 untainted), VMware virtual hardware version 20. A small
reproducer (raw frame sender and an XDP_PASS counter program) is
available on request.

Testing:
- Run-tested: the patched vmxnet3 files of net as of today, with the
  driver's current vmxnet3_ethtool.c and headers, built as a module for
  a Debian 7.2.12 kernel; VMware virtual hardware version 20, MTU 1500,
  native XDP:
  - untagged frames of 1514..1522 bytes reach XDP; 1523, 1524 and
    1526 bytes are dropped and counted in drop_total; 1530 bytes with
    a VLAN 0 tag are dropped; no crash;
  - 5000 frames of 1500 bytes mixed with 5000 of 1524 bytes: exactly
    5000 XDP passes and 5000 drops;
  - with XDP_DROP attached, small frames over the rx data ring
    (64 and 100 bytes) are dropped by XDP, followed by normal and
    oversized frames without issue;
  - after an MTU change, down/up and an rx ring resize the same
    program keeps running; after detach no program is left loaded;
  - MTU 3051 is refused with XDP attached and attaching at MTU 3051
    is refused; at MTU 3050 frames of 3064 bytes reach XDP and 3073
    bytes are dropped;
  - attach and detach failures were forced with a test-only module
    parameter that skips vmxnet3_rq_create_all() and returns -ENOMEM:
    after a failed attach no XDP program is attached or left loaded,
    and after down/up the stack receives again; after a failed detach
    the old program stays attached and runs again after down/up, and
    is freed after a later detach.
  No warnings in dmesg.
- Not covered: the rx_error paths (no way to make the virtual device
  report a receive error), and VLAN tags other than 0, which the test
  switch does not pass.

Changes in v2:
- New patch 1, and the rx_error double count fix in patch 4, after an
  automated review of v1 (Sashiko).
- New patch 2: v1 patch 2 made the attach failure path in
  vmxnet3_xdp_set() reachable with a stale program pointer.
- New patch 3: v1 left the MTU 3051..VMXNET3_XDP_MAX_MTU range as a
  known limit; it is now refused.
- Patch 4 no longer counts the dropped frame against the NAPI budget:
  in mainline other non-PASS XDP verdicts are not counted either, so
  the v1 comment claiming so was wrong.
- Patch 4: fixed a line over 80 columns.
- Cc the networking, XDP and BPF maintainers and the author of the
  blamed commit, as get_maintainer.pl lists them.
- v1: https://lore.kernel.org/netdev/20261122002847.616-1-filzador@gmail.com/

The problems were found and analysed, and the patches drafted, with
the help of an AI coding assistant; reproduction and testing were run
on the reporter's lab systems.

Philipp Sudakas (5):
  vmxnet3: clear rx_ctx.skb after a data ring XDP verdict
  vmxnet3: keep the previous XDP program when attaching fails
  vmxnet3: limit the XDP MTU to the rx head buffer size
  vmxnet3: drop XDP frames that do not fit in one rx buffer
  vmxnet3: keep the XDP program across device resets

 drivers/net/vmxnet3/vmxnet3_drv.c | 27 +++++++++++++++++++++++++--
 drivers/net/vmxnet3/vmxnet3_xdp.c | 22 +++++++++++++++++-----
 drivers/net/vmxnet3/vmxnet3_xdp.h | 10 ++++++++--
 3 files changed, 50 insertions(+), 9 deletions(-)

-- 
2.47.3


             reply	other threads:[~2026-11-23 12:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 12:48 Philipp Sudakas [this message]
2026-11-23 12:48 ` [PATCH net v2 1/5] vmxnet3: clear rx_ctx.skb after a data ring XDP verdict Philipp Sudakas
2026-11-23 12:48 ` [PATCH net v2 2/5] vmxnet3: keep the previous XDP program when attaching fails Philipp Sudakas
2026-11-23 12:48 ` [PATCH net v2 3/5] vmxnet3: limit the XDP MTU to the rx head buffer size Philipp Sudakas
2026-11-23 12:48 ` [PATCH net v2 4/5] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
2026-11-23 12:48 ` [PATCH net v2 5/5] vmxnet3: keep the XDP program across device resets Philipp Sudakas

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=20261123124855.1021-1-filzador@gmail.com \
    --to=filzador@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ronak.doshi@broadcom.com \
    --cc=sdf@fomichev.me \
    --cc=u9012063@gmail.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