LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 04-24-2013, 09:49 PM   #1
saurin
Member
 
Registered: Aug 2008
Posts: 43

Rep: Reputation: 0
Question about kernel stack


linux kernel maintains the stack for each user-space process as well as kernel level thread(in kernel space), but not sure if kernel also maintains the stack for the user level thread, would somebody help me to understand this?
 
Old 04-25-2013, 08:10 AM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,039

Rep: Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952
The user-process stack is in virtual memory, and in any case it is not to be trusted. When the system enters kernel mode, the stack-pointer is switched to a kernel stack for the duration of the call. (The successful execution of a kernel request must not depend in any way upon the user environment: the kernel operates in a "known-good," trustworthy state which the user cannot tamper with.)

Part of the procedure for switching from user-mode to kernel-mode is to preserve all of the values in the CPU registers, including the user-process stack pointer. The kernel has ready access to these values, which will be restored when the system transitions back into user-mode.

The kernel can retrieve information from the user-process stack as it sees fit, but the user-process cannot access the kernel stack area.

Last edited by sundialsvcs; 04-25-2013 at 08:14 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about kernel stack Leavesw Linux - Kernel 3 03-18-2009 06:13 PM
Difference b/t Kernel stack and User stack hazzyb Linux - Software 2 09-29-2008 07:40 PM
Increasing Kernel stack size to 8k without recompiling the Kernel deathman Linux - Software 2 04-08-2006 04:39 AM
Where to find a Kernel/Kernel Patch with support for stack sizes >8K Valhalla Linux - Software 2 05-24-2005 05:39 PM
Virtual Machine kernel stack fault in kernel mode virtical Linux - Software 0 07-14-2003 08:30 PM


All times are GMT -5. The time now is 08:20 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration