Search code examples
memorymemory-managementreserved

Reserved Memory Addresses?


Is there a list of reserved memory addresses out there - a list of addresses that the memory of a user-space program could never be allocated to? I realize this is most likely per-OS or per-architecture, but I was hoping someone might know some of the more common OSes and Arches. I could only dig one up for a few versions of windows:

for windows NT,2k and XP that would be:

0x00000000 - 0x0000ffff -> lowest page is protected to simplify debugging

0x00001000 - 0x7ffeffff -> memory area for your application

0x7fff0000 - 0x7fffffff -> protected area to keep memory-functions from damaging the following part

0x80000000 - 0xffffffff -> memory where the system including drivers and so on is located

Anyone know about for Linux, or BSD (or anything else, for that matter)?


Solution

  • Linux is normally configured to own 0xC000000 to 0xFFFFFFFF by kernel. This can be changed (e.g. the infamous 4GB-4GB split that reserves none). glibc is usually loaded at 0xB000000.

    Under Linux, 0x00000000 can be requested by a particular mmap() call unless blocked by a security sysctl (which turned out to be a bad idea to block).

    Reguarding allocating NULL:

    NULL is only explicitly allocatable so I'd assume the program that did it was prepared for the consequence of doing so. At least -fno-delete-null-pointer-checks is required to GCC for the affected code to function. I'm told this is to emulate old BSD behavior that mapped the zero page there.