On Tue, 2006-06-20 at 06:53 -0400, Elad Lahav wrote: > Hi Arjan, > > Thanks for your reply. See below. > > Arjan van de Ven wrote: > > On Mon, 2006-06-19 at 16:18 -0400, Elad Lahav wrote: > >> Security considerations set aside, is it possible to run kernel code > >> with a user-supplied stack? > > > > not really; just think of what happens when that stack page ends up > > residing in swap... where do you get the stack space from to swap the > > page back in ? ;-) > Can't you lock the supplied memory region in main memory? how is it different from kernel memory at that point? ;) > > >> I would like to use the stack of the current process to execute a system > >> call, in order to bypass the 4K kernel stack-size restriction > > > > how would a user supplied stack fix that? (hint: even if you user-supply > > it it'll still be 4Kb in size ;=) > Is this limit enforced by the kernel? I thought it only had to do with > the amount of space allocated by the kernel for its stack. the stack size is actually used in many places, there is "special" data stored at the end of the stack that is used from all over the place (for example, "current" comes from there), and the way you find it is by knowing the stack size (4Kb or 8kb) and doing bitmasks on the stack pointer to calculate the top of the stack. Even if the actual memory is bigger than 4Kb/8Kb, this is still an issue ;) Another "fun" issue is that the kernel tends to expect you can do dma from the stack. if you cross the page boundary, and the 2 pages aren't consecutive in physical memory, that is a big problem.... because your DMA would need to be split which you can't really. This is also why doing 8Kb (or bigger) stacks in the kernel is painful, they have to by physically contiguous, so all the VM fragmentation issues come into full force. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/