4 ms·
I don't think process_vm_writev can write to read-only memory, which executable memory is under modern operating systems. Doing that requires ptrace, which long
by Hello71 5y ago
I don't think process_vm_writev can write to read-only memory, which executable memory is under modern operating systems. Doing that requires ptrace, which long predates Linux. According to the Linux man page, it is "CONFORMING TO: SVr4, 4.3BSD".
- woodruffw 5y agoThe ptrace APIs also can’t write to read only memory, at least not on modern Linux running on CPUs with modern MMUs. But SMC doesn’t require that, because you can always map (or remap) executable pages as writable. Executable code is only read-only by default, you can always change that (or just not do it, in the case of a JIT).
- comex 5y ago> The ptrace APIs also can’t write to read only memory Sure they can. https://stackoverflow.com/questions/49442087/how-does-ptrace-poketext-works-when-modifying-program-text https://stackoverflow.com/questions/49442087/how-does-ptrace...
- woodruffw 5y agoHuh, this is news to me! I always thought that ptrace temporarily changed the page's permissions, rather than bypassing them entirely. My mistake.