Skip to content

Commit cec8d0e

Browse files
committed
sh: ftrace: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack
The structure of the ret_stack array on the task struct is going to change, and accessing it directly via the curr_ret_stack index will no longer give the ret_stack entry that holds the return address. To access that, architectures must now use ftrace_graph_get_ret_stack() to get the associated ret_stack that matches the saved return address. Cc: linux-sh@vger.kernel.org Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Rich Felker <dalias@libc.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 945626d commit cec8d0e

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎arch/sh/kernel/dumpstack.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,20 @@ print_ftrace_graph_addr(unsigned long addr, void *data,
5959
struct thread_info *tinfo, int *graph)
6060
{
6161
struct task_struct *task = tinfo->task;
62+
struct ftrace_ret_stack *ret_stack;
6263
unsigned long ret_addr;
63-
int index = task->curr_ret_stack;
6464

6565
if (addr != (unsigned long)return_to_handler)
6666
return;
6767

68-
if (!task->ret_stack || index < *graph)
68+
if (!task->ret_stack)
6969
return;
7070

71-
index -= *graph;
72-
ret_addr = task->ret_stack[index].ret;
71+
ret_stack = ftrace_graph_get_ret_stack(task, *graph);
72+
if (!ret_stack)
73+
return;
74+
75+
ret_addr = ret_stack->ret;
7376

7477
ops->address(data, ret_addr, 1);
7578

‎arch/sh/kernel/dwarf.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,17 +608,18 @@ struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
608608
* expected to find the real return address.
609609
*/
610610
if (pc == (unsigned long)&return_to_handler) {
611-
int index = current->curr_ret_stack;
611+
struct ftrace_ret_stack *ret_stack;
612612

613+
ret_stack = ftrace_graph_get_ret_stack(current, 0);
614+
if (ret_stack)
615+
pc = ret_stack->ret;
613616
/*
614617
* We currently have no way of tracking how many
615618
* return_to_handler()'s we've seen. If there is more
616619
* than one patched return address on our stack,
617620
* complain loudly.
618621
*/
619-
WARN_ON(index > 0);
620-
621-
pc = current->ret_stack[index].ret;
622+
WARN_ON(ftrace_graph_get_ret_stack(current, 1);
622623
}
623624
#endif
624625

0 commit comments

Comments
 (0)