From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
x86@kernel.org
Subject: Re: [PATCH bpf-next 2/3] selftests/bpf: Add uretprobe syscall test for regs integrity
Date: Sun, 31 Mar 2024 21:37:03 +0200 [thread overview]
Message-ID: <Zgm7X1_3iRewLNQQ@krava> (raw)
In-Reply-To: <CAEf4BzZps+OdPoyRz1=7mEzh=shjVjT=ZznhMD0Y-w98GW782g@mail.gmail.com>
On Fri, Mar 29, 2024 at 03:30:11PM -0700, Andrii Nakryiko wrote:
> On Wed, Mar 27, 2024 at 3:21 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Add uretprobe syscall test that compares register values before
> > and after the uretprobe is hit. It also compares the register
> > values seen from attached bpf program.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/include/linux/compiler.h | 4 +
> > .../selftests/bpf/prog_tests/uprobe_syscall.c | 163 ++++++++++++++++++
> > .../selftests/bpf/progs/uprobe_syscall.c | 15 ++
> > 3 files changed, 182 insertions(+)
> > create mode 100644 tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > create mode 100644 tools/testing/selftests/bpf/progs/uprobe_syscall.c
>
> [...]
>
> > +__naked unsigned long uprobe_syscall_arch_test(void)
> > +{
> > + asm volatile (
> > + "movq $0xdeadbeef, %rax\n"
> > + "ret\n"
> > + );
> > +}
> > +
> > +__naked void uprobe_syscall_arch(struct pt_regs *before, struct pt_regs *after)
>
> don't you get compiler warnings for using __naked with explicit
> function arguments?
nope, both gcc and clang are silent
>
> > +{
> > + asm volatile (
> > + "movq %r15, 0(%rdi)\n"
> > + "movq %r14, 8(%rdi)\n"
>
> [...]
>
> > + err = uprobe_syscall__attach(skel);
> > + if (!ASSERT_OK(err, "uprobe_syscall__attach"))
> > + goto cleanup;
> > +
> > + uprobe_syscall_arch(&before, &after);
>
> uprobe_syscall_arch() doesn't really do an explicit `syscall
> uretprobe`, it should work for int3-based uretprobes as well? Let's
> call it something a bit more generic then?
ok, how about
uprobe_syscall_arch -> uretprobe_regs
uprobe_syscall_arch_test -> uretprobe_regs_trigger
>
> Also, I think patch #1 will go through Masami's trace tree, right? But
> we can land selftests into bpf-next even before that, given they
> should work for both syscall and interrupt based uretprobes.
hm, not sure.. I did not originally cc Masami/Steven :-\ adding now
Masami, could patch 1 go through:
https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes/for-next
thanks,
jirka
next prev parent reply other threads:[~2024-03-31 19:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 10:20 [PATCH bpf-next 0/3] uprobe: uretprobe speed up Jiri Olsa
2024-03-27 10:20 ` [PATCH bpf-next 1/3] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
2024-03-27 11:45 ` Oleg Nesterov
2024-03-29 22:24 ` Andrii Nakryiko
2024-03-27 10:20 ` [PATCH bpf-next 2/3] selftests/bpf: Add uretprobe syscall test for regs integrity Jiri Olsa
2024-03-29 22:30 ` Andrii Nakryiko
2024-03-29 22:34 ` Andrii Nakryiko
2024-03-31 19:37 ` Jiri Olsa [this message]
2024-04-01 9:47 ` Masami Hiramatsu
2024-03-27 10:20 ` [PATCH bpf-next 3/3] selftests/bpf: Add uretprobe syscall test for regs changes Jiri Olsa
2024-03-29 22:34 ` Andrii Nakryiko
2024-03-31 19:32 ` 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=Zgm7X1_3iRewLNQQ@krava \
--to=olsajiri@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=mhiramat@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--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