]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Don't require root for bpf_object__open()
authorAndrii Nakryiko <andriin@fb.com>
Sat, 14 Dec 2019 01:43:25 +0000 (17:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 15 Dec 2019 23:58:04 +0000 (15:58 -0800)
commit767abe73755fa737b99ef05a7536b350da54e30d
tree2a0b25e703e11009c64ec522b6e00eef85ac701c
parent286ddc67fb16da339b116ee8cc1b2256d2744865
libbpf: Don't require root for bpf_object__open()

Reorganize bpf_object__open and bpf_object__load steps such that
bpf_object__open doesn't need root access. This was previously done for
feature probing and BTF sanitization. This doesn't have to happen on open,
though, so move all those steps into the load phase.

This is important, because it makes it possible for tools like bpftool, to
just open BPF object file and inspect their contents: programs, maps, BTF,
etc. For such operations it is prohibitive to require root access. On the
other hand, there is a lot of custom libbpf logic in those steps, so its best
avoided for tools to reimplement all that on their own.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191214014341.3442258-2-andriin@fb.com
tools/lib/bpf/libbpf.c