For Linux 32-bit memory space layout, you can refer to this blog post Linux C program process address Space Bureau of the source code in the various data types/code in the ELF format files and process space in the segment, under X86_64 and i386 is similar, This paper focuses on the macro layout of process space memory under the influence of Vm.legacy_va_layout and Kernel.randomize_va_space parameters.
Scenario One:
- Vm_legacy_va_layout=1
- Kernel.randomize_va_space=0
In this case, the traditional memory layout mode is used, and the randomization is not turned on.
Memory layout for CAT programs
Can be seen:
Code Snippet:0x400000–>
Data segment
Heap: Upward growth 2aaaaaaab000–>
Stack: 7ffffffde000<–7ffffffff000
System call: ffffffffff600000-ffffffffff601000
You can try other programs, and the heap start is constant at kernel.randomize_va_space=0.
Scenario Two:
- Vm_legacy_va_layout=0
- Kernel.randomize_va_space=0
Now default memory layout, not randomization
Can be seen:
Code Snippet:0x400000–>
Data segment
Heap: Downward growth <–7ffff7fff000
Stack: 7ffffffde000<–7ffffffff000
System call: ffffffffff600000-ffffffffff601000
Scenario Three:
- Vm_legacy_va_layout=0
- kernel.randomize_va_space=2//ubuntu 14.04 Default value
Use the default layout now, Randomize
Compared to the two-boot cat program, the starting point of the memory layout heap is variable, which prevents buffer overflow attacks to a certain extent.
Scenario Four:
- Vm_legacy_va_layout=1
- kernel.randomize_va_space=2//ubuntu 14.04 Default value
Similar to the situation three, no longer repeat
Linux x86_64 Process Memory space layout