github libbpf/libbpf v0.6.0
libbpf v0.6

latest releases: v1.4.2, v1.4.1, v0.8.3...
2 years ago

Important updates towards Libbpf 1.0

New features and APIs:

  • support custom .rodata.* and .data.* data sections;
  • bpf_program__attach_kprobe() and bpf_program__attach_uprobe() supports older kernels now (don't forget about bpf_link__destroy() when you are done!);
  • BPF_MAP_TYPE_PROG_ARRAY can be initialized statically with syntax similar to map-in-map initialization (see 472c072 for an example);
  • libbpf-less "light" skeleton gained new capabilities and got a bunch of fixes;
  • BTF support for BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG;
  • new bpf_prog_load() and bpf_map_create() APIs supersede a whole zoo of to-be-deprecated APIs;
  • support for writable raw tracepoints (SEC("raw_tp.w/...")) added;
  • btf__add_btf() API for appending entire contents of BTF to another BTF object;
  • bpf_program__insns() and bpf_program__insn_cnt() to access underlying BPF assembly instructions; can be used for inspection or BPF program cloning.
  • a bunch of older APIs (perf_buffer__new(), btf__dedup(), btf_dump__new(), etc) were modernized to use OPTS infrastructure.

BPF-side APIs and features:

  • unstable BPF helpers (kernel function calls) support for kernel modules;
  • bpf_trace_vprintk() helper and corresponding bpf_printk() macro enhancements. Note, bpf_printk() will now attempt to use static global functions, so on very old kernels this might break existing programs. Please #define BPF_NO_GLOBAL_DATA before #include <bpf/bpf_helpers.h> if that's the case for you.
  • bpf_get_branch_snapshot() helper;
  • bpf_skc_to_unix_sock() helper;
  • bpf_find_vma() helper;
  • SEC("tc") added as a replacement for SEC("classifier").

Bug fixes and compatibility improvements:

  • libbpf now guarantees that all FDs for BPF programs, maps, BTFs, and links are strictly greater than 0, which is important for some BPF UAPIs;
  • no need to use __uint(key_size, ...) for special BPF maps (e.g., BPF_MAP_PERF_EVENT_ARRAY). Libbpf automatically downgrades __type(key, int) into key_size, if a map doesn't support BTF types for keys and values;
  • endianness fixes in BPF_CORE_READ_BITFIELD_PROBED() macro;
  • btf_dump__dump_type_data() improvements for handling unaligned data;
  • various fixes and improvements found though fuzzing and sanitizers.

Full Changelog: v0.5.0...v0.6.0

Don't miss a new libbpf release

NewReleases is sending notifications on new releases.