aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-12-07 13:06:04 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-12-22 08:21:02 -0500
commitcec8d0e7f06e08b981e9d61bef267c8c36d536f5 (patch)
tree3d1a3e31f78f06c9b3143dff18b4d53e1878b82b
parent945626db0961d8388543b2c96b6f16df57947392 (diff)
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>
-rw-r--r--arch/sh/kernel/dumpstack.c11
-rw-r--r--arch/sh/kernel/dwarf.c9
2 files changed, 12 insertions, 8 deletions
diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index b564b1eae4ae..2c2e151bf39e 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -59,17 +59,20 @@ print_ftrace_graph_addr(unsigned long addr, void *data,
59 struct thread_info *tinfo, int *graph) 59 struct thread_info *tinfo, int *graph)
60{ 60{
61 struct task_struct *task = tinfo->task; 61 struct task_struct *task = tinfo->task;
62 struct ftrace_ret_stack *ret_stack;
62 unsigned long ret_addr; 63 unsigned long ret_addr;
63 int index = task->curr_ret_stack;
64 64
65 if (addr != (unsigned long)return_to_handler) 65 if (addr != (unsigned long)return_to_handler)
66 return; 66 return;
67 67
68 if (!task->ret_stack || index < *graph) 68 if (!task->ret_stack)
69 return; 69 return;
70 70
71 index -= *graph; 71 ret_stack = ftrace_graph_get_ret_stack(task, *graph);
72 ret_addr = task->ret_stack[index].ret; 72 if (!ret_stack)
73 return;
74
75 ret_addr = ret_stack->ret;
73 76
74 ops->address(data, ret_addr, 1); 77 ops->address(data, ret_addr, 1);
75 78
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index bb511e2d9d68..df0fd6efe758 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -608,17 +608,18 @@ struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
608 * expected to find the real return address. 608 * expected to find the real return address.
609 */ 609 */
610 if (pc == (unsigned long)&return_to_handler) { 610 if (pc == (unsigned long)&return_to_handler) {
611 int index = current->curr_ret_stack; 611 struct ftrace_ret_stack *ret_stack;
612 612
613 ret_stack = ftrace_graph_get_ret_stack(current, 0);
614 if (ret_stack)
615 pc = ret_stack->ret;
613 /* 616 /*
614 * We currently have no way of tracking how many 617 * We currently have no way of tracking how many
615 * return_to_handler()'s we've seen. If there is more 618 * return_to_handler()'s we've seen. If there is more
616 * than one patched return address on our stack, 619 * than one patched return address on our stack,
617 * complain loudly. 620 * complain loudly.
618 */ 621 */
619 WARN_ON(index > 0); 622 WARN_ON(ftrace_graph_get_ret_stack(current, 1);
620
621 pc = current->ret_stack[index].ret;
622 } 623 }
623#endif 624#endif
624 625