-
Notifications
You must be signed in to change notification settings - Fork 5
x86/fgraph,bpf: Fix ORC stack unwind from return probe #6226
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
x86/fgraph,bpf: Fix ORC stack unwind from return probe #6226
Conversation
|
Upstream branch: e758657 |
4d1f3ab to
7ba9a34
Compare
|
Upstream branch: ff88079 |
3901e2c to
b3b7cc3
Compare
7ba9a34 to
2991dd5
Compare
|
Upstream branch: f9db3a3 |
b3b7cc3 to
8bfb06b
Compare
|
Upstream branch: f9db3a3 |
8bfb06b to
3394c49
Compare
2991dd5 to
583dec7
Compare
|
Upstream branch: 8842732 |
3394c49 to
ef97bb0
Compare
583dec7 to
e224139
Compare
|
Upstream branch: 23f852d |
ef97bb0 to
233de18
Compare
e224139 to
1f11231
Compare
|
Upstream branch: 54c134f |
233de18 to
2ad3a8f
Compare
1f11231 to
2563a04
Compare
|
Upstream branch: 9f317bd |
2ad3a8f to
df92b30
Compare
2563a04 to
b8a9697
Compare
|
Upstream branch: 54c134f |
df92b30 to
c34ae39
Compare
b8a9697 to
0ff1d70
Compare
|
Upstream branch: e2e668b |
c34ae39 to
52236a9
Compare
0ff1d70 to
75ba762
Compare
|
Upstream branch: d28c0e4 |
This reverts commit 83f44ae. When perf_callchain_kernel calls unwind_start with first_frame, AFAICS we do not skip regs->ip, but it's added as part of the unwind process. Hence reverting the extra perf_callchain_store for non-hw regs leg. Acked-by: Song Liu <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
Currently we don't get stack trace via ORC unwinder on top of fgraph exit
handler. We can see that when generating stacktrace from kretprobe_multi
bpf program which is based on fprobe/fgraph.
The reason is that the ORC unwind code won't get pass the return_to_handler
callback installed by fgraph return probe machinery.
Solving this by creating stack frame in return_to_handler expected by
ftrace_graph_ret_addr function to recover original return address and
continue with the unwind.
Also updating the pt_regs data with cs/flags/rsp which are needed for
successful stack retrieval from ebpf bpf_get_stackid helper.
- in get_perf_callchain we check user_mode(regs) so CS has to be set
- in perf_callchain_kernel we call perf_hw_regs(regs), so EFLAGS/FIXED
has to be unset
Note I feel like it'd be better to set those directly in return_to_handler,
but Steven suggested setting them later in kprobe_multi code path.
Signed-off-by: Jiri Olsa <[email protected]>
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Adding test that attaches kprobe/kretprobe multi and verifies the ORC stacktrace matches expected functions. It skips the test for if kernels built with frame pointer unwinder. Signed-off-by: Jiri Olsa <[email protected]>
52236a9 to
44ee531
Compare
75ba762 to
385f65b
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1016271 expired. Closing PR. |
Pull request for series with
subject: x86/fgraph,bpf: Fix ORC stack unwind from return probe
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1016271