mbox series

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

Message ID 20220305010129.1549719-1-andrii@kernel.org (mailing list archive)
Headers show
Series libbpf: support custom SEC() handlers | expand

Message

Andrii Nakryiko March 5, 2022, 1:01 a.m. UTC
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 <alan.maguire@oracle.com>

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

Comments

patchwork-bot+netdevbpf@kernel.org March 5, 2022, 5:50 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Fri, 4 Mar 2022 17:01:26 -0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v5,bpf-next,1/3] libbpf: allow BPF program auto-attach handlers to bail out
    https://git.kernel.org/bpf/bpf-next/c/4fa5bcfe07f7
  - [v5,bpf-next,2/3] libbpf: support custom SEC() handlers
    https://git.kernel.org/bpf/bpf-next/c/697f104db8a6
  - [v5,bpf-next,3/3] selftests/bpf: add custom SEC() handling selftest
    https://git.kernel.org/bpf/bpf-next/c/aa963bcb0adc

You are awesome, thank you!