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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 7 Jul 2021 17:18:49 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andriin@...com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Alan Maguire <alan.maguire@...cle.com>
Subject: Re: [PATCHv3 bpf-next 7/7] selftests/bpf: Add test for
 bpf_get_func_ip in kprobe+offset probe

On Wed, Jul 7, 2021 at 2:54 PM Jiri Olsa <jolsa@...hat.com> wrote:
>
> Adding test for bpf_get_func_ip in kprobe+ofset probe.

typo: offset

> Because of the offset value it's arch specific, adding
> it only for x86_64 architecture.

I'm not following, you specified +0x5 offset explicitly, why is this
arch-specific?

>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  .../testing/selftests/bpf/progs/get_func_ip_test.c  | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/get_func_ip_test.c b/tools/testing/selftests/bpf/progs/get_func_ip_test.c
> index 8ca54390d2b1..e8a9428a0ea3 100644
> --- a/tools/testing/selftests/bpf/progs/get_func_ip_test.c
> +++ b/tools/testing/selftests/bpf/progs/get_func_ip_test.c
> @@ -10,6 +10,7 @@ extern const void bpf_fentry_test2 __ksym;
>  extern const void bpf_fentry_test3 __ksym;
>  extern const void bpf_fentry_test4 __ksym;
>  extern const void bpf_modify_return_test __ksym;
> +extern const void bpf_fentry_test6 __ksym;
>
>  __u64 test1_result = 0;
>  SEC("fentry/bpf_fentry_test1")
> @@ -60,3 +61,15 @@ int BPF_PROG(fmod_ret_test, int a, int *b, int ret)
>         test5_result = (const void *) addr == &bpf_modify_return_test;
>         return ret;
>  }
> +
> +#ifdef __x86_64__
> +__u64 test6_result = 0;

see, and you just forgot to update the user-space part of the test to
even check test6_result...

please group variables together and do explicit ASSERT_EQ

> +SEC("kprobe/bpf_fentry_test6+0x5")
> +int test6(struct pt_regs *ctx)
> +{
> +       __u64 addr = bpf_get_func_ip(ctx);
> +
> +       test6_result = (const void *) addr == &bpf_fentry_test6 + 5;
> +       return 0;
> +}
> +#endif
> --
> 2.31.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ