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:   Thu, 21 Apr 2022 21:09:08 +0800
From:   Yafang Shao <laoar.shao@...il.com>
To:     Artem Savkov <asavkov@...hat.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: fix attach tests retcode checks

On Thu, Apr 21, 2022 at 9:01 PM Artem Savkov <asavkov@...hat.com> wrote:
>
> Switching to libbpf 1.0 API broke test_sock and test_sysctl as they
> check for return of bpf_prog_attach to be exactly -1. Switch the check
> to '< 0' instead.
>
> Fixes: b858ba8c52b6 ("selftests/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK")
> Signed-off-by: Artem Savkov <asavkov@...hat.com>

Reviewed-by: Yafang Shao <laoar.shao@...il.com>

> ---
>  tools/testing/selftests/bpf/test_sock.c   | 2 +-
>  tools/testing/selftests/bpf/test_sysctl.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
> index 6c4494076bbf..810c3740b2cc 100644
> --- a/tools/testing/selftests/bpf/test_sock.c
> +++ b/tools/testing/selftests/bpf/test_sock.c
> @@ -492,7 +492,7 @@ static int run_test_case(int cgfd, const struct sock_test *test)
>                         goto err;
>         }
>
> -       if (attach_sock_prog(cgfd, progfd, test->attach_type) == -1) {
> +       if (attach_sock_prog(cgfd, progfd, test->attach_type) < 0) {
>                 if (test->result == ATTACH_REJECT)
>                         goto out;
>                 else
> diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c
> index 5bae25ca19fb..57620e7c9048 100644
> --- a/tools/testing/selftests/bpf/test_sysctl.c
> +++ b/tools/testing/selftests/bpf/test_sysctl.c
> @@ -1560,7 +1560,7 @@ static int run_test_case(int cgfd, struct sysctl_test *test)
>                         goto err;
>         }
>
> -       if (bpf_prog_attach(progfd, cgfd, atype, BPF_F_ALLOW_OVERRIDE) == -1) {
> +       if (bpf_prog_attach(progfd, cgfd, atype, BPF_F_ALLOW_OVERRIDE) < 0) {
>                 if (test->result == ATTACH_REJECT)
>                         goto out;
>                 else
> --
> 2.35.1
>


-- 
Regards
Yafang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ