问题
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?
回答1:
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).
来源:https://stackoverflow.com/questions/3800762/linux-equivalent-for-virtualprotectex