libbpf: Allow specification of "kprobe/function+offset"
authorAlan Maguire <alan.maguire@oracle.com>
Wed, 14 Jul 2021 09:43:59 +0000 (11:43 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 16 Jul 2021 00:59:14 +0000 (17:59 -0700)
commita2488b5f483f18e6e34be2a15eb4a79f4a0d8728
treeaae9f132250a1913f42af9e93c0b4343c17f663c
parentac0ed488297a9850b0c285646b7854228368ba6b
libbpf: Allow specification of "kprobe/function+offset"

kprobes can be placed on most instructions in a function, not
just entry, and ftrace and bpftrace support the function+offset
notification for probe placement.  Adding parsing of func_name
into func+offset to bpf_program__attach_kprobe() allows the
user to specify

SEC("kprobe/bpf_fentry_test5+0x6")

...for example, and the offset can be passed to perf_event_open_probe()
to support kprobe attachment.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210714094400.396467-8-jolsa@kernel.org
tools/lib/bpf/libbpf.c