From: netdev-bot+sashiko@kernel.org
To: maciej.fijalkowski@intel.com
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org,
pabeni@redhat.com, tushar.vyavahare@intel.com,
kerneljasonxing@gmail.com, bjorn@kernel.org
Subject: Re: [PATCH v3 net-next 12/15] selftests: xsk: pass non-test traffic to the stack in hardware mode
Date: Sat, 17 Oct 2026 03:06:10 +0000 [thread overview]
Message-ID: <179220637066.434549.1580492265406805082@kernel.org> (raw)
In-Reply-To: <20261014184539.774708-13-maciej.fijalkowski@intel.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In hardware mode, adjust_tail_grow_skip()
(tools/testing/selftests/net/lib/xsk/test_xsk.c) can make the two…
- [Low] This feature patch also carries the only fix for a real userspace
stack buffer overflow, without a Fixes: tag.
--
selftests: xsk: pass non-test traffic to the stack in hardware mode
In hardware mode, the xskxceiver XDP programs now redirect only the
UDP/IPv4 packets sent to the test port and pass everything else to the
stack. xsk_xdp_adjust_tail() now accounts for the IPv4 and UDP headers,
so the XDP_ADJUST_TAIL_GROW cases can run with --hw. is_adjust_tail_supported()
now reads adjust_value through the skeleton instead of copying all of
.bss into an int.
> diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.c b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> index a280956d53f4..b70dbefe9729 100644
> --- a/tools/testing/selftests/net/lib/xsk/test_xsk.c
> +++ b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> @@ -944,31 +944,12 @@ static bool is_metadata_correct(struct pkt *pkt, void *buffer, u64 addr)
> return true;
> }
>
> -static int is_adjust_tail_supported(struct xsk_xdp_progs *skel_rx, bool *supported)
> +static bool is_adjust_tail_supported(struct xsk_xdp_progs *skel_rx)
> {
> - struct bpf_map *data_map;
> - int adjust_value = 0;
> - int key = 0;
> - int ret;
> -
> - data_map = bpf_object__find_map_by_name(skel_rx->obj, "xsk_xdp_.bss");
> - if (!data_map || !bpf_map__is_internal(data_map)) {
> - ksft_print_msg("Error: could not find bss section of XDP program\n");
> - return -EINVAL;
> - }
> -
> - ret = bpf_map_lookup_elem(bpf_map__fd(data_map), &key, &adjust_value);
[Severity: Low]
The replacement below looks correct. Should this part go out as its own
fix with a Fixes: tag, though?
The removed bpf_map_lookup_elem() copies the whole value_size of the
internal "xsk_xdp_.bss" map into the 4-byte stack int adjust_value.
Before hw_port was added, .bss already held idx, adjust_value, count and
drop_idx. So the copy writes at least 12 bytes and overwrites nearby
stack slots such as key, ret and data_map.
The commit message mentions the overrun. However, the fix is bundled
with the hardware-mode feature and depends on the move to selftests/net.
The same code is still in tools/testing/selftests/bpf/prog_tests/test_xsk.c,
which test_progs runs in trees without this series.
A standalone patch carrying:
Fixes: 4b302092553c ("selftests/xsk: Add tail adjustment tests and support check")
would let the fix be backported to net and stable.
> - if (ret) {
[ ... ]
> + return skel_rx->bss->adjust_value != -EOPNOTSUPP;
> }
[ ... ]
> @@ -2774,10 +2754,20 @@ int testapp_adjust_tail_shrink_mb(struct test_spec *test)
> return testapp_adjust_tail(test, -XSK_UMEM__MAX_FRAME_SIZE, XSK_UMEM__LARGE_FRAME_SIZE * 2);
> }
>
> +/* Generic XDP leaves no room to grow the tail. Only the RX endpoint runs the
> + * program on the test flow, and a hardware TX endpoint, which does not know
> + * the mode of its peer, leaves that skip to the RX endpoint.
> + */
> +static bool adjust_tail_grow_skip(struct test_spec *test)
> +{
> + if (hw_test && !ifobj_is_local(test->ifobj_rx))
> + return false;
[Severity: Low]
Can the two hardware endpoints disagree on the skip here?
With --hw and a local RX endpoint in SKB mode, testapp_adjust_tail_grow()
and testapp_adjust_tail_grow_mb() return TEST_SKIP before
sync_endpoints() is reached. The RX side then closes the control
connection.
On the TX side, ifobj_rx is the non-local shadow. adjust_tail_grow_skip()
therefore always returns false, and TX continues:
testapp_adjust_tail()->worker_testapp_validate_tx()->sync_endpoints()
->xsk_peer_ready()
worker_testapp_validate_tx() {
...
err = sync_endpoints(test);
if (err)
return err;
...
}
xsk_peer_ready() in xsk_peer.c {
...
err = peer_send(peer, XSK_PEER_READY, 0);
while (!err && !peer->ready_seen)
err = peer_recv_one(peer);
...
}
There is no "peer skipped" message, so TX gets EPIPE or ECONNRESET.
The run ends with TX failing and RX skipping.
The old check (test->mode == TEST_MODE_SKB || hw_test) skipped on both
sides. That matches the existing convention in testapp_stats_rx_dropped():
/* Hardware endpoints run different modes, so ZC would skip on one only. */
if (hw_test)
return TEST_SKIP;
Later in the series, "selftests: drv-net: test AF_XDP zero-copy with an
SKB peer" adds drivers/net/hw/xsk.py. Its _test() reports the case as a
skip when either side returns SKIP_CODE:
if SKIP_CODE in (dut_ret, remote_ret):
raise KsftSkipEx("xskxceiver skipped the case")
Also, "selftests: xsk: list the hardware test cases" puts the grow cases
only in hw_rx_tests, where the SKB remote is the TX side.
At this commit, no in-tree runner drives --hw. Is the one-sided failure
the intended result for manual xskxceiver --hw runs?
> + return test->mode == TEST_MODE_SKB;
> +}
> +
> int testapp_adjust_tail_grow(struct test_spec *test)
> {
> - /* The XDP program numbers the grown tail after a non-UDP header. */
> - if (test->mode == TEST_MODE_SKB || hw_test)
> + if (adjust_tail_grow_skip(test))
> return TEST_SKIP;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261014184539.774708-1-maciej.fijalkowski%40intel.com
next prev parent reply other threads:[~2026-10-17 3:06 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 18:45 [PATCH v3 net-next 00/15] selftests: net: migrate AF_XDP test suite over to net Maciej Fijalkowski
2026-10-14 18:45 ` [PATCH v3 net-next 01/15] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-10-15 8:14 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 02/15] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-10-15 8:15 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 03/15] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-10-15 8:17 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 04/15] selftests/bpf: drop the test_progs AF_XDP wrapper Maciej Fijalkowski
2026-10-15 8:18 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 05/15] selftests: net: add a generic rule for BPF skeletons Maciej Fijalkowski
2026-10-15 8:20 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 06/15] selftests: xsk: move the AF_XDP test suite to selftests/net Maciej Fijalkowski
2026-10-15 8:22 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 07/15] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-10-15 8:27 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 08/15] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-10-15 8:29 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 09/15] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-10-15 8:34 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 10/15] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-10-15 9:04 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 11/15] selftests: xsk: add a hardware mode to xskxceiver Maciej Fijalkowski
2026-10-15 9:42 ` Björn Töpel
2026-10-15 10:55 ` Maciej Fijalkowski
2026-10-15 16:03 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 12/15] selftests: xsk: pass non-test traffic to the stack in hardware mode Maciej Fijalkowski
2026-10-15 10:05 ` Björn Töpel
2026-10-17 3:06 ` netdev-bot+sashiko [this message]
2026-10-14 18:45 ` [PATCH v3 net-next 13/15] selftests: xsk: list the hardware test cases Maciej Fijalkowski
2026-10-14 18:45 ` [PATCH v3 net-next 14/15] selftests: drv-net: test AF_XDP zero-copy with an SKB peer Maciej Fijalkowski
2026-10-15 10:29 ` Björn Töpel
2026-10-15 12:52 ` Maciej Fijalkowski
2026-10-17 3:06 ` netdev-bot+sashiko
2026-10-14 18:45 ` [PATCH v3 net-next 15/15] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
2026-10-17 3:06 ` netdev-bot+sashiko
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=179220637066.434549.1580492265406805082@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@gmail.com \
--cc=tushar.vyavahare@intel.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