Re: [PATCH v2] x86/unwind/orc: unwind ftrace trampolines with correct orc
From: Steven Rostedt
Date: Fri Aug 19 2022 - 13:53:12 EST
On Fri, 19 Aug 2022 16:43:34 +0800
Chen Zhongjin <chenzhongjin@xxxxxxxxxx> wrote:
> When meeting ftrace trampolines in orc unwinding, unwinder uses address
> of ftrace_{regs_}call address to find the orc, which gets next frame at
> sp+176.
>
> If there is an irq hitting at sub $0xa8,%rsp, the next frame should be
> sp+8 instead of 176. It makes unwinder skip correct frame and throw
> warnings such as "wrong direction" or "can't access registers", etc,
> depending on the content of the wrong frame address.
>
> By adding the base address ftrace_{regs_}caller with the offset
> *ip - ops->trampoline*,
> we can get the correct address to find orc.
>
> Also change "caller" to "tramp_addr" to make variable name conform to
> its content.
>
> Fixes: 6be7fa3c74d1 ("ftrace, orc, x86: Handle ftrace dynamically allocated trampolines")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Chen Zhongjin <chenzhongjin@xxxxxxxxxx>
Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
Would someone from the tip tree care to pull this in?
-- Steve