2 ms·
In general, you want to avoid self modifying code. You gain a major security benefit by ensuring that each page in the address space is "Writeable" OR "Executab
by rkangel 8y ago
In general, you want to avoid self modifying code. You gain a major security benefit by ensuring that each page in the address space is "Writeable" OR "Executable" but not both. This is often abbreviated to W^X.
Without W^X, many simple bugs can easily become bad exploits. You can inject some code into memory
(using any program input) and then use the bug to cause it to be executed: immediate control.
If W^X is in place, then the only code that could be executed by an exploit is code that is already there. Techniques like ROP allow this to be exploited still, but it's much harder and needs more of security hole to start with.