Re: Kernel stack corruption with SCSI

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Fri, 3 Jan 1997 19:21:05 +0100 (MET)


On Fri, 3 Jan 1997, Alan Cox wrote:

> Ok I did some digging and some mmap runs. Basically in some cases an mmap
> of a page on a SCSI device does indeed cause the kernel to use more than 4K
> of kernel stack and crash. I _suspect_ its only just tripping when the
> kernel stack of the process is quite dead on a page fault during the mmap as
> its not a simple run this and crash case.
>
> Anyway it is a definite 2.0.x bug. I also cannot duplicate it so far with IDE

btw, does the following debugging setup in asm/processor.h make sense:

#ifndef SLOW_BUT_SAFE_KERNEL_STACKS

#define alloc_kernel_stack() __get_free_page(GFP_KERNEL)
#define free_kernel_stack(page) free_page((page))

#else

#define alloc_kernel_stack() vmalloc(4096)
#define free_kernel_stack(page) vfree((page))

#endif

thus all kernel stacks are MMU protected and separated by a zero pte? I
havent checked this (yet), just wondering wether someone has done this
already. This is a bit safer (and the resulting fault is much more
informative).

-- mingo