Loading
arm64: Recover kretprobe modified return address in stacktrace
mainline inclusion from mainline-v5.16-rc1 commit cd9bc2c9 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9R2TB Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd9bc2c9258816dc934b300705076519d7375b81 ------------------------------------------------------ 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> Conflicts: arch/arm64/Kconfig arch/arm64/include/asm/stacktrace.h arch/arm64/kernel/stacktrace.c [Adapt for calling kretprobe_find_ret_addr()] Signed-off-by:
Zheng Yejian <zhengyejian1@huawei.com>