Skip to content

Fix libbpf's bpf_object and BPF subskel interoperability

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 Latest3 patches 2 repliesApplied 3/3

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3selftests/bpf: fix test_spin_lock_fail.c's global vars usagetools/testing/selftests/bpf/progs/test_spin_lock_fail.c+2 -20 repliesApplied
2/3libbpf: move global data mmap()'ing into bpf_object__load()tools/lib/bpf/libbpf.c+40 -432 repliesApplied
3/3selftests/bpf: validate generic bpf_object and subskel APIs work togethertools/testing/selftests/bpf/prog_tests/subskeleton.c+75 -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/3] Fix libbpf's bpf_object and BPF subskel interoperability

Fix libbpf's global data map mmap()'ing logic to make BPF objects loaded through generic bpf_object__load() API interoperable with BPF subskeleton instantiated from such BPF object. The issue is in re-mmap()'ing of global data maps after BPF object is loaded into kernel, which is currently done in BPF skeleton-specific code, and should instead be done in generic and common bpf_object_load() logic.

See patch #2 for the fix, patch #3 for the selftests. Patch #1 is preliminary fix for existing spin_lock selftests which currently works by accident.

Andrii Nakryiko (3):
selftests/bpf: fix test_spin_lock_fail.c's global vars usage
libbpf: move global data mmap()'ing into bpf_object__load() selftests/bpf: validate generic bpf_object and subskel APIs work
together

 tools/lib/bpf/libbpf.c                        | 83 +++++++++----------
 .../selftests/bpf/prog_tests/subskeleton.c    | 76 ++++++++++++++++-
 .../selftests/bpf/progs/test_spin_lock_fail.c |  4 +-
 3 files changed, 117 insertions(+), 46 deletions(-)
Signature · 1 line
2.43.5