Re: [PATCH perf/core 18/22] selftests/bpf: Add uprobe_regs_equal test

Jiri Olsa
2025-04-24T12:51:37Z

On Wed, Apr 23, 2025 at 10:46:24AM -0700, Andrii Nakryiko wrote:
> On Mon, Apr 21, 2025 at 2:48 PM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Changing uretprobe_regs_trigger to allow the test for both
> > uprobe and uretprobe and renaming it to uprobe_regs_equal.
> >
> > We check that both uprobe and uretprobe probes (bpf programs)
> > see expected registers with few exceptions.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > .../selftests/bpf/prog_tests/uprobe_syscall.c | 58 ++++++++++++++-----
> > .../selftests/bpf/progs/uprobe_syscall.c | 4 +-
> > 2 files changed, 45 insertions(+), 17 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > index f001986981ab..6d88c5b0f6aa 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > @@ -18,15 +18,17 @@
> >
> > #pragma GCC diagnostic ignored "-Wattributes"
> >
> > -__naked unsigned long uretprobe_regs_trigger(void)
> > +__attribute__((aligned(16)))
> > +__nocf_check __weak __naked unsigned long uprobe_regs_trigger(void)
> > {
> > asm volatile (
> > - "movq $0xdeadbeef, %rax\n"
> > + ".byte 0x0f, 0x1f, 0x44, 0x00, 0x00 \n"
>
> Is it me not being hardcore enough... But is anyone supposed to know
> that this is nop5? ;) maybe add /* nop5 */ comment on the side?

ok, will add the comment :)

>
> > + "movq $0xdeadbeef, %rax \n"
>
> ret\n doesn't align newline, and uprobe_regs below don't either. So
> maybe don't align them at all here?

ok

thanks,
jirka