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]
Date:   Tue, 23 Jun 2020 00:04:26 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Andrii Nakryiko <andriin@...com>, bpf@...r.kernel.org,
        netdev@...r.kernel.org, ast@...com
Cc:     andrii.nakryiko@...il.com, kernel-team@...com
Subject: Re: [PATCH bpf-next] libbpf: add a bunch of attribute getters/setters
 for map definitions

On 6/21/20 8:21 AM, Andrii Nakryiko wrote:
> Add a bunch of getter for various aspects of BPF map. Some of these attribute
> (e.g., key_size, value_size, type, etc) are available right now in struct
> bpf_map_def, but this patch adds getter allowing to fetch them individually.
> bpf_map_def approach isn't very scalable, when ABI stability requirements are
> taken into account. It's much easier to extend libbpf and add support for new
> features, when each aspect of BPF map has separate getter/setter.
> 
> Getters follow the common naming convention of not explicitly having "get" in
> its name: bpf_map__type() returns map type, bpf_map__key_size() returns
> key_size. Setters, though, explicitly have set in their name:
> bpf_map__set_type(), bpf_map__set_key_size().
> 
> This patch ensures we now have a getter and a setter for the following
> map attributes:
>    - type;
>    - max_entries;
>    - map_flags;
>    - numa_node;
>    - key_size;
>    - value_size;
>    - ifindex.
> 
> bpf_map__resize() enforces unnecessary restriction of max_entries > 0. It is
> unnecessary, because libbpf actually supports zero max_entries for some cases
> (e.g., for PERF_EVENT_ARRAY map) and treats it specially during map creation
> time. To allow setting max_entries=0, new bpf_map__set_max_entries() setter is
> added. bpf_map__resize()'s behavior is preserved for backwards compatibility
> reasons.
> 
> Map ifindex getter is added as well. There is a setter already, but no
> corresponding getter. Fix this assymetry as well. bpf_map__set_ifindex()
> itself is converted from void function into error-returning one, similar to
> other setters. The only error returned right now is -EBUSY, if BPF map is
> already loaded and has corresponding FD.
> 
> One lacking attribute with no ability to get/set or even specify it
> declaratively is numa_node. This patch fixes this gap and both adds
> programmatic getter/setter, as well as adds support for numa_node field in
> BTF-defined map.
> 
> Signed-off-by: Andrii Nakryiko <andriin@...com>

Lgtm, applied, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ