Skip to content

Commit c060f93

Browse files
puranjaymohanctmarinas
authored andcommitted
arm64: stacktrace: fix the usage of ftrace_graph_ret_addr()
ftrace_graph_ret_addr() takes an 'idx' integer pointer that is used to optimize the stack unwinding process. arm64 currently passes `NULL` for this parameter which stops it from utilizing these optimizations. Further, the current code for ftrace_graph_ret_addr() will just return the passed in return address if it is NULL which will break this usage. Pass a valid integer pointer to ftrace_graph_ret_addr() similar to x86_64's stack unwinder. Signed-off-by: Puranjay Mohan <[email protected]> Fixes: 29c1c24 ("function_graph: Fix up ftrace_graph_ret_addr()") Acked-by: Steven Rostedt (Google) <[email protected]> Acked-by: Will Deacon <[email protected]> Reviewed-by: Mark Rutland <[email protected]> Tested-by: Mark Rutland <[email protected]> Reviewed-by: Steven Rostedt (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 75c8f38 commit c060f93

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/arm64/kernel/stacktrace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
*
2626
* @common: Common unwind state.
2727
* @task: The task being unwound.
28+
* @graph_idx: Used by ftrace_graph_ret_addr() for optimized stack unwinding.
2829
* @kr_cur: When KRETPROBES is selected, holds the kretprobe instance
2930
* associated with the most recently encountered replacement lr
3031
* value.
3132
*/
3233
struct kunwind_state {
3334
struct unwind_state common;
3435
struct task_struct *task;
36+
int graph_idx;
3537
#ifdef CONFIG_KRETPROBES
3638
struct llist_node *kr_cur;
3739
#endif
@@ -106,7 +108,7 @@ kunwind_recover_return_address(struct kunwind_state *state)
106108
if (state->task->ret_stack &&
107109
(state->common.pc == (unsigned long)return_to_handler)) {
108110
unsigned long orig_pc;
109-
orig_pc = ftrace_graph_ret_addr(state->task, NULL,
111+
orig_pc = ftrace_graph_ret_addr(state->task, &state->graph_idx,
110112
state->common.pc,
111113
(void *)state->common.fp);
112114
if (WARN_ON_ONCE(state->common.pc == orig_pc))

0 commit comments

Comments
 (0)