Main source: "How programs get run", on lwn 1, 2. READ THIS FIRST
There are a few details that are crucial for sizecoding stuff. On program entry:
PT_LOAD
phdrs allocate memory, or map data or code from the executable into
memory.PT_INTERP
makes the kernel load a second program and execute that one,
after mapping the first one into memory./proc/sys/vm/mmap_min_addr
, but can only be written to by root.x86_64
(and maybe i386
?), the stack is aligned to 16 bytes
. The
x86_64
calling convention says that the stac pointer mod 16 must be 8 when
calling a function. SIMD instructions sometimes require 16-byte alignment
.
Data on which SIMD instructions are working is sometimes stored on the stack.
This means that, if you do not manually realign the stack, crashes will
happen when doing SIMD. *This code may be in libraries you're depending on,
and depending on the distro, libraries may or may not be compiled with SIMD
instructions!** * This can be fixed with one byte: push rax
.