Commit 1aabc599 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Linus Torvalds

x86: Fix dumpstack_64 to keep state of "used" variable in loop

Commit 2223f6f6 "x86: Clean up dumpstack_64.c code" moved the used
variable to a local within the loop, but the in_exception_stack()
depended on being non-volatile with the ability to change it.

By always re-initializing the "used" variable to zero, it would cause
the in_exception_stack() to return the same thing each time, and
cause the dump_stack loop to go into an infinite loop.
Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b33ce442
...@@ -115,19 +115,18 @@ enum stack_type { ...@@ -115,19 +115,18 @@ enum stack_type {
}; };
static enum stack_type static enum stack_type
analyze_stack(int cpu, struct task_struct *task, analyze_stack(int cpu, struct task_struct *task, unsigned long *stack,
unsigned long *stack, unsigned long **stack_end, char **id) unsigned long **stack_end, unsigned *used, char **id)
{ {
unsigned long *irq_stack; unsigned long *irq_stack;
unsigned long addr; unsigned long addr;
unsigned used = 0;
addr = ((unsigned long)stack & (~(THREAD_SIZE - 1))); addr = ((unsigned long)stack & (~(THREAD_SIZE - 1)));
if ((unsigned long)task_stack_page(task) == addr) if ((unsigned long)task_stack_page(task) == addr)
return STACK_IS_NORMAL; return STACK_IS_NORMAL;
*stack_end = in_exception_stack(cpu, (unsigned long)stack, *stack_end = in_exception_stack(cpu, (unsigned long)stack,
&used, id); used, id);
if (*stack_end) if (*stack_end)
return STACK_IS_EXCEPTION; return STACK_IS_EXCEPTION;
...@@ -158,6 +157,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, ...@@ -158,6 +157,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
struct thread_info *tinfo; struct thread_info *tinfo;
unsigned long *irq_stack; unsigned long *irq_stack;
unsigned long dummy; unsigned long dummy;
unsigned used = 0;
int graph = 0; int graph = 0;
int done = 0; int done = 0;
...@@ -186,7 +186,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, ...@@ -186,7 +186,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
enum stack_type stype; enum stack_type stype;
char *id; char *id;
stype = analyze_stack(cpu, task, stack, &stack_end, &id); stype = analyze_stack(cpu, task, stack, &stack_end, &used, &id);
/* Default finish unless specified to continue */ /* Default finish unless specified to continue */
done = 1; done = 1;
......
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