diff options
author | Jiri Olsa <jolsa@redhat.com> | 2021-07-14 11:43:55 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-07-15 17:58:41 -0700 |
commit | 9b99edcae5c80c8fb9f8e7149bae528c9e610a72 (patch) | |
tree | 252a76f356e1539d453c19ed2065a3e57ed58f8f /tools/include | |
parent | 1e37392cccdea94da635e3c6d16b21865806f619 (diff) | |
download | linux-9b99edcae5c80c8fb9f8e7149bae528c9e610a72.tar.gz linux-9b99edcae5c80c8fb9f8e7149bae528c9e610a72.tar.bz2 linux-9b99edcae5c80c8fb9f8e7149bae528c9e610a72.zip |
bpf: Add bpf_get_func_ip helper for tracing programs
Adding bpf_get_func_ip helper for BPF_PROG_TYPE_TRACING programs,
specifically for all trampoline attach types.
The trampoline's caller IP address is stored in (ctx - 8) address.
so there's no reason to actually call the helper, but rather fixup
the call instruction and return [ctx - 8] value directly.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210714094400.396467-4-jolsa@kernel.org
Diffstat (limited to 'tools/include')
-rw-r--r-- | tools/include/uapi/linux/bpf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 3544ec5234f0..89688f16ad60 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -4841,6 +4841,12 @@ union bpf_attr { * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier. * **-EDEADLK** if callback_fn tried to call bpf_timer_cancel() on its * own timer which would have led to a deadlock otherwise. + * + * u64 bpf_get_func_ip(void *ctx) + * Description + * Get address of the traced function (for tracing programs). + * Return + * Address of the traced function. */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ @@ -5016,6 +5022,7 @@ union bpf_attr { FN(timer_set_callback), \ FN(timer_start), \ FN(timer_cancel), \ + FN(get_func_ip), \ /* */ /* integer value in 'imm' field of BPF_CALL instruction selects which helper |