diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-05-11 00:13:15 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-05-13 02:31:20 +0300 |
commit | d7c4b3980c18e81c0470f5df6d96d832f446d26f (patch) | |
tree | 40533816350a46db39797d06ac310ed229a4519a /net/mac80211/main.c | |
parent | ff1f28c03f6a7cb5ee5802288258c2fc07ed9b07 (diff) | |
download | linux-d7c4b3980c18e81c0470f5df6d96d832f446d26f.tar.xz |
libbpf: detect supported kernel BTF features and sanitize BTF
Depending on used versions of libbpf, Clang, and kernel, it's possible to
have valid BPF object files with valid BTF information, that still won't
load successfully due to Clang emitting newer BTF features (e.g.,
BTF_KIND_FUNC, .BTF.ext's line_info/func_info, BTF_KIND_DATASEC, etc), that
are not yet supported by older kernel.
This patch adds detection of BTF features and sanitizes BPF object's BTF
by substituting various supported BTF kinds, which have compatible layout:
- BTF_KIND_FUNC -> BTF_KIND_TYPEDEF
- BTF_KIND_FUNC_PROTO -> BTF_KIND_ENUM
- BTF_KIND_VAR -> BTF_KIND_INT
- BTF_KIND_DATASEC -> BTF_KIND_STRUCT
Replacement is done in such a way as to preserve as much information as
possible (names, sizes, etc) where possible without violating kernel's
validation rules.
v2->v3:
- remove duplicate #defines from libbpf_util.h
v1->v2:
- add internal libbpf_internal.h w/ common stuff
- switch SK storage BTF to use new libbpf__probe_raw_btf()
Reported-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/mac80211/main.c')
0 files changed, 0 insertions, 0 deletions