2 ms·
Time to bring back self modifying code? A C program, that self modifies as it runs, to inline commonly called functions, or make direct jumps instead of indire
by ars 8y ago
Time to bring back self modifying code?
A C program, that self modifies as it runs, to inline commonly called functions, or make direct jumps instead of indirect.
- bjpbakker 8y agoSo you mean a JIT compiler?
- chrisseaton 8y agoWe already have these - JIT compilers as the other person commented. You can even get them for C if you want.
- rkangel 8y agoIn 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.