On 9/26/06, Bhanu Kalyan Chetlapalli <chbhanukalyan@xxxxxxxxx> wrote:
On 9/26/06, Jakko Pastuchio <jakkop@xxxxxxxxx> wrote: > HI all, > > I have a question. > When a process tries to access kernel space, > he is blocked by the hardware, > even if he is root, right ? True. > > BUT - > most linux distributions use 3Gb-1Gb as user-kernel address space barrier, > while some uses 2Gb-2Gb. > > so how does the hardware know where does the kernel space start ? Hardware is not concerned about what split is being used. It just follows the page tables (Forget segmentation, which is not used in Linux i.e. "effectively" disabled, by using a big flat model). If the page table entry for a page in the page table has the user/supervisor bit set (or unset, I dont remember exactly) then it wont allow any instruction to access that page while processor is in Ring 3. The kernel sets up the pagetables based on the split being used. > can a user space program go to ring 0 so the hardware won't stop it > from accessing the upper 1Gb memory ? The MMU will catch such an access and raise a page fault, and the kernel page fault handler will determine that its not valid and send a SIGSEGV to that process. Unless ofcourse you are using the 'int' instruction, but the handler is again not specified by the user.... so not much luck there also. > thanks all ! > jakko Bhanu.
thanks ! jakko -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/