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]
Date:   Fri, 15 Feb 2019 01:52:11 +0000
From:   Yonghong Song <yhs@...com>
To:     Andrey Ignatov <rdna@...com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH bpf-next 1/2] libbpf: Introduce bpf_map__resize



On 2/14/19 3:01 PM, Andrey Ignatov wrote:
> Add bpf_map__resize() to change max_entries for a map.
> 
> Quite often necessary map size is unknown at compile time and can be
> calculated only at run time.
> 
> Currently the following approach is used to do so:
> * bpf_object__open_buffer() to open Elf file from a buffer;
> * bpf_object__find_map_by_name() to find relevant map;
> * bpf_map__def() to get map attributes and create struct
>    bpf_create_map_attr from them;
> * update max_entries in bpf_create_map_attr;
> * bpf_create_map_xattr() to create new map with updated max_entries;
> * bpf_map__reuse_fd() to replace the map in bpf_object with newly
>    created one.
> 
> And after all this bpf_object can finally be loaded. The map will have
> new size.
> 
> It 1) is quite a lot of steps; 2) doesn't take BTF into account.
> 
> For "2)" even more steps should be made and some of them require changes
> to libbpf (e.g. to get struct btf * from bpf_object).
> 
> Instead the whole problem can be solved by introducing simple
> bpf_map__resize() API that checks the map and sets new max_entries if
> the map is not loaded yet.
> 
> So the new steps are:
> * bpf_object__open_buffer() to open Elf file from a buffer;
> * bpf_object__find_map_by_name() to find relevant map;
> * bpf_map__resize() to update max_entries.
> 
> That's much simpler and works with BTF.
> 
> Signed-off-by: Andrey Ignatov <rdna@...com>
Acked-by: Yonghong Song <yhs@...com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ