Question

I am doing some simple JITing, and use VirtualProtectEx under Windows to mark pages as executable. What would be the equivalent of that under Linux, and preferably, other POSIX/Unix-like OSes too?

Was it helpful?

Solution

You are looking for mprotect and probably also mmap. Note that, unlike with Windows, there is no way for process A to change process B's memory map (short of horrible tricks with ptrace).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top