On Fri, Apr 15, 2022 at 9:30 PM Kui-Feng Lee <kuifeng@xxxxxx> wrote: > > Make sure BPF cookies are correct for fentry/fexit/fmod_ret. > > Signed-off-by: Kui-Feng Lee <kuifeng@xxxxxx> > --- > .../selftests/bpf/prog_tests/bpf_cookie.c | 53 +++++++++++++++++++ > .../selftests/bpf/progs/test_bpf_cookie.c | 40 +++++++++++--- > 2 files changed, 85 insertions(+), 8 deletions(-) > [...] > -static void update(void *ctx, int *res) > +static void update(void *ctx, __u64 *res) > { > if (my_tid != (u32)bpf_get_current_pid_tgid()) > return; > @@ -82,4 +85,25 @@ int handle_pe(struct pt_regs *ctx) > return 0; > } > > +SEC("fentry/bpf_fentry_test1") > +int BPF_PROG(fentry_test1, int a) > +{ > + update(ctx, &fentry_res); > + return 0; > +} > + > +SEC("fexit/bpf_fentry_test1") > +int BPF_PROG(fexit_test1, int a, int ret) > +{ > + update(ctx, &fexit_res); > + return 0; > +} > + > +SEC("fmod_ret/bpf_modify_return_test") > +int BPF_PROG(fmod_ret_test, int _a, int *_b, int _ret) > +{ > + update(ctx, &fmod_ret_res); > + return 1234; > +} > + > char _license[] SEC("license") = "GPL"; would be great to add LSM and freplace (BPF_PROG_TYPE_EXT) tests as well > -- > 2.30.2 >