selfrando
selfrando copied to clipboard
Get rid of original code after randomization with `m_in_place == false`
As pointer out by @Sjlver, if m_in_place == false
, i.e., we randomize to a secondary memory region and leave the new code there, then the original copy of .text
remains in place and is both readable and executable. We should re-map it as read-only in this case, but this would require a bit of refactoring, since the code that fixes page protections after randomization is located outside ExecSectionProcessor
.
Looking over the code some more, I think we never have m_in_place == false
on Linux, so this situation is never encountered. I'll do some experiments later.