From: Andrii Nakryiko Date: Tue, 30 Apr 2024 16:45:54 +0000 (-0700) Subject: Merge branch 'bpf-introduce-kprobe_multi-session-attach' X-Git-Tag: microblaze-v6.13~1163^2~13^2~43 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=06ebfd11678ad63cfd7021580e13d1582ee6c782;p=linux-2.6-microblaze.git Merge branch 'bpf-introduce-kprobe_multi-session-attach' Jiri Olsa says: ==================== bpf: Introduce kprobe_multi session attach hi, adding support to attach kprobe program through kprobe_multi link in a session mode, which means: - program is attached to both function entry and return - entry program can decided if the return program gets executed - entry program can share u64 cookie value with return program The initial RFC for this was posted in [0] and later discussed more and which ended up with the session idea [1] Having entry together with return probe for given function is common use case for tetragon, bpftrace and most likely for others. At the moment if we want both entry and return probe to execute bpf program we need to create two (entry and return probe) links. The link for return probe creates extra entry probe to setup the return probe. The extra entry probe execution could be omitted if we had a way to use just single link for both entry and exit probe. In addition the possibility to control the return program execution and sharing data within entry and return probe allows for other use cases. v2 changes: - renamed BPF_TRACE_KPROBE_MULTI_SESSION to BPF_TRACE_KPROBE_SESSION [Andrii] - use arrays for results in selftest [Andrii] - various small selftests and libbpf changes [Andrii] - moved the verifier cookie setup earlier in check_kfunc_call [Andrii] - added acks Also available at: https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/session_data thanks, jirka [0] https://lore.kernel.org/bpf/20240207153550.856536-1-jolsa@kernel.org/ [1] https://lore.kernel.org/bpf/20240228090242.4040210-1-jolsa@kernel.org/ --- ==================== Link: https://lore.kernel.org/r/20240430112830.1184228-1-jolsa@kernel.org Signed-off-by: Andrii Nakryiko --- 06ebfd11678ad63cfd7021580e13d1582ee6c782