History

libbpf: Add support for program extensions

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.

Alexei Starovoitov committed 6 years ago

Commit 2db6eab1 parent be8704f6 files · +18 −4Browse files

Showing the changes to tools/include/uapi/linux (1 of 6 files). Show all

Unified · Split

tools/include/uapi/linux/bpf.h+1−0
@@ -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
185enum bpf_attach_type {186enum bpf_attach_type {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t