From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
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>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCHv3 2/7] bpf: Add support for uprobe multi session attach
Date: Tue, 10 Sep 2024 09:17:20 +0200 [thread overview]
Message-ID: <Zt_ygFPEdX53rqaW@krava> (raw)
In-Reply-To: <CAEf4BzZ0+4Hd1xESWgE2WhSsNEuNuxtTju+OQeGiY0_iZsZbXQ@mail.gmail.com>
On Mon, Sep 09, 2024 at 04:44:29PM -0700, Andrii Nakryiko wrote:
> On Mon, Sep 9, 2024 at 12:46 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding support to attach bpf program for entry and return probe
> > of the same function. This is common use case which at the moment
> > requires to create two uprobe multi links.
> >
> > Adding new BPF_TRACE_UPROBE_SESSION attach type that instructs
> > kernel to attach single link program to both entry and exit probe.
> >
> > It's possible to control execution of the bpf program on return
> > probe simply by returning zero or non zero from the entry bpf
> > program execution to execute or not the bpf program on return
> > probe respectively.
> >
>
> pedantic nit: bpf -> BPF
ok
>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > include/uapi/linux/bpf.h | 1 +
> > kernel/bpf/syscall.c | 9 +++++++--
> > kernel/trace/bpf_trace.c | 32 ++++++++++++++++++++++++--------
> > tools/include/uapi/linux/bpf.h | 1 +
> > tools/lib/bpf/libbpf.c | 1 +
> > 5 files changed, 34 insertions(+), 10 deletions(-)
> >
>
> LGTM
>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
>
> [...]
>
> > @@ -3336,9 +3347,13 @@ uprobe_multi_link_handler(struct uprobe_consumer *con, struct pt_regs *regs,
> > __u64 *data)
> > {
> > struct bpf_uprobe *uprobe;
> > + int ret;
> >
> > uprobe = container_of(con, struct bpf_uprobe, consumer);
> > - return uprobe_prog_run(uprobe, instruction_pointer(regs), regs);
> > + ret = uprobe_prog_run(uprobe, instruction_pointer(regs), regs);
> > + if (uprobe->consumer.session)
> > + return ret ? UPROBE_HANDLER_IGNORE : 0;
>
> Should we restrict the return range to [0, 1] for UPROBE_SESSION
> programs on the verifier side (given it's a new program type and we
> can do that)?
yes, I think we can do that.. we have BPF_TRACE_UPROBE_SESSION as
expected_attach_type so we can do that during the load
hum, is it too late to do that for kprobe session as well?
thanks,
jirka
>
> > + return ret;
> > }
> >
>
> [...]
next prev parent reply other threads:[~2024-09-10 7:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 7:45 [PATCHv3 0/7] uprobe, bpf: Add session support Jiri Olsa
2024-09-09 7:45 ` [PATCHv3 1/7] uprobe: Add support for session consumer Jiri Olsa
2024-09-09 23:44 ` Andrii Nakryiko
2024-09-10 7:17 ` Jiri Olsa
2024-09-10 14:10 ` Masami Hiramatsu
2024-09-11 11:48 ` Jiri Olsa
2024-09-12 16:20 ` Oleg Nesterov
2024-09-13 8:22 ` Jiri Olsa
2024-09-13 10:07 ` Oleg Nesterov
2024-09-13 10:57 ` Oleg Nesterov
2024-09-13 11:34 ` Jiri Olsa
2024-09-13 11:41 ` Oleg Nesterov
2024-09-12 16:35 ` Oleg Nesterov
2024-09-13 8:36 ` Jiri Olsa
2024-09-13 9:32 ` Oleg Nesterov
2024-09-13 10:17 ` Jiri Olsa
2024-09-13 11:52 ` Oleg Nesterov
2024-09-09 7:45 ` [PATCHv3 2/7] bpf: Add support for uprobe multi session attach Jiri Olsa
2024-09-09 23:44 ` Andrii Nakryiko
2024-09-10 7:17 ` Jiri Olsa [this message]
2024-09-10 18:09 ` Andrii Nakryiko
2024-09-09 7:45 ` [PATCHv3 3/7] bpf: Add support for uprobe multi session context Jiri Olsa
2024-09-09 7:45 ` [PATCHv3 4/7] libbpf: Add support for uprobe multi session attach Jiri Olsa
2024-09-09 23:44 ` Andrii Nakryiko
2024-09-10 7:17 ` Jiri Olsa
2024-09-09 7:45 ` [PATCHv3 5/7] selftests/bpf: Add uprobe session test Jiri Olsa
2024-09-09 23:45 ` Andrii Nakryiko
2024-09-10 7:17 ` Jiri Olsa
2024-09-09 7:45 ` [PATCHv3 6/7] selftests/bpf: Add uprobe session cookie test Jiri Olsa
2024-09-09 7:45 ` [PATCHv3 7/7] selftests/bpf: Add uprobe session recursive test Jiri Olsa
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=Zt_ygFPEdX53rqaW@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=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.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;
as well as URLs for NNTP newsgroup(s).