]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
selftests/bpf: Fix double thread join in uprobe_multi_test
authorIhor Solodrai <ihor.solodrai@linux.dev>
Mon, 23 Feb 2026 19:07:30 +0000 (11:07 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Feb 2026 16:19:49 +0000 (08:19 -0800)
ASAN reported a "joining already joined thread" error. The
release_child() may be called multiple times for the same struct
child.

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

Also memset(0) static child variable in test_attach_api().

Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260223190736.649171-15-ihor.solodrai@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c

index 2ee17ef1dae28d931f42aa977646208be24b5fcd..56cbea280fbd21ef7f34973a35e28d65e0f2a095 100644 (file)
@@ -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)
@@ -331,6 +333,8 @@ test_attach_api(const char *binary, const char *pattern, struct bpf_uprobe_multi
 {
        static struct child child;
 
+       memset(&child, 0, sizeof(child));
+
        /* no pid filter */
        __test_attach_api(binary, pattern, opts, NULL);