Lesson 13: Virtual Address Space
Every Linux process sees its own virtual address space — the illusion of private memory. This lesson explains the VAS layout (text/data/heap/stack/mmap), shows how to read /proc/self/maps, and explains why ASLR matters for security.
A virtual address space is like a house of numbers: every process thinks it has a huge house all to itself, but the OS translates those numbers to real physical addresses.
- virtual address space
- The private address space each process receives. Virtual addresses are translated to physical addresses by the MMU.
- stack
- A memory region that grows downward (toward lower addresses). Contains local variables, return addresses, and function frames. Limited in size.
- heap
- Dynamic memory region that grows upward. Managed by malloc/new. Requires explicit release or garbage collection.
- mmap region
- A region created by the mmap() system call — contains shared libraries (.so), memory-mapped files, and anonymous mappings.
- ASLR
- Address Space Layout Randomisation — the OS randomises the load addresses of stack/heap/mmap on each run to make exploiting vulnerabilities harder.