From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Viktor Malik <vmalik@redhat.com>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Subject: Re: [PATCHv2 bpf-next 6/7] selftests/bpf: Add kprobe session test
Date: Wed, 1 May 2024 11:05:18 +0200 [thread overview]
Message-ID: <ZjIFzmmj_e1PzS5x@krava> (raw)
In-Reply-To: <CAEf4BzYiBDDEPjAbW+anv8uoAdwjyUrOAeFeEXKXSBj_0wOTqQ@mail.gmail.com>
On Tue, Apr 30, 2024 at 10:29:05AM -0700, Andrii Nakryiko wrote:
> On Tue, Apr 30, 2024 at 4:29 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding kprobe session test and testing that the entry program
> > return value controls execution of the return probe program.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/testing/selftests/bpf/bpf_kfuncs.h | 2 +
> > .../bpf/prog_tests/kprobe_multi_test.c | 39 ++++++++++
> > .../bpf/progs/kprobe_multi_session.c | 78 +++++++++++++++++++
> > 3 files changed, 119 insertions(+)
> > create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_session.c
> >
>
> Given the things I mentioned below were the only "problems" I found, I
> applied the patch and fixed those issues up while applying. Thanks a
> lot for working on this! Excited about this feature, it's been asked
> by our internal customers for a while as well. Looking forward to
> uprobe session program type!
great, I'll send it soon
>
> > diff --git a/tools/testing/selftests/bpf/bpf_kfuncs.h b/tools/testing/selftests/bpf/bpf_kfuncs.h
> > index 14ebe7d9e1a3..180030b5d828 100644
> > --- a/tools/testing/selftests/bpf/bpf_kfuncs.h
> > +++ b/tools/testing/selftests/bpf/bpf_kfuncs.h
> > @@ -75,4 +75,6 @@ extern void bpf_key_put(struct bpf_key *key) __ksym;
> > extern int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_ptr,
> > struct bpf_dynptr *sig_ptr,
> > struct bpf_key *trusted_keyring) __ksym;
> > +
> > +extern bool bpf_session_is_return(void) __ksym;
>
> should be __weak, always make it __weak. vmlinux.h with kfuncs is coming
>
> same for another kfunc in next patch
ok
>
> > #endif
>
> [...]
>
> > +static const void *kfuncs[8] = {
> > + &bpf_fentry_test1,
> > + &bpf_fentry_test2,
> > + &bpf_fentry_test3,
> > + &bpf_fentry_test4,
> > + &bpf_fentry_test5,
> > + &bpf_fentry_test6,
> > + &bpf_fentry_test7,
> > + &bpf_fentry_test8,
> > +};
> > +
>
> this is not supposed to work :) I don't think libbpf support this kind
> of relocations in data section.
aah, nice ;-) should we make it work (or make sure it works) ? seems useful
>
> The only reason it works in practice is because compiler completely
> inlines access to this array and so code just has unrolled loop
> (thanks to "static const" and -O2).
>
> This is a bit fragile, though. It might keep working, of course
> (though I'm not sure if -O1 would still work), but I'd feel a bit more
> comfortable if you define and initialize this array inside the
> function (then it will be guaranteed to work with libbpf logic)
thanks,
jirka
next prev parent reply other threads:[~2024-05-01 9:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 11:28 [PATCHv2 bpf-next 0/7] bpf: Introduce kprobe_multi session attach Jiri Olsa
2024-04-30 11:28 ` [PATCHv2 bpf-next 1/7] bpf: Add support for kprobe " Jiri Olsa
2024-04-30 11:28 ` [PATCHv2 bpf-next 2/7] bpf: Add support for kprobe session context Jiri Olsa
2024-04-30 11:28 ` [PATCHv2 bpf-next 3/7] bpf: Add support for kprobe session cookie Jiri Olsa
2024-04-30 11:28 ` [PATCHv2 bpf-next 4/7] libbpf: Add support for kprobe session attach Jiri Olsa
2024-05-01 18:30 ` Andrii Nakryiko
2024-05-01 19:32 ` Jiri Olsa
2024-04-30 11:28 ` [PATCHv2 bpf-next 5/7] libbpf: Add kprobe session attach type name to attach_type_name Jiri Olsa
2024-04-30 11:28 ` [PATCHv2 bpf-next 6/7] selftests/bpf: Add kprobe session test Jiri Olsa
2024-04-30 17:29 ` Andrii Nakryiko
2024-05-01 9:05 ` Jiri Olsa [this message]
2024-05-01 16:27 ` Andrii Nakryiko
2024-04-30 11:28 ` [PATCHv2 bpf-next 7/7] selftests/bpf: Add kprobe session cookie test Jiri Olsa
2024-04-30 17:30 ` [PATCHv2 bpf-next 0/7] bpf: Introduce kprobe_multi session attach patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZjIFzmmj_e1PzS5x@krava \
--to=olsajiri@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=mhiramat@kernel.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=vmalik@redhat.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox