Sandeep Singh
Sandeep Singh

Reputation: 5181

Memory Allocation for Kernel Space and User Space processes

Is there any difference between kernel space & user space MEMORY ALLOCATIONS?
From which region of memory they get allocated.

Can anyone please provide some pointers on this?

Thanks.

Best Regards,

Sandeep Singh

Upvotes: 0

Views: 1982

Answers (2)

Peter Teoh
Peter Teoh

Reputation: 6713

User and kernel memory does have differences: in the sense of having different physical attributes tagged to it:

https://unix.stackexchange.com/questions/87625/what-is-difference-between-user-space-and-kernel-space

But for allocation algorithm itself: userspace memory is always falling back on kernel memory for its ultimate implementation.

And because kernel mode memory is so much more powerful than usermode, there is a hardware mechanism called SMEP to prevent executing usermode memory from inside kernel mode:

https://www.ncsi.com/nsatc11/presentations/wednesday/emerging_technologies/fischer.pdf

And hardware features like NX bit is always controlled from the kernel mode (ring 0): as a normal user (ring 3) you will not be able to access the bit.

More hardware features:

http://hypervsir.blogspot.sg/2014/11/page-structure-table-corruption-attacks.html

Upvotes: 1

user1788138
user1788138

Reputation:

The memory regions for both the regions are governed by the respective address-space ranges. The boundary value is stored in the fence register.

Upvotes: 2

Related Questions