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: <CAEf4BzYVnVYXT_QN4j_4qp=vY69nAoun-vumSfzVx-xE0CuJjQ@mail.gmail.com>
Date:   Tue, 12 May 2020 15:29:32 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Yonghong Song <yhs@...com>
Cc:     Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
        Martin KaFai Lau <kafai@...com>,
        Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 7/8] bpf: enable bpf_iter targets registering ctx
 argument types

On Tue, May 12, 2020 at 8:54 AM Yonghong Song <yhs@...com> wrote:
>
> Commit b121b341e598 ("bpf: Add PTR_TO_BTF_ID_OR_NULL
> support") adds a field btf_id_or_null_non0_off to
> bpf_prog->aux structure to indicate that the
> first ctx argument is PTR_TO_BTF_ID reg_type and
> all others are PTR_TO_BTF_ID_OR_NULL.
> This approach does not really scale if we have
> other different reg types in the future, e.g.,
> a pointer to a buffer.
>
> This patch enables bpf_iter targets registering ctx argument
> reg types which may be different from the default one.
> For example, for pointers to structures, the default reg_type
> is PTR_TO_BTF_ID for tracing program. The target can register
> a particular pointer type as PTR_TO_BTF_ID_OR_NULL which can
> be used by the verifier to enforce accesses.
>
> Signed-off-by: Yonghong Song <yhs@...com>
> ---

LGTM. It's cleaner approach than btf_id_or_null_non0_off, of course.
Having field annotations would be even better, but BTF doesn't have
attributes (yet).

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

>  include/linux/bpf.h      | 12 +++++++++++-
>  include/net/ip6_fib.h    |  7 +++++++
>  kernel/bpf/bpf_iter.c    |  5 +++++
>  kernel/bpf/btf.c         | 15 ++++++++++-----
>  kernel/bpf/map_iter.c    |  5 +++++
>  kernel/bpf/task_iter.c   | 12 ++++++++++++
>  kernel/bpf/verifier.c    |  1 -
>  net/ipv6/ip6_fib.c       |  5 -----
>  net/ipv6/route.c         |  5 +++++
>  net/netlink/af_netlink.c |  5 +++++
>  10 files changed, 60 insertions(+), 12 deletions(-)
>

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ