-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: Introduce kprobe_multi session attach #6841
Conversation
Upstream branch: 735f5b8 |
3b139a8
to
0d3bd80
Compare
Upstream branch: e1a7545 |
ca68578
to
0d346af
Compare
0d3bd80
to
270ec7a
Compare
Upstream branch: a7de265 |
0d346af
to
625e1b0
Compare
60694d8
to
9620f76
Compare
Upstream branch: a7de265 |
625e1b0
to
a8014e8
Compare
9620f76
to
91e6318
Compare
Upstream branch: 6e10b63 |
a8014e8
to
396cfb6
Compare
91e6318
to
1185a20
Compare
Upstream branch: dc92feb |
396cfb6
to
b1a9151
Compare
1185a20
to
9a2e54a
Compare
Adding support to attach bpf program for entry and return probe of the same function. This is common use case which at the moment requires to create two kprobe multi links. Adding new BPF_TRACE_KPROBE_MULTI_SESSION attach type that instructs kernel to attach single link program to both entry and exit probe. It's possible to control execution of the bpf program on return probe simply by returning zero or non zero from the entry bpf program execution to execute or not the bpf program on return probe respectively. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
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> Acked-by: Andrii Nakryiko <andrii@kernel.org>
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> Acked-by: Andrii Nakryiko <andrii@kernel.org>
Adding support to attach program in kprobe multi session mode with bpf_program__attach_kprobe_multi_opts function. Adding session bool to bpf_kprobe_multi_opts struct that allows to load and attach the bpf program via kprobe multi session. the attachment to create kprobe multi session. Also adding new program loader section that allows: SEC("kprobe.session/bpf_fentry_test*") and loads/attaches kprobe program as kprobe multi session. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org>
Adding kprobe session attach type name to attach_type_name, so libbpf_bpf_attach_type_str returns proper string name for BPF_TRACE_KPROBE_MULTI_SESSION attach type. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding kprobe multi session test and testing that the entry program return value controls execution of the return probe program. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding kprobe multi session test that verifies the cookie value get properly propagated from entry to return program. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org>
Upstream branch: 55d30cc |
b1a9151
to
b236302
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=846654 expired. Closing PR. |
Pull request for series with
subject: bpf: Introduce kprobe_multi session attach
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=846654