public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* A question on kernel stack
@ 2003-02-21 18:05 nataraja kumar
  2003-02-21 18:09 ` Oliver Neukum
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nataraja kumar @ 2003-02-21 18:05 UTC (permalink / raw)
  To: linux-kernel

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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A question on kernel stack
  2003-02-21 18:05 A question on kernel stack nataraja kumar
@ 2003-02-21 18:09 ` Oliver Neukum
  2003-02-21 18:27 ` Brian Gerst
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Oliver Neukum @ 2003-02-21 18:09 UTC (permalink / raw)
  To: nataraja kumar, linux-kernel

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A question on kernel stack
  2003-02-21 18:05 A question on kernel stack nataraja kumar
  2003-02-21 18:09 ` Oliver Neukum
@ 2003-02-21 18:27 ` Brian Gerst
  2003-02-21 19:25 ` Richard B. Johnson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Brian Gerst @ 2003-02-21 18:27 UTC (permalink / raw)
  To: nataraja kumar; +Cc: linux-kernel

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A question on kernel stack
  2003-02-21 18:05 A question on kernel stack nataraja kumar
  2003-02-21 18:09 ` Oliver Neukum
  2003-02-21 18:27 ` Brian Gerst
@ 2003-02-21 19:25 ` Richard B. Johnson
  2003-02-23  7:43 ` cs02m023
  2003-02-23 14:33 ` Kasper Dupont
  4 siblings, 0 replies; 6+ messages in thread
From: Richard B. Johnson @ 2003-02-21 19:25 UTC (permalink / raw)
  To: nataraja kumar; +Cc: linux-kernel

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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A question on kernel stack
  2003-02-21 18:05 A question on kernel stack nataraja kumar
                   ` (2 preceding siblings ...)
  2003-02-21 19:25 ` Richard B. Johnson
@ 2003-02-23  7:43 ` cs02m023
  2003-02-23 14:33 ` Kasper Dupont
  4 siblings, 0 replies; 6+ messages in thread
From: cs02m023 @ 2003-02-23  7:43 UTC (permalink / raw)
  To: nataraja kumar; +Cc: linux-kernel


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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A question on kernel stack
  2003-02-21 18:05 A question on kernel stack nataraja kumar
                   ` (3 preceding siblings ...)
  2003-02-23  7:43 ` cs02m023
@ 2003-02-23 14:33 ` Kasper Dupont
  4 siblings, 0 replies; 6+ messages in thread
From: Kasper Dupont @ 2003-02-23 14:33 UTC (permalink / raw)
  To: nataraja kumar; +Cc: linux-kernel

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:aaarep@daimi.au.dk
for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-02-23 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-21 18:05 A question on kernel stack nataraja kumar
2003-02-21 18:09 ` Oliver Neukum
2003-02-21 18:27 ` Brian Gerst
2003-02-21 19:25 ` Richard B. Johnson
2003-02-23  7:43 ` cs02m023
2003-02-23 14:33 ` Kasper Dupont

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox