Skip to content

libbpf: allow to opt-out from BPF map creation

Andrii Nakryiko bpf 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesApplied 4/4

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4libbpf: append "..." in fixed up log if CO-RE spec is truncatedtools/lib/bpf/libbpf.c+4 -40 repliesApplied
2/4libbpf: use libbpf_mem_ensure() when allocating new maptools/lib/bpf/libbpf.c+10 -270 repliesApplied
3/4libbpf: allow to opt-out from creating BPF mapstools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h tools/lib/bpf/libbpf.map+133 -170 repliesApplied
4/4selftests/bpf: test bpf_map__set_autocreate() and related log fixup logictools/testing/selftests/bpf/prog_tests/log_fixup.c tools/testing/selftests/bpf/progs/test_log_fixup.c+62 -10 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/4] libbpf: allow to opt-out from BPF map creation

Add bpf_map__set_autocreate() API which is a BPF map counterpart of bpf_program__set_autoload() and serves similar goal of allowing to build more flexible CO-RE applications. See patch #3 for example scenarios in which the need for such API came up previously.

Patch #1 is a follow-up patch to previous patch set adding verifier log fixup logic, making sure bpf_core_format_spec()'s return result is used for something useful.

Patch #2 is a small refactoring to avoid unnecessary verbose memory management around obj->maps array.

Patch #3 adds and API and corresponding BPF verifier log fix up logic to provide human-comprehensible error message with useful details.

Patch #4 adds a simple selftest validating both the API itself and libbpf's log fixup logic for it.

Andrii Nakryiko (4):
libbpf: append "..." in fixed up log if CO-RE spec is truncated
libbpf: use libbpf_mem_ensure() when allocating new map
libbpf: allow to opt-out from creating BPF maps selftests/bpf: test bpf_map__set_autocreate() and related log fixup
logic

 tools/lib/bpf/libbpf.c                        | 169 +++++++++++++-----
 tools/lib/bpf/libbpf.h                        |  22 +++
 tools/lib/bpf/libbpf.map                      |   4 +-
 .../selftests/bpf/prog_tests/log_fixup.c      |  37 +++-
 .../selftests/bpf/progs/test_log_fixup.c      |  26 +++
 5 files changed, 209 insertions(+), 49 deletions(-)
Signature · 1 line
2.30.2