bpf: Add support for kprobe session cookie
authorJiri Olsa <jolsa@kernel.org>
Tue, 30 Apr 2024 11:28:26 +0000 (13:28 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 30 Apr 2024 16:45:53 +0000 (09:45 -0700)
commit5c919acef85147886eb2abf86fb147f94680a8b0
tree045b9f1176ff8ddecdf9fe1b31f2b7e19aa4aa16
parentadf46d88ae4b2557f7e2e02547a25fb866935711
bpf: Add support for kprobe session cookie

Adding support for cookie within the session of kprobe multi
entry and return program.

The session cookie is u64 value and can be retrieved be new
kfunc bpf_session_cookie, which returns pointer to the cookie
value. The bpf program can use the pointer to store (on entry)
and load (on return) the value.

The cookie value is implemented via fprobe feature that allows
to share values between entry and return ftrace fprobe callbacks.

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-4-jolsa@kernel.org
kernel/bpf/verifier.c
kernel/trace/bpf_trace.c