Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S267798AbUJDIRT (ORCPT ); Mon, 4 Oct 2004 04:17:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S267806AbUJDIQZ (ORCPT ); Mon, 4 Oct 2004 04:16:25 -0400 Received: from mail.tv-sign.ru ([213.234.233.51]:35553 "EHLO several.ru") by vger.kernel.org with ESMTP id S267793AbUJDIPo (ORCPT ); Mon, 4 Oct 2004 04:15:44 -0400 Message-ID: <41610847.78087781@tv-sign.ru> Date: Mon, 04 Oct 2004 12:22:31 +0400 From: Oleg Nesterov X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Morton Cc: linux-kernel@vger.kernel.org, dev@sw.ru, torvalds@osdl.org Subject: Re: [PATCH] alternate stack dump fix. References: <41602238.A828A852@tv-sign.ru> <20041003100603.6429acdd.akpm@osdl.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3177 Lines: 112 Oleg Nesterov wrote: > > > Andrew Morton wrote: > > > > But it conflicts in a big way with Kirill's patch. Could you redo it > > against 2.6.9-rc3-mm1, or against just > > For your convenience, i will post the same patch against mm tree with those > 3 patches reverted in a separate message. Against 2.6.9-rc3-mm1 + -R fix-of-stack-dump-in-soft-hardirqs-build-fix.patch + -R fix-of-stack-dump-in-soft-hardirqs-cleanup.patch + -R fix-of-stack-dump-in-soft-hardirqs.patch Oleg. Signed-off-by: Oleg Nesterov --- rc3-mm1/arch/i386/kernel/traps.c~ Mon Oct 4 10:46:10 2004 +++ rc3-mm1/arch/i386/kernel/traps.c Mon Oct 4 10:56:22 2004 @@ -105,15 +105,6 @@ int register_die_notifier(struct notifie return err; } -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; -} - #ifdef CONFIG_KGDB extern void sysenter_past_esp(void); #include @@ -147,28 +138,27 @@ void breakpoint(void) #define CHK_REMOTE_DEBUG(trapnr,signr,error_code,regs,after) #endif +static int valid_stack_ptr(struct thread_info *tinfo, void *p) +{ + return p > (void *)tinfo && + p < (void *)tinfo + THREAD_SIZE - 3; +} -#ifdef CONFIG_FRAME_POINTER -static void print_context_stack(struct task_struct *task, unsigned long *stack, +static unsigned long print_context_stack(struct thread_info *tinfo, unsigned long *stack, unsigned long ebp) { unsigned long addr; - while (valid_stack_ptr(task, (void *)ebp)) { +#ifdef CONFIG_FRAME_POINTER + while (valid_stack_ptr(tinfo, (void *)ebp)) { addr = *(unsigned long *)(ebp + 4); printk(" [<%08lx>] ", addr); print_symbol("%s", addr); printk("\n"); ebp = *(unsigned long *)ebp; } -} #else -static void print_context_stack(struct task_struct *task, unsigned long *stack, - unsigned long ebp) -{ - unsigned long addr; - - while (!kstack_end(stack)) { + while (valid_stack_ptr(tinfo, stack)) { addr = *stack++; if (__kernel_text_address(addr)) { printk(" [<%08lx>]", addr); @@ -176,8 +166,9 @@ static void print_context_stack(struct t printk("\n"); } } -} #endif + return ebp; +} void show_trace(struct task_struct *task, unsigned long * stack) { @@ -186,11 +177,6 @@ void show_trace(struct task_struct *task if (!task) task = current; - if (!valid_stack_ptr(task, stack)) { - printk("Stack pointer is garbage, not printing trace\n"); - return; - } - if (task == current) { /* Grab ebp right from our regs */ asm ("movl %%ebp, %0" : "=r" (ebp) : ); @@ -203,7 +189,7 @@ void show_trace(struct task_struct *task struct thread_info *context; context = (struct thread_info *) ((unsigned long)stack & (~(THREAD_SIZE - 1))); - print_context_stack(task, stack, ebp); + ebp = print_context_stack(context, stack, ebp); stack = (unsigned long*)context->previous_esp; if (!stack) break; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/