bpf: Add support for kprobe session context
authorJiri Olsa <jolsa@kernel.org>
Tue, 30 Apr 2024 11:28:25 +0000 (13:28 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 30 Apr 2024 16:45:53 +0000 (09:45 -0700)
commitadf46d88ae4b2557f7e2e02547a25fb866935711
treeaa4dd40c1ba688087885a2d0374c790aad2b23ac
parent535a3692ba7245792e6f23654507865d4293c850
bpf: Add support for kprobe session context

Adding struct bpf_session_run_ctx object to hold session related
data, which is atm is_return bool and data pointer coming in
following changes.

Placing bpf_session_run_ctx layer in between bpf_run_ctx and
bpf_kprobe_multi_run_ctx so the session data can be retrieved
regardless of if it's kprobe_multi or uprobe_multi link, which
support is coming in future. This way both kprobe_multi and
uprobe_multi can use same kfuncs to access the session data.

Adding bpf_session_is_return kfunc that returns true if the
bpf program is executed from the exit probe of the kprobe multi
link attached in wrapper mode. It returns false otherwise.

Adding new kprobe hook for kprobe program type.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240430112830.1184228-3-jolsa@kernel.org
kernel/bpf/btf.c
kernel/trace/bpf_trace.c