On Sat, Nov 28, 2026 at 03:08:41PM +0000, netd…@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 4 potential > issue(s) to consider. > > Critical: 0 · High: 0 · Medium: 2 · Low: 2 > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwork > know by including "pw-bot: cr" as a separate line at the end of your reply > (one such reply per series is enough). > > - [Medium] drivers/net/xsk.py adds the entry (None, > "XDP_ADJUST_TAIL_SHRINK_MULTI_BUFF"): "trimmed frags leak" to… > - [Medium] tools/testing/selftests/net/lib/Makefile builds xskxceiver > only when `bpftool version` succeeds (HAS_BPFTOOL -> COND_GEN_FILES). > - [Low] The patch fixes a real bug in hugepages_present() > (tools/testing/selftests/net/lib/xsk/test_xsk.c). > - [Low] In the NIC run, _setup_nic() turns ntuple-filters on for both > hosts via set_ethtool_feat(..., {"ntuple-filters": True}). > > -- > > selftests: drv-net: run the AF_XDP tests over veth or a NIC > > This adds drivers/net/xsk.py, which runs each AF_XDP case as a pair of > xskxceiver endpoints. It runs them either over a veth pair, with the peer > in a namespace, or over NETIF, with an SKB-mode peer on the remote host. > NetDrvEpEnv gains a sw_drv argument so it can create a veth pair instead > of netdevsim, and the mmap() flags in hugepages_present() are fixed. >
> > diff --git a/tools/testing/selftests/drivers/net/xsk.py b/tools/testing/selftests/drivers/net/xsk.py > > new file mode 100755 > > index 0000000000000..ebde81fa5140b > > --- /dev/null > > +++ b/tools/testing/selftests/drivers/net/xsk.py > > @@ -0,0 +1,453 @@
> > [ ... ] >
> > + # bpf_xdp_adjust_tail() frees a frag that it trims off as the memory type > > + # of the XDP RX queue, which veth and generic XDP leave at > > + # MEM_TYPE_PAGE_SHARED for frames they copy into page_pool pages, so > > + # page_frag_free() frees a page that its pool still owns. The endpoints > > + # pass regardless, so running the case would only harm the kernel. > > + (None, "XDP_ADJUST_TAIL_SHRINK_MULTI_BUFF"): "trimmed frags leak",
> > [Severity: Medium] > The commit message describes VETH_XFAIL as "Cases that veth cannot pass > are expected failures". This comment says something else: the case > passes, but running it corrupts kernel memory. Should that kernel bug be > reported and fixed, rather than only recorded in a Python comment?
syzbot has reported it, and Slawomir's series [0] fixes it, generic XDP in patch 1 and veth in patch 4. The entry goes once that is in net-next. And the case does not pass. Its endpoints do, but a debug kernel reports "BUG: Bad page state ... page_pool leak".
> > The path in the comment looks real in the current tree. The XDP RX > queues are registered as shared pages, while veth copies frames into its > page_pool: > > veth_enable_xdp_range() > xdp_rxq_info_reg_mem_model(&rq->xdp_rxq, MEM_TYPE_PAGE_SHARED, NULL) > > veth_convert_skb_to_xdp_buff() > skb_pp_cow_data(rq->page_pool, ...) /* rxq mem stays PAGE_SHARED */ > > Generic XDP does the same through netif_skb_check_for_xdp() -> > skb_cow_data_for_xdp(system_page_pool), with the default PAGE_SHARED rxq. > > When a frag is trimmed away completely: > > bpf_xdp_frags_shrink_tail() > bpf_xdp_shrink_data() > __xdp_return(netmem, xdp->rxq->mem.type, false, zc_frag) > case MEM_TYPE_PAGE_SHARED: > page_frag_free(__netmem_address(netmem)) > > That drops a plain page reference on a page the page_pool still owns. > > The commit message doesn't mention this, and there is no Fixes: or Link: > tag, so the net/xdp and filter.c maintainers are unlikely to see it. > Could it go into the changelog, or be sent as a separate report or fix? > > The xfail reason "trimmed frags leak" also seems to say the opposite of > the comment above it: the page is freed too early, not leaked. Would a > reason like "trimmed frags freed under their page_pool" be more accurate?
"leak" is the kernel's own word for it, from that report, and [0] is "xdp: fix page_pool leaks". [0] https://lore.kernel.org/netdev/2026…@poczta.fm/
> > The baseline test_xsk.h already listed this case among its flaky tests, > so little coverage may be lost. The bug itself still goes unreported. > > [ ... ] >
> > + # Restore the table last, once ntuple-filters are off again, as turning > > + # them on or off can reset the NIC. > > + defer(_restore_rss, cfg, indir) > > + for ifname, host in ((cfg.ifname, None), (cfg.remote_ifname, cfg.remote)): > > + feat = ethtool(f"-k {ifname}", json=True, host=host)[0] > > + set_ethtool_feat(ifname, feat, {"ntuple-filters": True}, host=host) > > + try: > > + ethtool(f"-X {cfg.ifname} equal {queue}") > > + except CmdExitFailure as e: > > + raise KsftSkipEx(f"{cfg.ifname} cannot take queue {queue} " > > + "out of RSS") from e > > + _steer(cfg, queue, udp_port, ctrl_port)
>
> > +def main(): > > + """Run the cases over veth without NETIF, else on NETIF.""" > > + with NetDrvEpEnv(__file__, sw_drv="veth") as cfg: > > + cfg.bin_local = cfg.net_lib_dir / "xskxceiver" > > + cases = _get_cases(cfg)
> > [Severity: Medium] > What happens here if xskxceiver was not built? > > tools/testing/selftests/net/lib/Makefile builds it only when bpftool > works: > > HAS_BPFTOOL := $(shell $(BPFTOOL) version >/dev/null 2>&1 && echo y) > ifeq ($(HAS_BPFTOOL),y) > COND_GEN_FILES += xskxceiver > else > $(warning excluding xskxceiver, bpftool not installed or not working) > endif > > However, drivers/net/Makefile adds xsk.py to TEST_PROGS unconditionally. > > _get_cases() then runs cmd([str(cfg.bin_local), "-l"]). cmd() passes a > list argv to subprocess.Popen(), so a missing binary raises > FileNotFoundError rather than CmdExitFailure. This happens before > ksft_run(), so nothing turns it into a skip, and the script exits with > a traceback. > > Would it work to raise KsftSkipEx here when cfg.bin_local does not > exist? The test would then report a skip instead of a failure on builds > without a working bpftool.
No, ksft.py catches KsftSkipEx only inside ksft_run(), so that ends in a traceback too. And I'd rather a build without xskxceiver failed: make already warns about it, and a skip would hide it in CI. iou-zcrx.py does the same with iou-zcrx, which hw/Makefile builds only with liburing.