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]
Message-ID: <CAEf4BzZm+-pHwnkaaP4+kPJPmsG=0vTKFU4M+At890JsivfZeA@mail.gmail.com>
Date:   Tue, 27 Oct 2020 20:40:21 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andrii@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Nathan Chancellor <natechancellor@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Quentin Monnet <quentin@...valent.com>,
        Michal Rostecki <mrostecki@...nsuse.org>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        Tobias Klauser <tklauser@...tanz.ch>,
        open list <linux-kernel@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH 1/2] tools, bpftool: Avoid array index warnings.

On Tue, Oct 27, 2020 at 4:37 PM Ian Rogers <irogers@...gle.com> wrote:
>
> The bpf_caps array is shorter without CAP_BPF, avoid out of bounds reads
> if this isn't defined. Working around this avoids -Wno-array-bounds with
> clang.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---

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

>  tools/bpf/bpftool/feature.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
> index a43a6f10b564..359960a8f1de 100644
> --- a/tools/bpf/bpftool/feature.c
> +++ b/tools/bpf/bpftool/feature.c
> @@ -843,9 +843,14 @@ static int handle_perms(void)
>                 else
>                         p_err("missing %s%s%s%s%s%s%s%srequired for full feature probing; run as root or use 'unprivileged'",
>                               capability_msg(bpf_caps, 0),
> +#ifdef CAP_BPF
>                               capability_msg(bpf_caps, 1),
>                               capability_msg(bpf_caps, 2),
> -                             capability_msg(bpf_caps, 3));
> +                             capability_msg(bpf_caps, 3)
> +#else
> +                               "", "", "", "", "", ""
> +#endif /* CAP_BPF */
> +                               );
>                 goto exit_free;
>         }
>
> --
> 2.29.0.rc2.309.g374f81d7ae-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ