* [PATCH net 0/2] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset
@ 2026-11-22 0:28 Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 1/2] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 2/2] vmxnet3: keep the XDP program across device resets Philipp Sudakas
0 siblings, 2 replies; 3+ messages in thread
From: Philipp Sudakas @ 2026-11-22 0:28 UTC (permalink / raw)
To: Ronak Doshi, Broadcom internal kernel review list; +Cc: netdev, Philipp Sudakas
Two bugs in native XDP mode of vmxnet3. The first lets a single frame
from any host on the same L2 segment crash the guest; the second makes
the driver silently stop running XDP after any device reset and leaks
the program reference.
Patch 1: 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 and an XDP program attached, a
single untagged frame of 1523..1526 bytes is enough.
Patch 2: 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 it is never released.
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. Both
code paths are unchanged in mainline as of e572847ee4d0. A small
reproducer (raw frame sender and an XDP_PASS counter program) is
available on request.
Testing:
- The same changes, backported to 6.12.113, were tested on the same
setup: frames of MTU + 23 and MTU + 30 (VLAN tagged) are dropped and
counted in drop_total at MTU 1400 and 1500; frames up to MTU + 22
still reach XDP; after an MTU change, down/up and an rx ring resize
the same program keeps running; MTU 9000 is refused while XDP is
attached; after detach the program is freed. A stream of 5000
oversized frames mixed with 5000 normal ones gave exactly 5000 XDP
passes and 5000 drops, with no kernel warnings. That test module also
carried a separate change to NAPI budget accounting for non-PASS XDP
verdicts, which will be sent on its own.
- On mainline the patches apply to e572847ee4d0 and vmxnet3_drv.c
builds with W=1 without warnings; they were not run-tested on a
mainline kernel.
Known limit not addressed here: with an MTU between about 3051 and
VMXNET3_XDP_MAX_MTU, normal frames already need more than one buffer,
and with this series they are dropped instead of crashing.
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.
REPORTER NAME (2):
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 | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net 1/2] vmxnet3: drop XDP frames that do not fit in one rx buffer
2026-11-22 0:28 [PATCH net 0/2] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset Philipp Sudakas
@ 2026-11-22 0:28 ` Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 2/2] vmxnet3: keep the XDP program across device resets Philipp Sudakas
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Sudakas @ 2026-11-22 0:28 UTC (permalink / raw)
To: Ronak Doshi, Broadcom internal kernel review list; +Cc: netdev, Philipp Sudakas
With XDP enabled, rx ring 0 buffers are page_pool pages and the device
is given a buffer length of MTU + 22 (skb_buf_size). The device still
accepts somewhat longer frames (observed: up to MTU + 26 untagged,
MTU + 30 with a VLAN tag) and splits them over two descriptors.
vmxnet3_rq_rx_complete() runs XDP only for completions with both sop
and eop set. A frame with sop but without eop falls through to the skb
path, which uses rbi->skb although, for a VMXNET3_RX_BUF_XDP buffer,
that union member holds the page. The result is a kernel BUG in
skb_put(), or at BUG_ON(ctx->skb != NULL || rbi->skb == NULL):
kernel BUG at net/core/skbuff.c:2637!
RIP: 0010:skb_put+0x3c/0x40
Call Trace:
<IRQ>
vmxnet3_rq_rx_complete+0x893/0x12b0 [vmxnet3]
vmxnet3_poll_rx_only+0x38/0xd0 [vmxnet3]
__napi_poll+0x2b/0x160
net_rx_action+0x336/0x420
One frame of MTU + 23 to MTU + 26 bytes from any host on the same L2
segment is enough to crash a guest that has a native XDP program
attached to a vmxnet3 interface.
XDP on vmxnet3 is single-buffer, so drop such frames: count them in
drop_total, reuse the head buffer and skip the body buffers, as the
existing allocation failure path does. Count the dropped frame against
the NAPI budget. The completions of one frame may span two polls, so
start each poll with skip_page_frags set when no frame is in progress
(rx_ctx.skb == NULL): a body buffer without a head can only belong to a
dropped frame.
The problem was found and analysed, and this patch drafted, with the
help of an AI coding assistant. It was reproduced and tested on the
reporter's lab systems as described in the cover letter.
Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.")
Signed-off-by: Philipp Sudakas <filzador@gmail.com>
---
drivers/net/vmxnet3/vmxnet3_drv.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index f8df83f..fb98eb7 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1614,7 +1614,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
adapter->rx_prod_offset, adapter->rx_prod2_offset
};
u32 num_pkts = 0;
- bool skip_page_frags = false;
+ /* A frame dropped at its head may continue in the next poll. */
+ bool skip_page_frags = !rq->rx_ctx.skb;
bool encap_lro = false;
struct Vmxnet3_RxCompDesc *rcd;
struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;
@@ -1666,6 +1667,21 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
goto rcd_done;
}
+ if (rcd->sop && !rcd->eop &&
+ rbi->buf_type == VMXNET3_RX_BUF_XDP &&
+ !VMXNET3_RX_DATA_RING(adapter, rcd->rqID)) {
+ /* The frame did not fit one XDP buffer. XDP here is
+ * single-buffer and the head holds a page, not an skb:
+ * drop the frame, reuse the head, skip its body buffers.
+ * Count it against the budget like other XDP verdicts.
+ */
+ rq->stats.drop_total++;
+ ctx->skb = NULL;
+ skip_page_frags = true;
+ num_pkts++;
+ goto rcd_done;
+ }
+
if (rcd->sop && rcd->eop && vmxnet3_xdp_enabled(adapter)) {
struct sk_buff *skb_xdp_pass;
int act;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH net 2/2] vmxnet3: keep the XDP program across device resets
2026-11-22 0:28 [PATCH net 0/2] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 1/2] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
@ 2026-11-22 0:28 ` Philipp Sudakas
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Sudakas @ 2026-11-22 0:28 UTC (permalink / raw)
To: Ronak Doshi, Broadcom internal kernel review list; +Cc: netdev, Philipp Sudakas
vmxnet3_rq_cleanup_all() clears adapter->xdp_bpf_prog. It is called
from vmxnet3_quiesce_dev(), so on every MTU change, down/up, ring
resize, reset work and resume. After that the driver no longer runs
XDP, while the core still reports the program as attached, and the
driver's reference to the program is never dropped: a later detach
finds xdp_bpf_prog already NULL and returns early.
Seen on 6.12.117 and 7.2.12: after "ip link set dev X mtu 1400",
"ip link set dev X down; ip link set dev X up" or
"ethtool -G X rx 512", the attached program is no longer called, and
each detached program stays loaded.
Do not clear the pointer there. The program is exchanged and released
by vmxnet3_xdp_set(), which also runs when the device is unregistered.
Rx rings are then recreated in XDP mode after a reset, as
vmxnet3_xdp_enabled() stays true.
Since the program now survives an MTU change, reject an MTU above
VMXNET3_XDP_MAX_MTU while XDP is attached, as vmxnet3_xdp_set()
already refuses to attach a program at such an MTU.
The problem was found and analysed, and this patch drafted, with the
help of an AI coding assistant. It was reproduced and tested on the
reporter's lab systems as described in the cover letter.
Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.")
Signed-off-by: Philipp Sudakas <filzador@gmail.com>
---
drivers/net/vmxnet3/vmxnet3_drv.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index fb98eb7..e84bf11 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -2104,7 +2104,6 @@ vmxnet3_rq_cleanup_all(struct vmxnet3_adapter *adapter)
for (i = 0; i < adapter->num_rx_queues; i++)
vmxnet3_rq_cleanup(&adapter->rx_queue[i], adapter);
- rcu_assign_pointer(adapter->xdp_bpf_prog, NULL);
}
@@ -3663,6 +3662,11 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
int err = 0;
+ if (vmxnet3_xdp_enabled(adapter) && new_mtu > VMXNET3_XDP_MAX_MTU) {
+ netdev_err(netdev, "MTU %d too large for XDP\n", new_mtu);
+ return -EINVAL;
+ }
+
/*
* Reset_work may be in the middle of resetting the device, wait for its
* completion.
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-22 0:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 0:28 [PATCH net 0/2] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 1/2] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 2/2] vmxnet3: keep the XDP program across device resets Philipp Sudakas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox