lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ4975boVLbDXhVkjbiY_gp=RTTzJZ9zhfXc0zrgs4obw@mail.gmail.com>
Date: Thu, 15 May 2025 10:24:42 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>, 
	Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-trace-kernel@...r.kernel.org, x86@...nel.org, 
	Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>, 
	John Fastabend <john.fastabend@...il.com>, Hao Luo <haoluo@...gle.com>, 
	Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>, 
	Alan Maguire <alan.maguire@...cle.com>, David Laight <David.Laight@...lab.com>, 
	Thomas Weißschuh <thomas@...ch.de>, 
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCHv2 perf/core 13/22] selftests/bpf: Rename
 uprobe_syscall_executed prog to test_uretprobe_multi

On Thu, May 15, 2025 at 5:14 AM Jiri Olsa <jolsa@...nel.org> wrote:
>
> Renaming uprobe_syscall_executed prog to test_uretprobe_multi
> to fit properly in the following changes that add more programs.
>
> Plus adding pid filter and increasing executed variable.
>
> Acked-by: Andrii Nakryiko <andrii@...nel.org>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  .../selftests/bpf/prog_tests/uprobe_syscall.c       | 12 ++++++++----
>  .../selftests/bpf/progs/uprobe_syscall_executed.c   | 13 ++++++++++---
>  2 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> index 2b00f16406c8..1cce50b5d18c 100644
> --- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> @@ -252,6 +252,7 @@ static void test_uretprobe_syscall_call(void)
>         );
>         struct uprobe_syscall_executed *skel;
>         int pid, status, err, go[2], c;
> +       struct bpf_link *link;
>
>         if (!ASSERT_OK(pipe(go), "pipe"))
>                 return;
> @@ -277,11 +278,14 @@ static void test_uretprobe_syscall_call(void)
>                 _exit(0);
>         }
>
> -       skel->links.test = bpf_program__attach_uprobe_multi(skel->progs.test, pid,
> -                                                           "/proc/self/exe",
> -                                                           "uretprobe_syscall_call", &opts);
> -       if (!ASSERT_OK_PTR(skel->links.test, "bpf_program__attach_uprobe_multi"))
> +       skel->bss->pid = pid;
> +
> +       link = bpf_program__attach_uprobe_multi(skel->progs.test_uretprobe_multi,
> +                                               pid, "/proc/self/exe",
> +                                               "uretprobe_syscall_call", &opts);
> +       if (!ASSERT_OK_PTR(link, "bpf_program__attach_uprobe_multi"))
>                 goto cleanup;
> +       skel->links.test_uretprobe_multi = link;
>
>         /* kick the child */
>         write(go[1], &c, 1);
> diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> index 0d7f1a7db2e2..c4c3447378ba 100644
> --- a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> +++ b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> @@ -8,10 +8,17 @@ struct pt_regs regs;
>  char _license[] SEC("license") = "GPL";
>
>  int executed = 0;
> +int pid;
>
> -SEC("uretprobe.multi")
> -int test(struct pt_regs *regs)
> +static int inc_executed(void)
>  {
> -       executed = 1;
> +       if (bpf_get_current_pid_tgid() >> 32 == pid)
> +               executed++;

it's customary (and makes sense to me) with filtering like this to not
add nestedness:


if (bpf_get_current_pid_tgid() >> 32 != pid)
    return 0;

executed += 1;
return 0;

>         return 0;
>  }
> +
> +SEC("uretprobe.multi")
> +int test_uretprobe_multi(struct pt_regs *ctx)
> +{
> +       return inc_executed();
> +}
> --
> 2.49.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ