The reference to
.text (as well as
.data,
.rodata and so on) come from format used for native binary executables in Linux, the
ELF format.
Salem means that in Linux, program code is read into memory that is marked read-only and executable, on all processors that support it. So, something like
Code:
int my_function(const int a, const int b)
{
return a + b;
}
/* Zero out first ten bytes of my_function */
memset(&my_function, 0, 10);
may work on some other platforms, but in Linux it will fail at run time with a
Segmentation fault -- which basically means that the program tried to write to memory it is not allowed to write to (or read or execute memory it's not allowed to), the hardware noticed it, and the kernel decided to kill the process. (There are some embedded platforms that don't have virtual memory or a memory management where that will actually succeed; they just cannot protect against code modifications.)
Ah, forgot about the original question.
The memory layout does not matter at all, because the process simply cannot modify the memory containing code. In fact, current Linux kernels employ a randomization scheme, to make security exploits harder to write as memory addresses change from one execution to the next. This means that there is no specific layout.
It also means that catching bugs where you have a pointer with fixed, wrong value, becomes more interesting: it may only fail some of the time. Every now and then the address space randomization may cause the pointer to actually point to valid data.