The process memory map
Each running process in user space has a process map that we can inspect. These memory maps tell us how a program's memory is allocated and what shared libraries it is linked to.
You can see the memory map for a process through the proc
filesystem. As an example, here is the map for the init
process, PID 1
:
# cat /proc/1/maps 00008000-0000e000 r-xp 00000000 00:0b 23281745 /sbin/init 00016000-00017000 rwxp 00006000 00:0b 23281745 /sbin/init 00017000-00038000 rwxp 00000000 00:00 0Â Â Â Â Â Â Â Â [heap] b6ded000-b6f1d000 r-xp 00000000 00:0b 23281695 /lib/libc-2.19.so b6f1d000-b6f24000 ---p 00130000 00:0b 23281695 /lib/libc-2.19.so b6f24000-b6f26000 r-xp 0012f000 00:0b 23281695 /lib/libc-2.19.so b6f26000-b6f27000 rwxp 00131000 00:0b 23281695 /lib/libc-2.19.so b6f27000-b6f2a000 rwxp 00000000 00:00 0 b6f2a000-b6f49000 r-xp 00000000 00:0b 23281359 /lib/ld-2.19.so b6f4c000-b6f4e000 rwxp 00000000 00:00 0 b6f4f000-b6f50000 r...