From: Kirill Korotaev This patch fixes incorrect check for stack ptr in show_trace()->valid_stack_ptr(). When called from hardirq/softirq show_trace() prints "Stack pointer is garbage, not printing trace" message instead of call traces. Signed-Off-By: Kirill Korotaev Signed-off-by: Andrew Morton --- 25-akpm/arch/i386/kernel/irq.c | 15 +++++++++++++++ 25-akpm/arch/i386/kernel/traps.c | 15 ++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff -puN arch/i386/kernel/irq.c~fix-of-stack-dump-in-soft-hardirqs arch/i386/kernel/irq.c --- 25/arch/i386/kernel/irq.c~fix-of-stack-dump-in-soft-hardirqs Fri Oct 1 15:04:58 2004 +++ 25-akpm/arch/i386/kernel/irq.c Fri Oct 1 15:04:58 2004 @@ -189,6 +189,21 @@ atomic_t irq_err_count; atomic_t irq_mis_count; #endif +int is_irq_stack_ptr(struct task_struct *task, void *p) +{ + unsigned long off; + + off = task->thread_info->cpu * THREAD_SIZE; + if (p >= (void *)hardirq_stack + off && + p < (void *)hardirq_stack + off + THREAD_SIZE) + return 1; + if (p >= (void *)softirq_stack + off && + p < (void *)softirq_stack + off + THREAD_SIZE) + return 1; + + return 0; +} + /* * /proc/interrupts printing: */ diff -puN arch/i386/kernel/traps.c~fix-of-stack-dump-in-soft-hardirqs arch/i386/kernel/traps.c --- 25/arch/i386/kernel/traps.c~fix-of-stack-dump-in-soft-hardirqs Fri Oct 1 15:04:58 2004 +++ 25-akpm/arch/i386/kernel/traps.c Fri Oct 1 15:04:58 2004 @@ -107,11 +107,16 @@ int register_die_notifier(struct notifie static int valid_stack_ptr(struct task_struct *task, void *p) { - if (p <= (void *)task->thread_info) - return 0; - if (kstack_end(p)) - return 0; - return 1; + extern int is_irq_stack_ptr(struct task_struct *, void *); + + if (is_irq_stack_ptr(task, p)) + return 1; + if (p >= (void *)task->thread_info && + p < (void *)task->thread_info + THREAD_SIZE && + !kstack_end(p)) + return 1; + + return 0; } #ifdef CONFIG_KGDB _