RE: [PATCH 1/5] selftests/xsk: Introduce helpers for setting UMEM properties

Vyavahare, Tushar
2026-04-28T12:39:44Z

Somehow, I messed up my patch set while sending it.
I have a v2 that includes this fix. I'll wait a couple of days for any
additional review comments, and then I'll send out v2.

-Tushar
> -----Original Message-----
> From: bot+bpf-ci@kernel.org <bot+bpf-ci@kernel.org>
> Sent: Tuesday, April 28, 2026 3:58 PM
> To: Vyavahare, Tushar <tushar.vyavahare@intel.com>;
> netdev@vger.kernel.org; Karlsson, Magnus <magnus.karlsson@intel.com>;
> Fijalkowski, Maciej <maciej.fijalkowski@intel.com>; stfomichev@gmail.com;
> kernelxing@tencent.com; davem@davemloft.net; kuba@kernel.org;
> pabeni@redhat.com; ast@kernel.org; daniel@iogearbox.net; Sarkar,
> Tirthendu <tirthendu.sarkar@intel.com>; Vyavahare, Tushar
> <tushar.vyavahare@intel.com>
> Cc: bpf@vger.kernel.org; ast@kernel.org; andrii@kernel.org;
> daniel@iogearbox.net; martin.lau@kernel.org; eddyz87@gmail.com;
> yonghong.song@linux.dev; clm@meta.com; ihor.solodrai@linux.dev
> Subject: Re: [PATCH 1/5] selftests/xsk: Introduce helpers for setting UMEM
> properties
>
> > diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > index 7950c504ed28..d5cd8f590b25 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > @@ -303,6 +303,22 @@ static void test_spec_reset(struct test_spec *test)
> > __test_spec_init(test, test->ifobj_tx, test->ifobj_rx); }
> >
> > +static void test_spec_set_unaligned(struct test_spec *test) {
> > + test_spec_set_unaligned(test);
> > +}
>
> Does this function recurse unconditionally? Looking at the functions this
> helper replaces, the body should set unaligned_mode = true on both ifobj_tx-
> >umem and ifobj_rx->umem. Instead, every call to
> test_spec_set_unaligned() recurses into itself with the same argument until
> the stack is exhausted.
>
> Five tests introduced in this commit call the broken helper:
>
> testapp_send_receive_unaligned()
> testapp_send_receive_unaligned_mb()
> testapp_unaligned_inv_desc()
> testapp_unaligned_inv_desc_4001_frame()
> testapp_unaligned_inv_desc_mb()
>
> Each previously worked by directly setting the unaligned_mode fields.
> After this patch, those direct assignments are replaced with calls to
> test_spec_set_unaligned(), which crashes via stack overflow instead of
> running the test.
>
> > +
> > +static void test_spec_set_frame_size(struct test_spec *test, u32
> > +size) {
> > + test->ifobj_tx->umem->frame_size = size;
> > + test->ifobj_rx->umem->frame_size = size; }
> > +
> > +static void test_spec_set_frame_headroom(struct test_spec *test, u32
> > +size) {
> > + test->ifobj_rx->umem->frame_headroom = size; }
> > +
>
> [ ... ]
>
> > @@ -2025,8 +2041,7 @@ int testapp_stats_fill_empty(struct test_spec
> > *test)
> >
> > int testapp_send_receive_unaligned(struct test_spec *test) {
> > - test->ifobj_tx->umem->unaligned_mode = true;
> > - test->ifobj_rx->umem->unaligned_mode = true;
> > + test_spec_set_unaligned(test);
> > /* Let half of the packets straddle a 4K buffer boundary */
> > if (pkt_stream_replace_half(test, MIN_PKT_SIZE, -MIN_PKT_SIZE / 2))
> > return TEST_FAILURE;
> > @@ -2037,8 +2052,7 @@ int testapp_send_receive_unaligned(struct
> > test_spec *test) int testapp_send_receive_unaligned_mb(struct
> > test_spec *test) {
> > test->mtu = MAX_ETH_JUMBO_SIZE;
> > - test->ifobj_tx->umem->unaligned_mode = true;
> > - test->ifobj_rx->umem->unaligned_mode = true;
> > + test_spec_set_unaligned(test);
> > if (pkt_stream_replace(test, DEFAULT_PKT_CNT,
> MAX_ETH_JUMBO_SIZE))
> > return TEST_FAILURE;
> > return testapp_validate_traffic(test);
>
> [ ... ]
>
> > @@ -2380,10 +2391,8 @@ int
> testapp_unaligned_inv_desc_4001_frame(struct test_spec *test)
> > u64 page_size, umem_size;
> >
> > /* Odd frame size so the UMEM doesn't end near a page boundary. */
> > - test->ifobj_tx->umem->frame_size = 4001;
> > - test->ifobj_rx->umem->frame_size = 4001;
> > - test->ifobj_tx->umem->unaligned_mode = true;
> > - test->ifobj_rx->umem->unaligned_mode = true;
> > + test_spec_set_frame_size(test, 4001);
> > + test_spec_set_unaligned(test);
> > /* This test exists to test descriptors that staddle the end of
> > * the UMEM but not a page.
> > */
>
> [ ... ]
>
> > @@ -2411,8 +2422,7 @@ int testapp_aligned_inv_desc_mb(struct
> test_spec
> > *test)
> >
> > int testapp_unaligned_inv_desc_mb(struct test_spec *test) {
> > - test->ifobj_tx->umem->unaligned_mode = true;
> > - test->ifobj_rx->umem->unaligned_mode = true;
> > + test_spec_set_unaligned(test);
> > return testapp_invalid_desc_mb(test); }
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-
> patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-
> patches/bpf/actions/runs/25045852068