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 v3 0/5] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset
Date: Wed, 25 Nov 2026 10:52:50 +0300 [thread overview]
Message-ID: <20261125075255.1517-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 a failure while switching XDP
on or off leaves a stale program pointer and a half torn-down device.
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: when vmxnet3_xdp_set() fails to recreate the rx queues or to
reactivate the device, it neither rolls back the program exchange nor
restarts or closes the device. A failed attach now brings the device
back up without XDP and returns the error; a failed detach is
completed, so the driver and the core agree; if the device cannot be
restarted, the interface is closed. Patch 5 removes the side effect
that used to hide the stale pointer.
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. This also fixes an older
cross-poll BUG_ON on the non-XDP path; see the commit message.
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 (v3):
- 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; no crash
(v2 also: 1530 bytes with a VLAN 0 tag are dropped);
- 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;
- replacing a running program: the new one runs, the old one is
freed;
- failures were forced with a test-only module parameter that makes
the next N vmxnet3_rq_create_all() calls in vmxnet3_xdp_set() fail
with -ENOMEM:
- attach, 1 failure: the error is returned, no XDP program is
attached or left loaded, the interface stays up and receives,
and a new attach works;
- attach, 2 failures (recovery fails too): the error is returned,
no program, the interface is down; after "ip link set up" it
receives;
- detach, 1 failure: 0 is returned, no program is attached or left
loaded, the interface is down; after "ip link set up" it
receives;
- attach while the interface is down does not reconfigure the
device and is not affected.
No warnings in dmesg. (An intermediate version that used
vmxnet3_force_close() on failure triggered "Trying to free
already-free IRQ", hence dev_close() in patch 2.)
- Not covered: the rx_error paths, failures inside
vmxnet3_activate_dev() itself (only the queue creation failure was
forced), and VLAN tags other than 0, which the test switch does not
pass.
Changes in v3:
- Patch 2 reworked after automated review of v2 (Sashiko): on a failed
attach restart the device without XDP, complete a failed detach
instead of restoring the old program (dev_xdp_detach_link() ignores
the error), close the interface if the device cannot be restarted,
return the real error, change the redirect target feature only once
the change is done (also when the interface is down), and use
rtnl_dereference(). It does not wait for VMXNET3_STATE_BIT_RESETTING
under RTNL, which could deadlock against vmxnet3_reset_work(). New
subject.
- Patch 4: count the two body buffer allocation failures in
drop_total, so that skipping rx_error for a dropped frame never
loses a count; the commit message now says that the non-XDP path
changes too, and that the drop is not counted against the NAPI
budget, like other non-PASS XDP verdicts.
- Patch 3: fixed a line over 80 columns.
- v2: https://lore.kernel.org/netdev/20261123124855.1021-1-filzador@gmail.com/
Changes in v2:
- New patches 1, 2 and 3, the rx_error double count fix in patch 4, and
no NAPI budget accounting for the dropped frame in patch 4.
- 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: fix the error path of XDP program setup
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 | 31 +++++++++++-
drivers/net/vmxnet3/vmxnet3_xdp.c | 84 +++++++++++++++++++++----------
drivers/net/vmxnet3/vmxnet3_xdp.h | 10 +++-
3 files changed, 95 insertions(+), 30 deletions(-)
--
2.47.3
next reply other threads:[~2026-11-25 7:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 7:52 Philipp Sudakas [this message]
2026-11-25 7:52 ` [PATCH net v3 1/5] vmxnet3: clear rx_ctx.skb after a data ring XDP verdict Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 2/5] vmxnet3: fix the error path of XDP program setup Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 3/5] vmxnet3: limit the XDP MTU to the rx head buffer size Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 4/5] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
2026-11-25 7:52 ` [PATCH net v3 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=20261125075255.1517-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