0
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

Sandeep Singh
  • 4,941
  • 8
  • 36
  • 56
  • 1
    possible duplicate of [How does the linux kernel manage less than 1GB physical memory?](http://stackoverflow.com/questions/4528568/how-does-the-linux-kernel-manage-less-than-1gb-physical-memory) -- the question I selected has some details about `512M` memory that's not in this question, and the target is tagged [tag:arm], but the answers are quite good there... please read it and see if you agree. – sarnold Jan 06 '12 at 04:32

2 Answers2

2

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

1

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

Community
  • 1
  • 1
Peter Teoh
  • 6,337
  • 4
  • 42
  • 58