libbpf v1.4.0
User space-side features and APIs
- support for BPF token throughout low-level and high-level APIs (see also
LIBBPF_BPF_TOKEN_PATH
envvar); - a bunch of struct_ops functionality added, mostly around handling multi-kernel compatibility using BPF CO-RE principles and approaches:
- support struct_ops defined in kernel modules;
- support "flavor" suffixes (
___smth
) for struct_ops types, allowing to define two incompatible definitions for the same target struct_ops kernel type; - support disabling/enabling auto-creation of struct_ops variables (maps):
SEC("?.struct_ops")
andSEC("?.struct_ops.link")
are now supported, default to not auto-create struct_ops map;bpf_map__set_autocreate()
is now honored for struct_ops maps;
- disabling auto-creation of struct_ops variable (map) disables auto-loading of related BPF programs (unless they are shared between multiple struct_ops), which means that disabling struct_ops map creation behaves naturally w.r.t. related BPF programs and doesn't require explicitly disabling them from auto-loading;
- support struct_ops "shadow type" through BPF skeleton, allowing to set/adjust custom data fields and also set/reset/change specific BPF programs implementing struct_ops' callbacks;
- BPF arena map support;
- BPF cookie support for raw tracepoint BPF programs in attach APIs;
- helpful error messages added to libbpf logs when attempting to use
struct bpf_program
orstruct bpf_map
instances there were not loaded or created, respectively; SEC("sk_skb/verdict")
support;
BPF-side features and APIs
- support global subprog argument tagging:
__arg_ctx
,__arg_nonnull
,__arg_nullable
,__arg_trusted
, and__arg_arena
annotations added;- for kprobe/uprobe, and perf_event BPF program types, support fallback logic making
__arg_ctx
work on older kernels that don't yet support__arg_ctx
(i.e.,arg:ctx
decl tag) annotation natively;
bpf_core_cast()
macro added, improving ergonomics ofbpf_rdonly_cast()
BPF helper;- support
__arena
tagged global variables, which are automatically put into BPF arena map; __long()
macro added for specifying 64-bit values when declaring BTF-defined maps;- better GCC-BPF support in BPF CO-RE macros in
bpf_core_read.h
header;
Bug fixes
- fix
faccessat()
internal usage, breaking Android versions of libbpf; - use
OPTS_SET()
inbpf_xdp_query()
for better backward/forward compatibility; - fix inner map's
max_entries
setting logic; btf_ext__raw_data()
andbtf__new_split()
APIs are added back, they were "lost" during libbpf v1.0 release process;- ignore DWARF sections in BPF linker sanity checks, improving handling of some corner cases;
- fix potential NULL dereference when handling corrupted ELF files.
Full Changelog: v1.3.0...v1.4.0