Re: [PATCH bpf-next v1 09/14] selftests/bpf: Fix double thread join in uprobe_multi_test

From: Mykyta Yatsenko

Date: Thu Feb 12 2026 - 09:52:47 EST


On 2/12/26 01:13, Ihor Solodrai wrote:
ASAN reported a "joining already joined thread" error. The
release_child() may be called multiple times for the same struct
child.

Fix by setting child->thread to 0 after pthread_join.

Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
index 2ee17ef1dae2..17881e009eee 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
@@ -62,8 +62,10 @@ static void release_child(struct child *child)
return;
close(child->go[1]);
close(child->go[0]);
- if (child->thread)
+ if (child->thread) {
pthread_join(child->thread, NULL);
+ child->thread = 0;
+ }
close(child->c2p[0]);
close(child->c2p[1]);
if (child->pid > 0)
As far as I understand the problem is due to `static struct child child` in
the test_attach_api(), once we initialize thread field of the child
it's not reset before the next test run.
Maybe we should also add memset(&child, 0, sizeof(child));
in test_attach_api() before each test to make sure all fields are reset.

Acked-by: Mykyta Yatsenko <yatsenko@xxxxxxxx>