On Fri, Dec 22, 2023 at 7:12 AM Dmitrii Dolgov <9erthalion6@xxxxxxxxx> wrote: > > Add a test case to verify the fix for "prog->aux->dst_trampoline and > tgt_prog is NULL" branch in bpf_tracing_prog_attach. The sequence of > events: > > 1. load rawtp program > 2. load fentry program with rawtp as target_fd > 3. create tracing link for fentry program with target_fd = 0 > 4. repeat 3 > > Acked-by: Jiri Olsa <olsajiri@xxxxxxxxx> > Signed-off-by: Dmitrii Dolgov <9erthalion6@xxxxxxxxx> > --- > Changes in v8: > - Cleanup, remove link opts and if condition around assert for the > expected error, unneeded parts of the test bpf prog and some > indendation improvements. > > .../bpf/prog_tests/recursive_attach.c | 45 +++++++++++++++++++ > .../bpf/progs/fentry_recursive_target.c | 10 +++++ > 2 files changed, 55 insertions(+) > > diff --git a/tools/testing/selftests/bpf/prog_tests/recursive_attach.c b/tools/testing/selftests/bpf/prog_tests/recursive_attach.c > index e9e576de6723..124c57e27387 100644 > --- a/tools/testing/selftests/bpf/prog_tests/recursive_attach.c > +++ b/tools/testing/selftests/bpf/prog_tests/recursive_attach.c > @@ -109,3 +109,48 @@ void test_recursive_fentry(void) > if (test__start_subtest("detach")) > test_recursive_fentry_chain(true, true); > } > + > +/* > + * Test that a tracing prog reattachment (when we land in > + * "prog->aux->dst_trampoline and tgt_prog is NULL" branch in > + * bpf_tracing_prog_attach) does not lead to a crash due to missing attach_btf > + */ Please update the comment style: /* Test that a tracing prog reattachment (when we land in * "prog->aux->dst_trampoline and tgt_prog is NULL" branch in * bpf_tracing_prog_attach) does not lead to a crash due to missing attach_btf */ Also for the other comments below. Thanks, Song