Use stricter in process stack check for unwinder Previously it would check for alignment only, which could break if the stack pointer was unaligned. Now explicitely check if the stack pointer is in the stack page of the current process. Ported from i386. Signed-off-by: Andi Kleen --- arch/x86_64/kernel/traps.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: linux/arch/x86_64/kernel/traps.c =================================================================== --- linux.orig/arch/x86_64/kernel/traps.c +++ linux/arch/x86_64/kernel/traps.c @@ -244,6 +244,12 @@ static int dump_trace_unwind(struct unwi * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack */ +static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) +{ + void *t = (void *)tinfo; + return p > t && p < t + THREAD_SIZE - 3; +} + void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, struct stacktrace_ops *ops, void *data) @@ -251,6 +257,7 @@ void dump_trace(struct task_struct *tsk, unsigned cpu = get_cpu(); unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; unsigned used = 0; + struct thread_info *tinfo; irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; @@ -371,7 +378,8 @@ void dump_trace(struct task_struct *tsk, /* * This handles the process stack: */ - HANDLE_STACK (((long) stack & (THREAD_SIZE-1)) != 0); + tinfo = current_thread_info(); + HANDLE_STACK (valid_stack_ptr(tinfo, stack)); #undef HANDLE_STACK out: put_cpu();