]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Recover kretprobe modified return address in stacktrace
authorMasami Hiramatsu <mhiramat@kernel.org>
Thu, 21 Oct 2021 00:55:09 +0000 (09:55 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 22 Oct 2021 16:16:53 +0000 (12:16 -0400)
commit628c9797f9508ef96bf3f04b9a7b24dfcae2af36
tree3be8beecf0c48ccece7a6f36a2c10ca19117753a
parent0f33b7094e7c3de41f2efad3554eb5cb88c98a55
arm64: Recover kretprobe modified return address in stacktrace

Since the kretprobe replaces the function return address with
the kretprobe_trampoline on the stack, stack unwinder shows it
instead of the correct return address.

This checks whether the next return address is the
__kretprobe_trampoline(), and if so, try to find the correct
return address from the kretprobe instance list. For this purpose
this adds 'kr_cur' loop cursor to memorize the current kretprobe
instance.

With this fix, now arm64 can enable
CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE, and pass the
kprobe self tests.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
arch/arm64/Kconfig
arch/arm64/include/asm/stacktrace.h
arch/arm64/kernel/stacktrace.c