diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2021-10-21 09:55:35 +0900 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2021-10-22 12:16:53 -0400 |
commit | fed240d9c9743815fcbc0ca5c0913292ce1f25e2 (patch) | |
tree | 332b5002123a3db9bd9b6bc9a5f0144f008374eb /arch/arm/kernel/return_address.c | |
parent | 7e9bf33b812471ee57a03ec7f9b544ca437cc706 (diff) | |
download | linux-stable-fed240d9c9743815fcbc0ca5c0913292ce1f25e2.tar.gz linux-stable-fed240d9c9743815fcbc0ca5c0913292ce1f25e2.tar.bz2 linux-stable-fed240d9c9743815fcbc0ca5c0913292ce1f25e2.zip |
ARM: Recover kretprobe modified return address in stacktrace
Since the kretprobe replaces the function return address with
the kretprobe_trampoline on the stack, arm unwinder shows it
instead of the correct return address.
This finds the correct return address from the per-task
kretprobe_instances list and verify it is in between the
caller fp and callee fp.
Note that this supports both GCC and clang if CONFIG_FRAME_POINTER=y
and CONFIG_ARM_UNWIND=n. For the ARM unwinder, this is still
not working correctly.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'arch/arm/kernel/return_address.c')
-rw-r--r-- | arch/arm/kernel/return_address.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c index 7b42ac010fdf..00c11579406c 100644 --- a/arch/arm/kernel/return_address.c +++ b/arch/arm/kernel/return_address.c @@ -42,6 +42,10 @@ void *return_address(unsigned int level) frame.sp = current_stack_pointer; frame.lr = (unsigned long)__builtin_return_address(0); frame.pc = (unsigned long)return_address; +#ifdef CONFIG_KRETPROBES + frame.kr_cur = NULL; + frame.tsk = current; +#endif walk_stackframe(&frame, save_return_addr, &data); |