diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-06-25 16:26:28 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-06-28 10:06:53 -0700 |
commit | d929758101fc0674008169dc1de963e3181c587b (patch) | |
tree | 0e07404c7d8e4d9af8af348421cee545d8e48c28 /crypto/ecb.c | |
parent | 16d37ee3d2b1c30052ba5ebb69556040fc174061 (diff) | |
download | linux-stable-d929758101fc0674008169dc1de963e3181c587b.tar.gz linux-stable-d929758101fc0674008169dc1de963e3181c587b.tar.bz2 linux-stable-d929758101fc0674008169dc1de963e3181c587b.zip |
libbpf: Support disabling auto-loading BPF programs
Currently, bpf_object__load() (and by induction skeleton's load), will always
attempt to prepare, relocate, and load into kernel every single BPF program
found inside the BPF object file. This is often convenient and the right thing
to do and what users expect.
But there are plenty of cases (especially with BPF development constantly
picking up the pace), where BPF application is intended to work with old
kernels, with potentially reduced set of features. But on kernels supporting
extra features, it would like to take a full advantage of them, by employing
extra BPF program. This could be a choice of using fentry/fexit over
kprobe/kretprobe, if kernel is recent enough and is built with BTF. Or BPF
program might be providing optimized bpf_iter-based solution that user-space
might want to use, whenever available. And so on.
With libbpf and BPF CO-RE in particular, it's advantageous to not have to
maintain two separate BPF object files to achieve this. So to enable such use
cases, this patch adds ability to request not auto-loading chosen BPF
programs. In such case, libbpf won't attempt to perform relocations (which
might fail due to old kernel), won't try to resolve BTF types for
BTF-aware (tp_btf/fentry/fexit/etc) program types, because BTF might not be
present, and so on. Skeleton will also automatically skip auto-attachment step
for such not loaded BPF programs.
Overall, this feature allows to simplify development and deployment of
real-world BPF applications with complicated compatibility requirements.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200625232629.3444003-2-andriin@fb.com
Diffstat (limited to 'crypto/ecb.c')
0 files changed, 0 insertions, 0 deletions