From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
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 RFC bpf-next 2/3] selftests/bpf: Add uretprobe syscall test
Date: Tue, 19 Mar 2024 12:09:41 +0100 [thread overview]
Message-ID: <ZflydR1hmBzbaPY2@krava> (raw)
In-Reply-To: <CAEf4BzZBkCxrwS=nuXnY5_g_BgNQkYYsVGcGp_zhn=CF4ypPdg@mail.gmail.com>
On Mon, Mar 18, 2024 at 06:16:09PM -0700, Andrii Nakryiko wrote:
> On Mon, Mar 18, 2024 at 2:32 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Add uretprobe syscall test and compare register values before
> > and after the uretprobe is hit. Also compare the register values
> > seen from attached bpf program.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/testing/selftests/bpf/Makefile | 13 ++-
> > .../bpf/prog_tests/arch/x86/uprobe_syscall.S | 89 +++++++++++++++++++
> > .../selftests/bpf/prog_tests/uprobe_syscall.c | 84 +++++++++++++++++
> > .../selftests/bpf/progs/uprobe_syscall.c | 15 ++++
> > 4 files changed, 200 insertions(+), 1 deletion(-)
> > create mode 100644 tools/testing/selftests/bpf/prog_tests/arch/x86/uprobe_syscall.S
> > create mode 100644 tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > create mode 100644 tools/testing/selftests/bpf/progs/uprobe_syscall.c
> >
>
> Can all the above be achieved with inline assembly inside .c files? It
> would probably simplify logistics overall. We can guard with
> arch-specific #ifdefs, of course.
ok, probably yes.. I'll check
>
> [...]
>
> > diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall.c b/tools/testing/selftests/bpf/progs/uprobe_syscall.c
> > new file mode 100644
> > index 000000000000..0cc7e8761410
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/uprobe_syscall.c
> > @@ -0,0 +1,15 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include "vmlinux.h"
> > +#include <bpf/bpf_helpers.h>
> > +#include <string.h>
> > +
> > +struct pt_regs regs;
> > +
> > +char _license[] SEC("license") = "GPL";
> > +
> > +SEC("uretprobe//proc/self/exe:uprobe_syscall_arch_test")
> > +int uretprobe(struct pt_regs *ctx)
> > +{
> > + memcpy(®s, ctx, sizeof(regs));
>
> nit: please use __builtin_memcpy(), given this is BPF code. And we
> don't need string.h include.
right, thanks
jirka
>
> > + return 0;
> > +}
> > --
> > 2.44.0
> >
next prev parent reply other threads:[~2024-03-19 11:09 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 9:31 [PATCH RFC bpf-next 0/3] uprobe: uretprobe speed up Jiri Olsa
2024-03-18 9:31 ` [PATCH RFC bpf-next 1/3] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
2024-03-18 14:22 ` Oleg Nesterov
2024-03-19 1:11 ` Andrii Nakryiko
2024-03-19 6:32 ` Oleg Nesterov
2024-03-19 16:20 ` Andrii Nakryiko
2024-03-19 10:54 ` Jiri Olsa
2024-03-18 9:31 ` [PATCH RFC bpf-next 2/3] selftests/bpf: Add uretprobe syscall test Jiri Olsa
2024-03-19 1:16 ` Andrii Nakryiko
2024-03-19 11:09 ` Jiri Olsa [this message]
2024-03-18 9:31 ` [PATCH RFC bpf-next 3/3] selftests/bpf: Mark uprobe trigger functions with nocf_check attribute Jiri Olsa
2024-03-19 1:22 ` Andrii Nakryiko
2024-03-19 11:11 ` Jiri Olsa
2024-03-22 13:40 ` Jiri Olsa
2024-03-19 10:25 ` [PATCH RFC bpf-next 4/3] uprobe: ensure sys_uretprobe uses sysret Oleg Nesterov
2024-03-19 11:08 ` Jiri Olsa
2024-03-19 16:25 ` Andrii Nakryiko
2024-03-19 16:38 ` Oleg Nesterov
2024-03-19 19:35 ` Jiri Olsa
2024-03-19 19:31 ` Jiri Olsa
2024-03-19 20:13 ` Andrii Nakryiko
2024-03-20 11:04 ` Jiri Olsa
2024-03-20 14:37 ` Oleg Nesterov
2024-03-20 15:28 ` Oleg Nesterov
2024-03-20 17:44 ` Andrii Nakryiko
2024-03-20 19:08 ` Jiri Olsa
2024-03-21 10:10 ` Oleg Nesterov
2024-03-21 9:59 ` Jiri Olsa
2024-03-21 10:17 ` Oleg Nesterov
2024-03-21 10:52 ` Jiri Olsa
2024-03-21 12:14 ` Oleg Nesterov
2024-03-21 20:29 ` Jiri Olsa
2024-03-22 8:48 ` Oleg Nesterov
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=ZflydR1hmBzbaPY2@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=oleg@redhat.com \
--cc=peterz@infradead.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