Re: Kernel Stack

Richard B. Johnson (root@chaos.analogic.com)
Fri, 9 Apr 1999 16:20:38 -0400 (EDT)


On Fri, 9 Apr 1999, Alexander Viro wrote:

>
>
> On Fri, 9 Apr 1999, Richard B. Johnson wrote:
>
> > On Fri, 9 Apr 1999, Brian Gerst wrote:
> >
> > > Livia Catarina Soares wrote:
> > > > 1- Where is the kernel stack ??
> > > > Is it above the address "0xC0000000" in the kernel memory ??
> > >
> > > There is one kernel stack for every user process, and it is mapped in
> > > kernel memory (above PAGE_OFFSET). Note that even in an interrupt
> > > context, the kernel stack of whatever user process was running is used.
> > > ^^^^^^^^^^^^
> >
> > The kernel stack is a kernel stack. It is not associated with a
> > user process. If this was not true, a user could crash the system.
>
> Yes, it is. There is a separate stack for each process. On the context
> switch both ring 3 and ring 0 ESPs are changed. Read the source. When the
> processor goes into ring 0 it gets the correspondent kernel (== ring 0)
> stack. User *can't* crash the system that way, since user code has no
> access to the stack in question.
>

Read Brian Gerst's response. My whole point was that interrupts are
not associated with a user process, which I have shown. If the designer
decided to use a portion of some kernel element as an interrupt stack
it does not change this essential fact. The user processes` stack is
not even used for the return address of the interrupt so the user's
stack-pointer is never touched at all.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.5 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/