[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZoWG3vNs5SW90wmp@krava>
Date: Wed, 3 Jul 2024 19:14:06 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCHv2 bpf-next 4/9] libbpf: Add support for uprobe multi
session attach
On Tue, Jul 02, 2024 at 02:34:34PM -0700, Andrii Nakryiko wrote:
> On Mon, Jul 1, 2024 at 9:42 AM Jiri Olsa <jolsa@...nel.org> wrote:
> >
> > Adding support to attach program in uprobe session mode
> > with bpf_program__attach_uprobe_multi function.
> >
> > Adding session bool to bpf_uprobe_multi_opts struct that allows
> > to load and attach the bpf program via uprobe session.
> > the attachment to create uprobe multi session.
> >
> > Also adding new program loader section that allows:
> > SEC("uprobe.session/bpf_fentry_test*")
> >
> > and loads/attaches uprobe program as uprobe session.
> >
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > ---
> > tools/lib/bpf/bpf.c | 1 +
> > tools/lib/bpf/libbpf.c | 50 ++++++++++++++++++++++++++++++++++++++++--
> > tools/lib/bpf/libbpf.h | 4 +++-
> > 3 files changed, 52 insertions(+), 3 deletions(-)
> >
>
> [...]
>
> > @@ -9362,6 +9363,7 @@ static const struct bpf_sec_def section_defs[] = {
> > SEC_DEF("kprobe.session+", KPROBE, BPF_TRACE_KPROBE_SESSION, SEC_NONE, attach_kprobe_session),
> > SEC_DEF("uprobe.multi+", KPROBE, BPF_TRACE_UPROBE_MULTI, SEC_NONE, attach_uprobe_multi),
> > SEC_DEF("uretprobe.multi+", KPROBE, BPF_TRACE_UPROBE_MULTI, SEC_NONE, attach_uprobe_multi),
> > + SEC_DEF("uprobe.session+", KPROBE, BPF_TRACE_UPROBE_SESSION, SEC_NONE, attach_uprobe_session),
>
> sleepable ones as well?
ah right, forgot.. will add
>
> > SEC_DEF("uprobe.multi.s+", KPROBE, BPF_TRACE_UPROBE_MULTI, SEC_SLEEPABLE, attach_uprobe_multi),
> > SEC_DEF("uretprobe.multi.s+", KPROBE, BPF_TRACE_UPROBE_MULTI, SEC_SLEEPABLE, attach_uprobe_multi),
> > SEC_DEF("ksyscall+", KPROBE, 0, SEC_NONE, attach_ksyscall),
> > @@ -11698,6 +11700,40 @@ static int attach_uprobe_multi(const struct bpf_program *prog, long cookie, stru
> > return ret;
> > }
> >
> > +static int attach_uprobe_session(const struct bpf_program *prog, long cookie, struct bpf_link **link)
> > +{
> > + char *binary_path = NULL, *func_name = NULL;
> > + LIBBPF_OPTS(bpf_uprobe_multi_opts, opts,
> > + .session = true,
> > + );
>
> nit: keep a single line?
ok
>
> > + int n, ret = -EINVAL;
> > + const char *spec;
> > +
> > + *link = NULL;
> > +
> > + spec = prog->sec_name + sizeof("uprobe.session/") - 1;
> > + n = sscanf(spec, "%m[^:]:%m[^\n]",
> > + &binary_path, &func_name);
>
> single line, wrapping lines is a necessary evil, please
ok
thanks,
jirka
Powered by blists - more mailing lists