lkml.org 
[lkml]   [2008]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] use canary at end of stack to indicate overruns at oops time
Ingo Molnar wrote:
> * Eric Sandeen <sandeen@redhat.com> wrote:

>> With the code in place, an intentionally-bloated stack oops does:
>>
>> BUG: unable to handle kernel paging request at ffff8103f84cc680
>> IP: [<ffffffff810253df>] update_curr+0x9a/0xa8
>> PGD 8063 PUD 0
>> Thread overran stack or stack corrupted
>> Oops: 0000 [1] SMP
>> CPU 0
>> ...
>
> excellent. I've queued this up, it's definitely an improvement in
> debuggability.

Crud, just realized this probably doesn't play well with
CONFIG_DEBUG_STACK_USAGE. I think it will need something like:

Index: linux-2.6.25-rc7/kernel/exit.c
===================================================================
--- linux-2.6.25-rc7.orig/kernel/exit.c 2008-04-20 22:34:16.000000000 -0500
+++ linux-2.6.25-rc7/kernel/exit.c 2008-04-22 11:38:05.769412824 -0500
@@ -826,6 +826,8 @@ static void check_stack_usage(void)
unsigned long *n = end_of_stack(current);
unsigned long free;

+ n++; /* skip over canary at end */
+
while (*n == 0)
n++;
free = (unsigned long)n - (unsigned long)end_of_stack(current);

Testing now... want me to resend the whole patch, Ingo, or you want to
just fix it up? (I'll follow up with the testing results)

Thanks,
-Eric


\
 
 \ /
  Last update: 2008-04-22 18:47    [W:0.328 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site