Skip to contentSkip to conversation

A question on kernel stack

DISCUSSION nataraja kumar 6 participants 6 messages Feb 21, 2003 – Feb 23, 2003

lore
Share & tools
lore
#0 lore raw

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/

#1 lore raw

Am Freitag, 21. Februar 2003 19:05 schrieb nataraja kumar:

Quoted 5 lines

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

#2 lore raw
In reply to nataraja kumar
Quoted 7 lines · 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 ?

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

#3 lore raw
In reply to nataraja kumar
Quoted 7 lines · 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 ?

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.

#4 lore raw
In reply to nataraja kumar

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

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

Quoted 18 lines · 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 ?

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/

#5 lore raw
In reply to nataraja kumar
Quoted 6 lines · 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 ?

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.

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