My understanding is a typical user program will never use early addresses in memory as these are typically reserved by the OS.
However, does an OS use 0x0
or do even those observe this address as nullptr
?
Usually (at least before Meltdown), the kernel maps itself in every user-space process virtual addressing space.
Most kernels place themselves in the higher half of the memory. This means that the 0x0
address is technically part of the user-space-reserved addressing.
Anyway, given the special meaning that the NULL
pointer have, the 0x0
address is not supposed to be used by anyone.
Actually, some kernels (e.g. Linux when properly configured) prevent you from allocating anything at the beginning of the address space (including 0x0
). This is intended to be a security measure, in fact, if someone assigns something to the 0x0
address (or following addresses), any NULL-dereference bug in the kernel become a dangerously exploitable vulnerability (if other, more recent, security measures, as SMEP and similar, are missing).