On Thu, Sep 7, 2023 at 12:14 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > > Adding selftest that puts kprobe.multi on bpf_fentry_test1 that > calls bpf_kfunc_common_test kfunc which has 3 perf event kprobes > and 1 kprobe.multi attached. > > Because fprobe (kprobe.multi attach layear) does not have strict > recursion check the kprobe's bpf_prog_active check is hit for test2-5. > > Disabling this test for arm64, because there's no fprobe support yet. > > Acked-by: Hou Tao <houtao1@xxxxxxxxxx> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> Reviewed-and-tested-by: Song Liu <song@xxxxxxxxxx> With on nitpick below. > --- > tools/testing/selftests/bpf/DENYLIST.aarch64 | 1 + > .../testing/selftests/bpf/prog_tests/missed.c | 51 +++++++++++++++++++ > .../bpf/progs/missed_kprobe_recursion.c | 48 +++++++++++++++++ > 3 files changed, 100 insertions(+) > create mode 100644 tools/testing/selftests/bpf/progs/missed_kprobe_recursion.c > > diff --git a/tools/testing/selftests/bpf/DENYLIST.aarch64 b/tools/testing/selftests/bpf/DENYLIST.aarch64 > index 7f768d335698..3f2187c049db 100644 > --- a/tools/testing/selftests/bpf/DENYLIST.aarch64 > +++ b/tools/testing/selftests/bpf/DENYLIST.aarch64 > @@ -15,3 +15,4 @@ fexit_test/fexit_many_args # fexit_many_args:FAIL:fexit_ma > fill_link_info/kprobe_multi_link_info # bpf_program__attach_kprobe_multi_opts unexpected error: -95 > fill_link_info/kretprobe_multi_link_info # bpf_program__attach_kprobe_multi_opts unexpected error: -95 > fill_link_info/kprobe_multi_invalid_ubuff # bpf_program__attach_kprobe_multi_opts unexpected error: -95 > +missed/kprobe_recursion # missed_kprobe_recursion__attach unexpected error: -95 (errno 95) > diff --git a/tools/testing/selftests/bpf/prog_tests/missed.c b/tools/testing/selftests/bpf/prog_tests/missed.c > index fc674258c81f..f10dc9232b3f 100644 > --- a/tools/testing/selftests/bpf/prog_tests/missed.c > +++ b/tools/testing/selftests/bpf/prog_tests/missed.c > @@ -1,6 +1,7 @@ > // SPDX-License-Identifier: GPL-2.0 > #include <test_progs.h> > #include "missed_kprobe.skel.h" > +#include "missed_kprobe_recursion.skel.h" > > /* > * Putting kprobe on bpf_fentry_test1 that calls bpf_kfunc_common_test > @@ -40,8 +41,58 @@ static void test_missed_perf_kprobe(void) > missed_kprobe__destroy(skel); > } > > +static __u64 get_count(int fd) nit: Probably rename it as get_missed_count() or get_missed(). > +{ > + struct bpf_prog_info info = {}; > + __u32 len = sizeof(info); > + int err; > + > + err = bpf_prog_get_info_by_fd(fd, &info, &len); > + if (!ASSERT_OK(err, "bpf_prog_get_info_by_fd")) > + return (__u64) -1; > + return info.recursion_misses; > +} [...]