]> git.ipfire.org Git - thirdparty/linux.git/commit
s390/ftrace: Fix return address recovery of traced function
authorSumanth Korikkar <sumanthk@linux.ibm.com>
Mon, 24 Feb 2025 11:27:04 +0000 (12:27 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 4 Mar 2025 16:15:19 +0000 (17:15 +0100)
commitb4a1dec11793936ffe1a9fb811724532ff3b1174
tree78f7238337f87c591aac5a6bbe6dab2610e9fb0b
parenta22ee38d2efe18edc53791fd1036396c23b43ad0
s390/ftrace: Fix return address recovery of traced function

When fgraph is enabled the traced function return address is replaced with
trampoline return_to_handler(). The original return address of the traced
function is saved in per task return stack along with a stack pointer for
reliable stack unwinding via function_graph_enter_regs().

During stack unwinding e.g. for livepatching, ftrace_graph_ret_addr()
identifies the original return address of the traced function with the
saved stack pointer.

With a recent change, the stack pointers passed to ftrace_graph_ret_addr()
and function_graph_enter_regs() do not match anymore, and therefore the
original return address is not found.

Pass the correct stack pointer to function_graph_enter_regs() to fix this.

Fixes: 7495e179b478 ("s390/tracing: Enable HAVE_FTRACE_GRAPH_FUNC")
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/ftrace.c