2003-02-21 17:55:01

by nataraja kumar

[permalink] [raw]
Subject: A question on kernel stack

hi,
my apologies if i am wrong. please let me know
why does kernel use kernel stack when process jumps
from user mode to kernel mode. why can't user stack
be used ?

nattu.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


2003-02-21 17:59:50

by Oliver Neukum

[permalink] [raw]
Subject: Re: A question on kernel stack

Am Freitag, 21. Februar 2003 19:05 schrieb nataraja kumar:
> hi,
> my apologies if i am wrong. please let me know
> why does kernel use kernel stack when process jumps
> from user mode to kernel mode. why can't user stack
> be used ?

Security. We can't trust user mode to pass a valid stack pointer.

Oliver

2003-02-21 18:17:39

by Brian Gerst

[permalink] [raw]
Subject: Re: A question on kernel stack

nataraja kumar wrote:
> hi,
> my apologies if i am wrong. please let me know
> why does kernel use kernel stack when process jumps
> from user mode to kernel mode. why can't user stack
> be used ?
>
> nattu.

1) The user stack could be invalid. An invalid stack in the kernel will
cause the processor to double fault (see the recent double fault thread).
2) Security. You could set up the stack pointer from userspace so that
the kernel would overwrite memory that userspace can't access.
3) Security #2. You don't want to give userspace access to certain data
written to the stack in kernel mode.

--
Brian Gerst

2003-02-21 19:14:38

by Richard B. Johnson

[permalink] [raw]
Subject: Re: A question on kernel stack

On Fri, 21 Feb 2003, nataraja kumar wrote:

> hi,
> my apologies if i am wrong. please let me know
> why does kernel use kernel stack when process jumps
> from user mode to kernel mode. why can't user stack
> be used ?
>
> nattu.

Because if a user-stack was used, any user could crash the kernel
and take down the system.

main()
{
__asm__ __volatile__("movl $0x08, %esp\n");
/* Only enough stack to push 0 and call exit() */

exit(0); /* Ultimately a sys-call */
}



Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.


2003-02-23 08:08:25

by cs02m023

[permalink] [raw]
Subject: Re: A question on kernel stack


What if USER STACK OVERFLOWS in KERNEL MODE ?????


-----------------
S.Kartikeyan ,CS02M023


On Fri, 21 Feb 2003, nataraja kumar wrote:

> hi,
> my apologies if i am wrong. please let me know
> why does kernel use kernel stack when process jumps
> from user mode to kernel mode. why can't user stack
> be used ?
>
> nattu.
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2003-02-23 14:23:18

by Kasper Dupont

[permalink] [raw]
Subject: Re: A question on kernel stack

nataraja kumar wrote:
>
> hi,
> my apologies if i am wrong. please let me know
> why does kernel use kernel stack when process jumps
> from user mode to kernel mode. why can't user stack
> be used ?

1) The user stack is in user space, which can only be
accessed by this process (or any sharing the same
vm). Trying to access the stack of another process
would fail.
2) The stack pointer is used to find the task_struct
of the current process. You'd need another location
for the task_struct, and a way to find it.
3) Various security issues as others have already
mentioned.

--
Kasper Dupont -- der bruger for meget tid p? usenet.
For sending spam use mailto:[email protected]
for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);