On 11/30/26 4:05 AM, Daniel Machon wrote:
Hi Mingming
Two independent bugs in ibmveth that exist on today's kernels.
1. After ethtool -L shrinks the TX queues, a sender that already
picked a removed queue (AF_PACKET PACKET_QDISC_BYPASS, pktgen)
can memcpy into a NULL long-term buffer. Drop that packet, and
stop TX with netif_tx_disable() so a sender already in xmit is
done before ethtool -L allocates or frees a buffer.
2. ibmveth_reset() closes and reopens the device without checking
whether the admin already set it down, and can bring it back up.
Skip the reopen if the device is not running.
Both came up during review of the v8 multi-queue series [1]: patch 1
on v8 06/15, patch 2 while splitting that series. Neither was
reproduced; the fixes are based on analysis of the code paths, and
each commit message says so. They carry Fixes: tags, but the
triggers are narrow and the second multi-queue series builds on them,
so please take them through net-next. The first multi-queue series,
posted separately, does not depend on them.
Tested: on a PowerVM LPAR: ethtool -L TX shrink under traffic,
ifdown/up under iperf3, and a queued reset while the admin has set
the device down. v2 on QEMU pseries only: TX shrink and restore under
UDP traffic, MTU change, open/close churn.
1/2 was pretty easy to reproduce in QEMU:
BUG: Kernel NULL pointer dereference on write at 0x00000000
NIP [c00000000009dac0] memcpy_power7+0x40/0x7d0
LR [c00800000079104c] ibmveth_start_xmit+0xd4/0x550 [ibmveth]
Call Trace:
pktgen_xmit+0x144/0x1490 [pktgen]
pktgen_thread_worker+0x12c/0xaa8 [pktgen]
kthread+0x124/0x130
With the series applied, the splat is gone.
Nit: in 1/2, the same buffer is called "ptr" in ibmveth_allocate_tx_ltb()
and "ltb" in ibmveth_start_xmit().
Hi Daniel,
Thanks for the review, and for reproducing 1/2 on QEMU. We only had the
code analysis for it, so the pktgen splat in |ibmveth_start_xmit()|
confirms the bug. It is also good to know the series fixes it.
You're right about the nit: |ibmveth_allocate_tx_ltb()| calls the buffer
|ptr| and |ibmveth_start_xmit()| calls it |ltb|. Part 1 is already
merged into net-next, so I won't send a separate patch for it. Series 2
only calls that function and doesn't change it. I'll add the rename to
the series 2 patch that sits next to it if that looks fine to the
reviewers, and otherwise leave it.
I'll also add your pktgen reproducer to my QEMU testing.
Changes in v2:
- 1/2: wake the TX queues under netif_tx_lock_bh(), and map a new
long-term buffer before publishing its pointer (Sashiko)
- 2/2: say the bug was found during review and was not reproduced
v1: https://lore.kernel.org/netdev/[email protected]/
[1] https://lore.kernel.org/netdev/[email protected]/
Reviewed-by: Daniel Machon <[email protected]>
Thanks again,
Mingming