[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b13f0f29e5f3308b5b2d973237634a7a7ec7c7be034227a633d6e49ed9f657cd@mail.kernel.org>
Date: Wed, 29 Oct 2025 14:25:50 +0000 (UTC)
From: bot+bpf-ci@...nel.org
To: bastien.curutchet@...tlin.com,bjorn@...nel.org,magnus.karlsson@...el.com,maciej.fijalkowski@...el.com,jonathan.lemon@...il.com,ast@...nel.org,daniel@...earbox.net,andrii@...nel.org,martin.lau@...ux.dev,eddyz87@...il.com,song@...nel.org,yonghong.song@...ux.dev,john.fastabend@...il.com,kpsingh@...nel.org,sdf@...ichev.me,haoluo@...gle.com,jolsa@...nel.org,mykolal@...com,shuah@...nel.org,davem@...emloft.net,kuba@...nel.org,hawk@...nel.org
Cc: thomas.petazzoni@...tlin.com,alexis.lothore@...tlin.com,netdev@...r.kernel.org,bpf@...r.kernel.org,linux-kselftest@...r.kernel.org,linux-kernel@...r.kernel.org,bastien.curutchet@...tlin.com,ast@...nel.org,andrii@...nel.org,daniel@...earbox.net,martin.lau@...nel.org,eddyz87@...il.com,yonghong.song@...ux.dev,clm@...a.com,ihor.solodrai@...ux.dev
Subject: Re: [PATCH bpf-next v6 12/15] selftests/bpf: test_xsk: Don't exit immediately if validate_traffic fails
```
commit 5ed620bf5df1b2a38af461580d5207eadf5c552e
Author: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@...tlin.com>
selftests/bpf: test_xsk: Don't exit immediately if validate_traffic fails
This changes __testapp_validate_traffic() to return TEST_FAILURE instead
of calling exit_with_error(), and adds cleanup for sockets and umem
before returning on pthread_barrier_destroy() failure.
> diff --git a/tools/testing/selftests/bpf/test_xsk.c b/tools/testing/selftests/bpf/test_xsk.c
> index 2c392d5b9..18a6ce648 100644
> --- a/tools/testing/selftests/bpf/test_xsk.c
> +++ b/tools/testing/selftests/bpf/test_xsk.c
> @@ -1772,12 +1772,12 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i
> err = test_spec_set_mtu(test, test->mtu);
> if (err) {
> ksft_print_msg("Error, could not set mtu.\n");
> - exit_with_error(err);
> + return TEST_FAILURE;
> }
>
> if (ifobj2) {
> if (pthread_barrier_init(&barr, NULL, 2))
> - exit_with_error(errno);
> + return TEST_FAILURE;
> pkt_stream_reset(ifobj2->xsk->pkt_stream);
> }
>
[ ... ]
> @@ -1791,8 +1791,11 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i
>
> if (ifobj2) {
> pthread_barrier_wait(&barr);
> - if (pthread_barrier_destroy(&barr))
> - exit_with_error(errno);
> + if (pthread_barrier_destroy(&barr)) {
> + clean_sockets(test, ifobj1);
> + clean_umem(test, ifobj1, NULL);
> + return TEST_FAILURE;
> + }
>
> /*Spawn TX thread */
> pthread_create(&t1, NULL, ifobj2->func_ptr, test);
In __testapp_validate_traffic(), thread t0 is created via pthread_create()
before the barrier operations. If pthread_barrier_destroy() fails, can this
leak thread t0?
The pthread_create(&t0, ...) happens earlier in the function. The normal
execution paths handle t0 via pthread_kill() or pthread_join(), but when
pthread_barrier_destroy() fails, the new error path calls clean_sockets()
and clean_umem() but never joins or kills t0 before returning TEST_FAILURE.
The commit message says "Release the resource of the 1st thread if a
failure happens between its creation and the creation of the second
thread", but the code only releases sockets and umem.
```
---
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
In-Reply-To-Subject: `selftests/bpf: test_xsk: Don't exit immediately if validate_traffic fails`
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/18910697393
Powered by blists - more mailing lists