Skip to content

libbpf v0.2

Compare
Choose a tag to compare
@anakryiko anakryiko released this 28 Oct 17:43
· 1570 commits to master since this release

New features/APIs:

  • full support for BPF-to-BPF function calls, no more need for __always_inline;
  • support for multiple BPF programs with the same section name;
  • support for accessing in-kernel per-CPU variables;
  • support for type and enum value CO-RE relocations;
  • libbpf will auto-adjust CO-RE direct memory loads to adjust to 32-bit host architecture;
  • BPF_PROG_BIND_MAP support, .rodata will be bound automatically if kernel supports it;
  • new APIs for programmatic generation of BTF;
  • support for big-endian and little-endian endianness in BTF;
  • perf buffer API additions allowing better integration with polling libraries (perf_buffer__buffer_cnt(), perf_buffer__buffer_fd(), perf_buffer__consume_buffer());
  • bpf_prog_test_run_opts() API;
  • bpf_program__attach_freplace() API.

New BPF program types supported:

  • sleepable fentry/fexit/fmod_ret/lsm BPF program.

BPF-side changes:

  • libbpf will automatically fall back to bpf_probe_read[_str]() if bpf_probe_read_{kernel, user}[_str]() are not supported on older kernels, so it's always safe to use bpf_probe_read_{kernel, user}[_str]() in your application and not worry about kernel version compatibility;
  • bpf_d_path() helper;
  • bpf_per_cpu_ptr() and bpf_this_cpu_ptr() helpers for working with per-CPU kernel variables;
  • bpf_copy_from_user() helper;
  • bpf_load_hdr_opt(), bpf_store_hdr_opt(), bpf_reserve_hdr_opt() helpers;
  • bpf_skb_cgroup_classid() helper;
  • bpf_redirect_neigh() and bpf_redirect_peer() helpers;
  • bpf_seq_printf_btf() and bpf_snprintf_btf() helpers;
  • __noinline convenience macro;
  • bpf_tail_call_static() wrapper.

Deprecations:

  • BPF program's "title" terminology is deprecated, please use clearer "section_name". New API bpf_program__section_name() added;
  • btf_ext__reloc_line_info() and btf_ext__reloc_func_info() (used by BCC) are deprecated.