Messages in this thread | | | Date | Sun, 25 Apr 1999 21:53:19 +0200 | From | Manfred Spraul <> | Subject | stack 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] | |