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: <CAEf4BzZKTHMqyTsLk-4ysjyRpN1sRN_vK1yn5HfAFWfqKZ=B-g@mail.gmail.com>
Date:   Fri, 18 Oct 2019 16:28:19 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Alexei Starovoitov <ast@...nel.org>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Daniel Borkmann <daniel@...earbox.net>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next] bpf: fix bpf_attr.attach_btf_id check

On Fri, Oct 18, 2019 at 4:25 PM Alexei Starovoitov <ast@...nel.org> wrote:
>
> Only raw_tracepoint program type can have bpf_attr.attach_btf_id >= 0.

typo: just > (code is actually correct, though)

> Make sure to reject other program types that accidentally set it to non-zero.
>
> Fixes: ccfe29eb29c2 ("bpf: Add attach_btf_id attribute to program load")
> Reported-by: Andrii Nakryiko <andriin@...com>
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> ---

Acked-by: Andrii Nakryiko <andriin@...com>

>  kernel/bpf/syscall.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 523e3ac15a08..16ea3c0db4f6 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1570,6 +1570,17 @@ bpf_prog_load_check_attach(enum bpf_prog_type prog_type,
>                            enum bpf_attach_type expected_attach_type,
>                            u32 btf_id)
>  {
> +       switch (prog_type) {
> +       case BPF_PROG_TYPE_RAW_TRACEPOINT:
> +               if (btf_id > BTF_MAX_TYPE)
> +                       return -EINVAL;
> +               break;
> +       default:
> +               if (btf_id)
> +                       return -EINVAL;
> +               break;
> +       }
> +
>         switch (prog_type) {
>         case BPF_PROG_TYPE_CGROUP_SOCK:
>                 switch (expected_attach_type) {
> @@ -1610,13 +1621,7 @@ bpf_prog_load_check_attach(enum bpf_prog_type prog_type,
>                 default:
>                         return -EINVAL;
>                 }
> -       case BPF_PROG_TYPE_RAW_TRACEPOINT:
> -               if (btf_id > BTF_MAX_TYPE)
> -                       return -EINVAL;
> -               return 0;
>         default:
> -               if (btf_id)
> -                       return -EINVAL;
>                 return 0;
>         }
>  }
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ