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: Support bpf_get_func_ip helper in uprobes #5451
Conversation
Upstream branch: 1110865 |
d416eea
to
7c66af9
Compare
Upstream branch: d3c4db8 |
cc1d3fb
to
446c4f8
Compare
7c66af9
to
0144006
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=771512 expired. Closing PR. |
Upstream branch: 87dc2bb |
446c4f8
to
a5ef768
Compare
bf18480
to
1bd1b71
Compare
Upstream branch: 648880e |
a5ef768
to
1d1e82b
Compare
1bd1b71
to
a32cfa8
Compare
Upstream branch: 6f9bad6 |
1d1e82b
to
169f671
Compare
a32cfa8
to
83f304b
Compare
Upstream branch: 5964d1e |
169f671
to
1482a24
Compare
83f304b
to
5c927e8
Compare
Upstream branch: 21ce6ab |
1482a24
to
216abf4
Compare
5c927e8
to
7cd680d
Compare
7cd680d
to
f04ae7e
Compare
Upstream branch: 8a60a04 |
7a1e7eb
to
11744f2
Compare
f04ae7e
to
03311f0
Compare
Upstream branch: 5426700 |
11744f2
to
6f189b1
Compare
03311f0
to
2ac40b1
Compare
Upstream branch: dde3979 |
6f189b1
to
6d4489c
Compare
2ac40b1
to
8432e1d
Compare
Upstream branch: 09d1505 |
6d4489c
to
0a89b15
Compare
Upstream branch: 1e8e2ef |
0a89b15
to
fa217ef
Compare
8432e1d
to
53d8afa
Compare
Upstream branch: 2369e52 |
fa217ef
to
16e875d
Compare
53d8afa
to
1c4fa43
Compare
Adding support for bpf_get_func_ip helper for uprobe program to return probed address for both uprobe and return uprobe. We discussed this in [1] and agreed that uprobe can have special use of bpf_get_func_ip helper that differs from kprobe. The kprobe bpf_get_func_ip returns: - address of the function if probe is attach on function entry for both kprobe and return kprobe - 0 if the probe is not attach on function entry The uprobe bpf_get_func_ip returns: - address of the probe for both uprobe and return uprobe The reason for this semantic change is that kernel can't really tell if the probe user space address is function entry. The uprobe program is actually kprobe type program attached as uprobe. One of the consequences of this design is that uprobes do not have its own set of helpers, but share them with kprobes. As we need different functionality for bpf_get_func_ip helper for uprobe, I'm adding the bool value to the bpf_trace_run_ctx, so the helper can detect that it's executed in uprobe context and call specific code. The is_uprobe bool is set as true in bpf_prog_run_array_sleepable, which is currently used only for executing bpf programs in uprobe. Renaming bpf_prog_run_array_sleepable to bpf_prog_run_array_uprobe to address that it's only used for uprobes and that it sets the run_ctx.is_uprobe as suggested by Yafang Shao. Suggested-by: Andrii Nakryiko <andrii@kernel.org> Tested-by: Alan Maguire <alan.maguire@oracle.com> [1] https://lore.kernel.org/bpf/CAEf4BzZ=xLVkG5eurEuvLU79wAMtwho7ReR+XJAgwhFF4M-7Cg@mail.gmail.com/ Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Viktor Malik <vmalik@redhat.com> Acked-by: Yonghong Song <yonghong.song@linux.dev>
Adding get_func_ip tests for uprobe on function entry that validates that bpf_get_func_ip returns proper values from both uprobe and return uprobe. Tested-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Yonghong Song <yonghong.song@linux.dev>
Adding get_func_ip test for uprobe inside function that validates the get_func_ip helper returns correct probe address value. Tested-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Yonghong Song <yonghong.song@linux.dev>
Upstream branch: a5c0a42 |
16e875d
to
8323ae3
Compare
1c4fa43
to
aaff672
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=773552 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: Support bpf_get_func_ip helper in uprobes
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=771512