Skip to content

libbpf: further struct_ops fixes and improvements

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 Latest7 patches 0 repliesApplied 7/7

Patches in v1 All 7 applied

#Subject and filesSizeRepliesApplied
1/7libbpf: remove unnecessary struct_ops prog validity checktools/lib/bpf/libbpf.c+3 -100 repliesApplied
2/7libbpf: handle yet another corner case of nulling out struct_ops programtools/lib/bpf/libbpf.c+9 -10 repliesApplied
3/7selftests/bpf: add another struct_ops callback use case testtools/testing/selftests/bpf/prog_tests/test_struct_ops_module.c tools/testing/selftests/bpf/progs/struct_ops_nulled_out_cb.c+49 -00 repliesApplied
4/7libbpf: fix libbpf_strerror_r() handling unknown errorstools/lib/bpf/str_error.c+14 -20 repliesApplied
5/7libbpf: improve early detection of doomed-to-fail BPF program loadingtools/lib/bpf/libbpf.c+14 -10 repliesApplied
6/7selftests/bpf: validate struct_ops early failure detection logictools/testing/selftests/bpf/prog_tests/test_struct_ops_module.c tools/testing/selftests/bpf/progs/struct_ops_forgotten_cb.c+64 -00 repliesApplied
7/7selftests/bpf: shorten subtest names for struct_ops_module testtools/testing/selftests/bpf/prog_tests/test_struct_ops_module.c+4 -40 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/7] libbpf: further struct_ops fixes and improvements

Fix yet another case of mishandling SEC("struct_ops") programs that were nulled out programmatically through BPF skeleton by the user.

While at it, add some improvements around detecting and reporting errors, specifically a common case of declaring SEC("struct_ops") program, but forgetting to actually make use of it by setting it as a callback implementation in SEC(".struct_ops") variable (i.e., map) declaration.

A bunch of new selftests are added as well.

Andrii Nakryiko (7):
libbpf: remove unnecessary struct_ops prog validity check
libbpf: handle yet another corner case of nulling out struct_ops
program
selftests/bpf: add another struct_ops callback use case test
libbpf: fix libbpf_strerror_r() handling unknown errors
libbpf: improve early detection of doomed-to-fail BPF program loading selftests/bpf: validate struct_ops early failure detection logic selftests/bpf: shorten subtest names for struct_ops_module test

 tools/lib/bpf/libbpf.c                        | 38 ++++++---
 tools/lib/bpf/str_error.c                     | 16 +++-
 .../bpf/prog_tests/test_struct_ops_module.c   | 78 ++++++++++++++++++-
 .../bpf/progs/struct_ops_forgotten_cb.c       | 19 +++++
 .../bpf/progs/struct_ops_nulled_out_cb.c      | 22 ++++++
 5 files changed, 156 insertions(+), 17 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_forgotten_cb.c
 create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_nulled_out_cb.c
Signature · 1 line
2.43.0