summary refs log tree commit diff
path: root/arch/riscv
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2022-11-09 01:49:36 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-07 11:11:53 +0100
commit00777a099574ad99a07d3a6db2f62c95b420ff2e (patch)
tree0624cbfa8b6dd4c910ae7b7516a4e62b82338b8d /arch/riscv
parentcdea2da6787583ecca43594132533a2ac8d7cd21 (diff)
downloadlinux-00777a099574ad99a07d3a6db2f62c95b420ff2e.tar.gz
riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument
commit 5c3022e4a616d800cf5f4c3a981d7992179e44a1 upstream.

The 'retp' is a pointer to the return address on the stack, so we
must pass the current return address pointer as the 'retp'
argument to ftrace_push_return_trace(). Not parent function's
return address on the stack.

Fixes: b785ec129bd9 ("riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/20221109064937.3643993-2-guoren@kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/kernel/stacktrace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 08d11a53f39e..bcfe9eb55f80 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -58,7 +58,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
 		} else {
 			fp = frame->fp;
 			pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
-						   (unsigned long *)(fp - 8));
+						   &frame->ra);
 		}
 
 	}