Re: [RFC][PATCH] detect & print stack overruns at oops time
- From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
- Date: Fri, 31 Aug 2007 09:32:53 -0700
On Fri, 31 Aug 2007 00:28:58 -0500 Eric Sandeen wrote:
Index: linux-2.6.22-rc4/arch/i386/mm/fault.c
===================================================================
--- linux-2.6.22-rc4.orig/arch/i386/mm/fault.c
+++ linux-2.6.22-rc4/arch/i386/mm/fault.c
@@ -543,6 +545,27 @@ no_context:
printk(KERN_ALERT "BUG: unable to handle kernel paging"
" request");
printk(" at virtual address %08lx\n",address);
+
+ overrun = (unsigned long)stackend - (unsigned long)(®s->esp);
+ if (overrun > 0) {
+ printk(KERN_ALERT "Thread overrunning stack by %d "
+ "bytes\n", overrun);
+ } else {
Hi,
Is there something that tells us what <Thread> is doing all of this
bad juju?
+#ifdef CONFIG_DEBUG_STACK_USAGE
+ int free;
+ unsigned long *n = stackend;
+ while (!*n)
+ n++;
+ free = (unsigned long)n - (unsigned long)stackend;
+ if (free)
+ printk(KERN_ALERT "Thread used within %d bytes"
+ " of stack end\n", free);
+#endif
+ /* won't catch 100% - stack may have 0s here by chance */
+ if (*stackend) /* was init'd to 0 */
+ printk(KERN_ALERT "Thread overran the stack?\n");
+ }
+
printk(KERN_ALERT " printing eip:\n");
printk("%08lx\n", regs->eip);
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [RFC][PATCH] detect & print stack overruns at oops time
- From: Eric Sandeen
- Re: [RFC][PATCH] detect & print stack overruns at oops time
- References:
- [RFC][PATCH] detect & print stack overruns at oops time
- From: Eric Sandeen
- [RFC][PATCH] detect & print stack overruns at oops time
- Prev by Date: Re: possible build system oddity
- Next by Date: Re: [PATCH] Increase lockdep MAX_LOCK_DEPTH
- Previous by thread: [RFC][PATCH] detect & print stack overruns at oops time
- Next by thread: Re: [RFC][PATCH] detect & print stack overruns at oops time
- Index(es):
Relevant Pages
|