diff options
author | Hugh Dickins <hughd@google.com> | 2012-03-23 17:02:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-03-24 03:15:04 -0400 |
commit | 65c0ff4079c011232e795e62c74a0a95512b7ac3 (patch) | |
tree | f578bc91f8e241c23b068bec2ecd0f58b0a322fb | |
parent | 4da7072ad6831a35a11341097ce477e18651bedd (diff) |
x86: Stop recursive fault in print_context_stack after stack overflow
After printing out the first line of a stack backtrace,
print_context_stack() calls print_ftrace_graph_addr() to check
if it's making a graph of function calls, usually not the case.
But unfortunate ordering of assignments causes this to oops if
an earlier stack overflow corrupted threadinfo->task. Reorder
to avoid that irritation.
( The fact that there was a stack overflow may often be more
interesting than the stack that can now be shown; but
integrating that information with this stacktrace is awkward,
so leave it to overflow reporting. )
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20120323225648.15DD5A033B@akpm.mtv.corp.google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/dumpstack.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 4025fe4f928f..90bf130f09bc 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
@@ -37,13 +37,16 @@ print_ftrace_graph_addr(unsigned long addr, void *data, | |||
37 | const struct stacktrace_ops *ops, | 37 | const struct stacktrace_ops *ops, |
38 | struct thread_info *tinfo, int *graph) | 38 | struct thread_info *tinfo, int *graph) |
39 | { | 39 | { |
40 | struct task_struct *task = tinfo->task; | 40 | struct task_struct *task; |
41 | unsigned long ret_addr; | 41 | unsigned long ret_addr; |
42 | int index = task->curr_ret_stack; | 42 | int index; |
43 | 43 | ||
44 | if (addr != (unsigned long)return_to_handler) | 44 | if (addr != (unsigned long)return_to_handler) |
45 | return; | 45 | return; |
46 | 46 | ||
47 | task = tinfo->task; | ||
48 | index = task->curr_ret_stack; | ||
49 | |||
47 | if (!task->ret_stack || index < *graph) | 50 | if (!task->ret_stack || index < *graph) |
48 | return; | 51 | return; |
49 | 52 | ||