On Tue, Mar 17, 2026 at 11:05:29AM +0800, Leon Hwang wrote:
SNIP
> > diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
> > b/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
> > index e9042d8d4760..b7818f438d6e 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
> > @@ -6,6 +6,7 @@
> > #include "bpf/libbpf_internal.h"
> > #include "tracing_multi.skel.h"
> > #include "tracing_multi_module.skel.h"
> > +#include "tracing_multi_intersect.skel.h"
> > #include "trace_helpers.h"
> >
> > static const char * const bpf_fentry_test[] = {
> > @@ -31,6 +32,20 @@ static const char * const bpf_testmod_fentry_test[] = {
> >
> > #define FUNCS_CNT (ARRAY_SIZE(bpf_fentry_test))
> >
> > +static int get_random_funcs(const char **funcs)
> > +{
> > + int i, cnt = 0;
> > +
> > + for (i = 0; i < FUNCS_CNT; i++) {
> > + if (rand() % 2)
> ^ srand() is missing for rand() ?
it's in test_progs main
> > +static void test_intersect(void)
> > +{
> > + struct tracing_multi_intersect *skel;
> > + const struct bpf_program *progs[4];
> > + __u64 *test_results[4];
> > + __u32 i;
> > +
> > + skel = tracing_multi_intersect__open_and_load();
> > + if (!ASSERT_OK_PTR(skel, "tracing_multi_intersect__open_and_load"))
> > + return;
> > +
> > + skel->bss->pid = getpid();
> > +
> > + progs[0] = skel->progs.fentry_1;
> > + progs[1] = skel->progs.fexit_1;
> > + progs[2] = skel->progs.fentry_2;
> > + progs[3] = skel->progs.fexit_2;
> > +
> > + test_results[0] = &skel->bss->test_result_fentry_1;
> > + test_results[1] = &skel->bss->test_result_fexit_1;
> > + test_results[2] = &skel->bss->test_result_fentry_2;
> > + test_results[3] = &skel->bss->test_result_fexit_2;
> > +
> > + for (i = 1; i < 16; i++)
> > + __test_intersect(i, progs, test_results);
> > +
> > + tracing_multi_intersect__destroy(skel);
> > +}
> > +
> > void test_tracing_multi_test(void)
> > {
> > #ifndef __x86_64__
> > @@ -347,4 +444,6 @@ void test_tracing_multi_test(void)
> > test_module_link_api_pattern();
> > if (test__start_subtest("module_link_api_ids"))
> > test_module_link_api_ids();
> > + if (test__start_subtest("intersect"))
> > + test_intersect();
> > }
> > diff --git
> > a/tools/testing/selftests/bpf/progs/tracing_multi_intersect_attach.c
> > b/tools/testing/selftests/bpf/progs/tracing_multi_intersect_attach.c
> > new file mode 100644
> > index 000000000000..b8aecbf44093
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/tracing_multi_intersect_attach.c
> > @@ -0,0 +1,42 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <stdbool.h>
> > +#include <linux/bpf.h>
> NIT: ^ vmlinux.h is better than stdbool.h + bpf.h.
ok, thanks
jirka