]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Add support for program extensions
authorAlexei Starovoitov <ast@kernel.org>
Tue, 21 Jan 2020 00:53:47 +0000 (16:53 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Jan 2020 22:04:53 +0000 (23:04 +0100)
commit9ed3f5ac073797075b39ec084f38df34fd2ec0b4
treead350f22004bb7f7ba18e81277e58bb64d2480f0
parentf698b77c55be581a2524f9aed0249729de77f626
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.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20200121005348.2769920-3-ast@kernel.org
tools/include/uapi/linux/bpf.h
tools/lib/bpf/bpf.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map
tools/lib/bpf/libbpf_probes.c