From: sashiko-bot@kernel.org
To: "Tushar Vyavahare" <tushar.vyavahare@intel.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 2/5] selftests/xsk: roll back partial socket setup on configure failures
Date: Sat, 08 Aug 2026 13:44:30 +0000 [thread overview]
Message-ID: <20260808134431.11EC01F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260807134209.3794735-3-tushar.vyavahare@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Eager rollback in xsk_configure() causes a guaranteed NULL pointer dereference in the parallel TX thread when the RX thread fails.
--
--- Patch [2]: [PATCH net-next 2/5] selftests/xsk: roll back partial socket setup on configure failures ---
commit 80baccb88ac5eb975506a8efbd37137e2c6775b1
Author: Tushar Vyavahare <tushar.vyavahare@intel.com>
selftests/xsk: roll back partial socket setup on configure failures
This commit introduces an eager rollback mechanism to clean up already
configured sockets if subsequent setups or busy-poll configurations fail
during xsk_configure().
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
[ ... ]
> @@ -1500,14 +1522,18 @@ static int xsk_configure(struct test_spec *test, struct ifobject *ifobject,
> break;
>
> /* Retry if it fails as xsk_socket__create() is asynchronous */
> - if (ctr >= SOCK_RECONF_CTR)
> + if (ctr >= SOCK_RECONF_CTR) {
> + xsk_configure_rollback(ifobject, i);
> return ret;
> + }
[Severity: Medium]
Could this new rollback cause a NULL pointer dereference in the parallel TX
thread when an RX thread setup fails?
When xsk_configure_rollback() cleans up the sockets on a failure, it calls
xsk_delete_socket_batch(), which in turn calls xsk_delete_socket(). That
function explicitly clears the umem pointer for the RX thread's sockets:
xsk_delete_socket() {
...
xsk->umem = NULL;
}
If the RX thread fails and exits, the main test thread does not check
test->fail before spawning the TX thread. The TX thread then executes
thread_common_ops_tx(), which unconditionally dereferences the now-NULL
umem pointer:
thread_common_ops_tx() {
...
if (!test->ifobj_rx || !test->ifobj_rx->xsk_arr[0].umem->umem) {
...
}
Does the main thread need to check for test failures before spawning the TX
thread, or should thread_common_ops_tx() verify xsk_arr[0].umem is valid
before dereferencing it?
> usleep(USLEEP_MAX);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807134209.3794735-1-tushar.vyavahare@intel.com?part=2
next prev parent reply other threads:[~2026-08-08 13:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 13:42 [PATCH net-next 0/5] selftests/xsk: improve shared-UMEM coverage and infrastructure Tushar Vyavahare
2026-08-07 13:42 ` [PATCH net-next 1/5] selftests/xsk: add UMEM users refcount and centralize socket teardown Tushar Vyavahare
2026-08-08 13:44 ` sashiko-bot
2026-08-12 2:42 ` bot+bpf-ci
2026-08-07 13:42 ` [PATCH net-next 2/5] selftests/xsk: roll back partial socket setup on configure failures Tushar Vyavahare
2026-08-08 13:44 ` sashiko-bot [this message]
2026-08-12 2:42 ` bot+bpf-ci
2026-08-07 13:42 ` [PATCH net-next 3/5] selftests/xsk: expand XSKMAP capacity and add length-based XDP program Tushar Vyavahare
2026-08-12 2:42 ` bot+bpf-ci
2026-08-07 13:42 ` [PATCH net-next 4/5] selftests/xsk: add shared-UMEM callback framework and initial test cases Tushar Vyavahare
2026-08-07 13:42 ` [PATCH net-next 5/5] selftests/xsk: make pkt_stream_even_odd_sequence rollback-safe Tushar Vyavahare
2026-08-12 2:28 ` bot+bpf-ci
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=20260808134431.11EC01F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.