Re: [PATCH -tip 0/5] kprobes: Fix stacktrace in kretprobes

From: Daniel Xu
Date: Wed Mar 10 2021 - 17:47:19 EST


On Thu, Mar 11, 2021 at 12:55:09AM +0900, Masami Hiramatsu wrote:
> Hi Josh and Daniel,
<...>

> commit aa452d999b524b1851f69cc947be3e1a2f3ca1ec
> Author: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> Date: Sat Mar 6 08:34:51 2021 +0900
>
> x86/unwind/orc: Fixup kretprobe trampoline entry
>
> Since the kretprobe replaces the function return address with
> the kretprobe_trampoline on the stack, the ORC unwinder can not
> continue the stack unwinding at that point.
>
> To fix this issue, correct state->ip as like as function-graph
> tracer in the unwind_next_frame().
>
> Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
>

I applied your original patchset + Josh's patch + this patch and can
confirm it works for bpftrace + kretprobes.

Tested-by: Daniel Xu <dxu@xxxxxxxxx>