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] [day] [month] [year] [list]
Message-ID: <CAEf4BzbfDGQoazRO-ZZAksxSc_j5HMOpAPLx57A0UjR7JjAYDg@mail.gmail.com>
Date:   Tue, 1 Dec 2020 17:24:21 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Florian Lehner <dev@...-flo.net>
Cc:     bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        john fastabend <john.fastabend@...il.com>,
        Stanislav Fomichev <sdf@...gle.com>,
        Krzesimir Nowak <krzesimir@...volk.io>
Subject: Re: [PATCH 1/2] selftests/bpf: Avoid errno clobbering

On Sat, Nov 28, 2020 at 11:28 AM Florian Lehner <dev@...-flo.net> wrote:
>
> Commit 8184d44c9a57 ("selftests/bpf: skip verifier tests for unsupported
> program types") added a check to skip unsupported program types. As
> bpf_probe_prog_type can change errno, do_single_test should save it before
> printing a reason why a supported BPF program type failed to load.
>
> Fixes: 8184d44c9a57 ("selftests/bpf: skip verifier tests for unsupported program types")
> Cc: Stanislav Fomichev <sdf@...gle.com>
> Cc: Krzesimir Nowak <krzesimir@...volk.io>
> Signed-off-by: Florian Lehner <dev@...-flo.net>
> ---

Acked-by: Andrii Nakryiko <andrii@...nel.org>

>  tools/testing/selftests/bpf/test_verifier.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
> index 4bfe3aa2cfc4..ceea9409639e 100644
> --- a/tools/testing/selftests/bpf/test_verifier.c
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -936,6 +936,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
>         int run_errs, run_successes;
>         int map_fds[MAX_NR_MAPS];
>         const char *expected_err;
> +       int saved_errno;
>         int fixup_skips;
>         __u32 pflags;
>         int i, err;
> @@ -997,6 +998,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
>         }
>
>         fd_prog = bpf_load_program_xattr(&attr, bpf_vlog, sizeof(bpf_vlog));
> +       saved_errno = errno;
>
>         /* BPF_PROG_TYPE_TRACING requires more setup and
>          * bpf_probe_prog_type won't give correct answer
> @@ -1013,7 +1015,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
>         if (expected_ret == ACCEPT || expected_ret == VERBOSE_ACCEPT) {
>                 if (fd_prog < 0) {
>                         printf("FAIL\nFailed to load prog '%s'!\n",
> -                              strerror(errno));
> +                              strerror(saved_errno));
>                         goto fail_log;
>                 }
>  #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
> --
> 2.28.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ