Threads

Submitted by kolakotte
on October 14, 2007 - 9:37am

Why does linux have two stacks for a thread, one in user space and one in kernel space?

Escalation of privilege, denial or service, ...

Anonymous (not verified)
on
October 14, 2007 - 6:28pm

Users can point the user stack where they like, for example in the middle of some device's memory mapped IO area. If the kernel used the user's stack, it would then crap all over the device. X86_64, i386, 680x0 and ARM architectures all switch the stack on transitions from user to kernel, and make it easy to switch to stack back again when going back to user space. AFAIK, all architectures capable of drawing a distinction between user and kernel space do this because user space needs access to its own stack, but would be able to escalate privilege if it could modify any kernel stack.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.