Commit 9135c3cc authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

powerpc/ftrace: show real return addresses in modules

When the function graph tracer is enabled, it replaces the return address
with a hook back to the tracer. This makes back traces see the hook instead
of the actual return address.

The current code also shows the real address by checking if the return
address jumps to the return_to_handler. If it is, is also prints out
the saved real return address.

On powerpc64, some modules may return to mod_return_to_handler, which
is not checked. This patch will also show the real address if a return
is to mod_return_to_handler as well.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 80f50691
...@@ -1016,9 +1016,13 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) ...@@ -1016,9 +1016,13 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
int curr_frame = current->curr_ret_stack; int curr_frame = current->curr_ret_stack;
extern void return_to_handler(void); extern void return_to_handler(void);
unsigned long addr = (unsigned long)return_to_handler; unsigned long rth = (unsigned long)return_to_handler;
unsigned long mrth = -1;
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
addr = *(unsigned long*)addr; extern void mod_return_to_handler(void);
rth = *(unsigned long *)rth;
mrth = (unsigned long)mod_return_to_handler;
mrth = *(unsigned long *)mrth;
#endif #endif
#endif #endif
...@@ -1044,7 +1048,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) ...@@ -1044,7 +1048,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
if (!firstframe || ip != lr) { if (!firstframe || ip != lr) {
printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
if (ip == addr && curr_frame >= 0) { if ((ip == rth || ip == mrth) && curr_frame >= 0) {
printk(" (%pS)", printk(" (%pS)",
(void *)current->ret_stack[curr_frame].ret); (void *)current->ret_stack[curr_frame].ret);
curr_frame--; curr_frame--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment