Re: Why two stacks per process?

2008-04-27 Thread Peter Teoh
Robert P. J. Day wrote: On Fri, 25 Apr 2008, Peter Teoh wrote: In general, user cannot see kernel memory, but kernel can see user memory. To enforce this, all memory are not to be shared. And this is also enforce at the x86 hardware level - no OS feature is needed (ie, windows/l

Re: Why two stacks per process?

2008-04-24 Thread Peter Teoh
Correct me if wrong, according to my aging memory, the Intel x86 architecture actually have individual stack for each ring. So ring0,1,2,3 everyone have one ring. Normal OS only uses 0 and 3, but VMWare uses an additional ring1, and XEN HVM uses ring "-1", for its hypervisor implementation.

Re: Why two stacks per process?

2008-04-24 Thread Bernd Petrovitsch
On Don, 2008-04-24 at 18:52 +0200, Michael Blizek wrote: > On 17:49 Thu 24 Apr , Bernd Petrovitsch wrote: > > On Don, 2008-04-24 at 17:08 +0200, Michael Blizek wrote: > > > It is not just cleaning the stack up. You have to make sure that no other > > > thread in the userspace accesses it. This

Re: Why two stacks per process?

2008-04-24 Thread Robert P. J. Day
On Fri, 25 Apr 2008, Peter Teoh wrote: > In general, user cannot see kernel memory, but kernel can see user > memory. To enforce this, all memory are not to be shared. And this > is also enforce at the x86 hardware level - no OS feature is needed > (ie, windows/linux all worked in the same way).

Re: Why two stacks per process?

2008-04-24 Thread Patrick McManus
On Fri, 2008-04-25 at 00:54 +0800, Peter Teoh wrote: > this violate the first principle mentioned above.the current CPU > may be processing in kernel mode, but another CPU may be processing in > userspace mode, same process, and as all the userspace memory are > visible to him, he can view the

Re: Why two stacks per process?

2008-04-24 Thread Michael Blizek
On 17:49 Thu 24 Apr , Bernd Petrovitsch wrote: > On Don, 2008-04-24 at 17:08 +0200, Michael Blizek wrote: > > It is not just cleaning the stack up. You have to make sure that no other > > thread in the userspace accesses it. This means you have to unmap it first. > > Uuugh, that looks like a q

Re: Why two stacks per process?

2008-04-24 Thread Patrick McManus
On Thu, 2008-04-24 at 21:09 +0530, sahlot arvind wrote: > I feel there are two stacks for security reasons but I dont know what > they are precisely. there are both read and write security questions.. on the read side you're concerned about data you leave behind (or the cost of zeroing it) - reme

Re: Why two stacks per process?

2008-04-24 Thread Peter Teoh
In general, user cannot see kernel memory, but kernel can see user memory. To enforce this, all memory are not to be shared. And this is also enforce at the x86 hardware level - no OS feature is needed (ie, windows/linux all worked in the same way)the keyword to search is called "stack swit

Re: Why two stacks per process?

2008-04-24 Thread Bernd Petrovitsch
On Don, 2008-04-24 at 17:08 +0200, Michael Blizek wrote: > Hi! > > On 14:41 Thu 24 Apr , sahlot arvind wrote: > > Why do we have two stacks per process i.e. one user mode and other kernel > > mode? > > As soon as process enters into kernel mode it starts using kernel mode > > stack, but as soo

Re: Why two stacks per process?

2008-04-24 Thread sahlot arvind
>pre-process "thread_info" structure at the bottom of the >kernel stack. >in short, that per-process stack has to exist the whole time >the >process does, since it's actually keeping track of some >process >information. you couldn't do that if you just used the >user-space stack. Why could not we

Re: Why two stacks per process?

2008-04-24 Thread Patrick McManus
On Thu, 2008-04-24 at 09:35 -0400, Robert P. J. Day wrote: > On Thu, 24 Apr 2008, sahlot arvind wrote: > > > Yes. I agree with Robert. There are two stacks per process. But why > > cannot we just use one stack as I said earlier? > > while there may be other reasons, there's one obvious one -- as

Re: Why two stacks per process?

2008-04-24 Thread Michael Blizek
Hi! On 14:41 Thu 24 Apr , sahlot arvind wrote: > Why do we have two stacks per process i.e. one user mode and other kernel > mode? > As soon as process enters into kernel mode it starts using kernel mode > stack, but as soon as it comes out of kernel mode stack there is nothing in > the kernel

Re: Why two stacks per process?

2008-04-24 Thread Robert P. J. Day
On Thu, 24 Apr 2008, sahlot arvind wrote: > Yes. I agree with Robert. There are two stacks per process. But why > cannot we just use one stack as I said earlier? while there may be other reasons, there's one obvious one -- as i mentioned in my earlier email, the kernel likes to store a small, pre

Re: Why two stacks per process?

2008-04-24 Thread sahlot arvind
Yes. I agree with Robert. There are two stacks per process. But why cannot we just use one stack as I said earlier? - A On 4/24/08, Robert P. J. Day <[EMAIL PROTECTED]> wrote: > > On Thu, 24 Apr 2008, dinesh bansal wrote: > > > AFAIK there is only one kernel stack and all the processes share > >

Re: Why two stacks per process?

2008-04-24 Thread Robert P. J. Day
On Thu, 24 Apr 2008, dinesh bansal wrote: > AFAIK there is only one kernel stack and all the processes share > that space. this is incorrect -- each process has its own personal kernel stack area. rday Robert P. J. Day Lin

Re: Why two stacks per process?

2008-04-24 Thread dinesh bansal
On Thu, Apr 24, 2008 at 2:41 PM, sahlot arvind <[EMAIL PROTECTED]> wrote: > Why do we have two stacks per process i.e. one user mode and other kernel > mode? > As soon as process enters into kernel mode it starts using kernel mode > stack, but as soon as it comes out of kernel mode stack there is

Why two stacks per process?

2008-04-24 Thread sahlot arvind
Why do we have two stacks per process i.e. one user mode and other kernel mode? As soon as process enters into kernel mode it starts using kernel mode stack, but as soon as it comes out of kernel mode stack there is nothing in the kernel mode stack. So cannot we simply have a single stack i.e. just