Skip to content

libbpf: support custom SEC() handlers

Andrii Nakryiko bpf 5 versions – 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 · linked by author and title

  1. v5 Latest3 patches 0 repliesApplied 3/3
  2. v43 patches 3 repliesSuperseded
  3. v33 patches 12 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches0 repliesSuperseded
v13 patches6 repliesSuperseded

Changes in v5 from the cover letter

- API documentation improvements (Daniel);

Patches in v5 All 3 applied

#Subject and filesSizeRepliesApplied
1/3libbpf: allow BPF program auto-attach handlers to bail outtools/lib/bpf/libbpf.c+85 -550 repliesApplied
2/3libbpf: support custom SEC() handlerstools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h tools/lib/bpf/libbpf.map +1 more+268 -530 repliesApplied
3/3selftests/bpf: add custom SEC() handling selftesttools/testing/selftests/bpf/prog_tests/custom_sec_handlers.c tools/testing/selftests/bpf/progs/test_custom_sec_handlers.c+239 -00 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAlan Maguire
1/3R-b T-b
2/3R-b T-b
3/3R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 bpf-next 0/3] libbpf: support custom SEC() handlers

Add ability for user applications and libraries to register custom BPF program SEC() handlers. See patch #2 for examples where this is useful.

Patch #1 does some preliminary refactoring to allow exponsing program init, preload, and attach callbacks as public API. It also establishes a protocol to allow optional auto-attach behavior. This will also help the case of sometimes auto-attachable uprobes.

v4->v5:
- API documentation improvements (Daniel);
v3->v4:
- init_fn -> prog_setup_fn, preload_fn -> prog_prepare_load_fn (Alexei);
v2->v3:
- moved callbacks and cookie into OPTS struct (Alan);
- added more test scenarios (Alan);
- address most of Alan's feedback, but kept API name;
v1->v2:
- resubmitting due to git send-email screw up.

Cc Alan Maguire <[email protected]>

Andrii Nakryiko (3):
libbpf: allow BPF program auto-attach handlers to bail out
libbpf: support custom SEC() handlers selftests/bpf: add custom SEC() handling selftest

 tools/lib/bpf/libbpf.c                        | 332 ++++++++++++------
 tools/lib/bpf/libbpf.h                        | 109 ++++++
 tools/lib/bpf/libbpf.map                      |   6 +
 tools/lib/bpf/libbpf_version.h                |   2 +-
 .../bpf/prog_tests/custom_sec_handlers.c      | 176 ++++++++++
 .../bpf/progs/test_custom_sec_handlers.c      |  63 ++++
 6 files changed, 586 insertions(+), 102 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/custom_sec_handlers.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_custom_sec_handlers.c
Signature · 1 line
2.30.2