Re: [ANNOUNCEMENT] libbpf v1.4.0 release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 1, 2024 at 11:09 AM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> Libbpf v1.4.0 has been released ([0]).
>
> Another 4 months of libbpf development has passed.
>
> On libbpf's user space side, we added support for some brand new BPF
> features (BPF token, BPF arena maps, BPF cookies for raw tracepoints).
> A big chunk of changes happened around struct_ops usability (kernel
> module support) and handling backwards compatibility aspects using BPF
> CO-RE principles (see notes below for details). Libbpf is now also
> more helpful in its error messages when attempting to use BPF
> maps/programs that were not auto-loaded/auto-created.
>
> On BPF-side functionality, one major feature is support for annotating
> BPF global subprogram arguments, making global subprogs usable and
> useful in wider and more complicated scenarios. Helpfully, `__arg_ctx`
> (for marking passed-in context argument) functionality is supported
> even on old kernels that don't support `__arg_ctx` annotation
> natively, thanks to (transparent) libbpf-only type rewriting logic.
> This applies to kprobe/uprobe and perf_event programs, only. Other
> program types require kernel-side support, unfortunately. See all the
> `__arg_xxx` annotations added for full set of annotations supported.
>
> Among other BPF-side additions are BPF arena-mapped global variables
> support, significantly improving usability of BPF arena for
> fixed-sized data sets. And the `bpf_core_cast()` macro was added to
> make the usage of `bpf_rdonly_cast()` helper simpler in real programs.
> There were also important additions to make libbpf work better with
> the GCC-BPF compiler (mostly BPF CO-RE helpers).
>
> Last but not least, a bunch of important bug fixes were applied,
> making libbpf work better on Android systems, improving handling of
> corrupt ELF files and various other edge cases.
>
> Thanks to everyone contributing fixes, features, code reviews, as well
> as feature requests and bug reports!
>

And promised release notes inline:

## 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")` and `SEC("?.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` or `struct 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 of
`bpf_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()` in `bpf_xdp_query()` for better backward/forward
compatibility;
- fix inner map's `max_entries` setting logic;
- `btf_ext__raw_data()` and `btf__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.

>   [0] https://github.com/libbpf/libbpf/releases/tag/v1.4.0
>   [1] Full Changelog: https://github.com/libbpf/libbpf/compare/v1.3.0...v1.4.0
>
> -- Andrii





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux