Add minimal support for program extensions. bpf_object_open_opts() needs to be called with attach_prog_fd = target_prog_fd and BPF program extension needs to have in .c file section definition like SEC("freplace/func_to_be_replaced"). libbpf will search for "func_to_be_replaced" in the target_prog_fd's BTF and will pass it in attach_btf_id to the kernel. This approach works for tests, but more compex use case may need to request function name (and attach_btf_id that kernel sees) to be more dynamic. Such API will be added in future patches.
Showing the changes to tools/include/uapi/linux (1 of 6 files). Show all
Unified · Split
| @@ -180,6 +180,7 @@ enum bpf_prog_type { · 179 unmodified lines | |||
| 180 | BPF_PROG_TYPE_CGROUP_SOCKOPT, | 180 | BPF_PROG_TYPE_CGROUP_SOCKOPT, |
| 181 | BPF_PROG_TYPE_TRACING, | 181 | BPF_PROG_TYPE_TRACING, |
| 182 | BPF_PROG_TYPE_STRUCT_OPS, | 182 | BPF_PROG_TYPE_STRUCT_OPS, |
| 183 | BPF_PROG_TYPE_EXT, | ||
| 183 | }; | 184 | }; |
| 184 | 185 | ||
| 185 | enum bpf_attach_type { | 186 | enum bpf_attach_type { |