aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.map
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-03-04 17:01:28 -0800
committerAlexei Starovoitov <ast@kernel.org>2022-03-05 09:38:15 -0800
commit697f104db8a6177daa5e1ffadda09c2e9285ad18 (patch)
treec6ca7380a14c8aa30b03fe8b64c7967f64b82877 /tools/lib/bpf/libbpf.map
parentlibbpf: Allow BPF program auto-attach handlers to bail out (diff)
downloadlinux-dev-697f104db8a6177daa5e1ffadda09c2e9285ad18.tar.xz
linux-dev-697f104db8a6177daa5e1ffadda09c2e9285ad18.zip
libbpf: Support custom SEC() handlers
Allow registering and unregistering custom handlers for BPF program. This allows user applications and libraries to plug into libbpf's declarative SEC() definition handling logic. This allows to offload complex and intricate custom logic into external libraries, but still provide a great user experience. One such example is USDT handling library, which has a lot of code and complexity which doesn't make sense to put into libbpf directly, but it would be really great for users to be able to specify BPF programs with something like SEC("usdt/<path-to-binary>:<usdt_provider>:<usdt_name>") and have correct BPF program type set (BPF_PROGRAM_TYPE_KPROBE, as it is uprobe) and even support BPF skeleton's auto-attach logic. In some cases, it might be even good idea to override libbpf's default handling, like for SEC("perf_event") programs. With custom library, it's possible to extend logic to support specifying perf event specification right there in SEC() definition without burdening libbpf with lots of custom logic or extra library dependecies (e.g., libpfm4). With current patch it's possible to override libbpf's SEC("perf_event") handling and specify a completely custom ones. Further, it's possible to specify a generic fallback handling for any SEC() that doesn't match any other custom or standard libbpf handlers. This allows to accommodate whatever legacy use cases there might be, if necessary. See doc comments for libbpf_register_prog_handler() and libbpf_unregister_prog_handler() for detailed semantics. This patch also bumps libbpf development version to v0.8 and adds new APIs there. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Alan Maguire <alan.maguire@oracle.com> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Link: https://lore.kernel.org/bpf/20220305010129.1549719-3-andrii@kernel.org
Diffstat (limited to 'tools/lib/bpf/libbpf.map')
-rw-r--r--tools/lib/bpf/libbpf.map6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
index 47e70c9058d9..df1b947792c8 100644
--- a/tools/lib/bpf/libbpf.map
+++ b/tools/lib/bpf/libbpf.map
@@ -439,3 +439,9 @@ LIBBPF_0.7.0 {
libbpf_probe_bpf_prog_type;
libbpf_set_memlock_rlim_max;
} LIBBPF_0.6.0;
+
+LIBBPF_0.8.0 {
+ global:
+ libbpf_register_prog_handler;
+ libbpf_unregister_prog_handler;
+} LIBBPF_0.7.0;