Do the virtual address spaces of all the processes have the same content in their “Kernel” parts?

The Linux Programming Interface shows the layout of a virtual address space of a process:

enter image description here

Is the kernel in the physical memory completely or partially mapped to the part “Kernel” on the top from 0xC0000000 to 0XFFFFFFFF in the virtual address space of each process?

If partially, which part of the kernel in the physical memory is mapped to
the “Kernel” part in the virtual address space of each process, and which part isn’t?

Does the “Kernel” part in the virtual address space of a process store exactly the part of the kernel code which is accessible to the process when it is running in kernel mode, not the part of the kernel code which isn’t?

Do the virtual address spaces of all the processes have the same content in their “Kernel” parts?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

The answer depends on whether kernel page-table isolation is enabled (which depends on the architecture and whether it supports KPTI).

Without KPTI, the kernel is fully mapped in each process’ address space, but as mentioned in the diagram, those mappings are inaccessible from user space (barring side-channel leaks).

With KPTI, the kernel page tables are separate from the userspace page tables, and only a minimal set of mappings are left in each process’ address space, as required to allow user space to call into the kernel, and to enable the processor to give control to the kernel when dealing with interrupts or exceptions.

In both cases, all processes have the same mappings for the kernel.

See also LWN’s article on KAISER.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x