lkml.org 
[lkml]   [1999]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectstack overruns [was: Re: "Please HELP"-crash]
Alan Cox wrote:
>
> I hadn't considered a stack overrun - that would make a lot more sense than
> my ideas so far

What do you think about modifying the way the kernel stack is allocated
(That's something for 2.3).

1) at system startup one huge block (16 kB per task slot, (8 kB stack +
8 kB guard pages)) is vm_alloc'ed. The area must be 8 kB aligned.
2) if a task is created, then 2 single pages get allocated,
and inserted into the vm_alloc'ed area.
3) the task_struct is moved to the end of the stack.
(Windows 95 does it this way around)

This creates no synchronization problem, because the stack location
for every task is defined during system startup.
It solves the problem that we need 2 consecutive pages if we create
a new task.
If we have a stack overrun, then we will hit the guard page,
--> stack fault --> TSS --> Oops without any memory trashing.

I've also attached a small patch against 2.2.6 that add a
detection code for stack overruns. I think something like this
should go into the main kernel.

Regards,
Manfred[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.053 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site