[PATCH] D35558: Use sys::Memory::AllocateRWX for JIT code
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 17:25:25 PDT 2017
krytarowski added a comment.
In https://reviews.llvm.org/D35558#815442, @lhames wrote:
> > Right, the pages are allocated RWX.
>
> It seems odd to prevent the flipping of the W/X bits while allowing RWX pages. I assume there are additional privileges required (granted only to JITs and debuggers?) to get RWX pages? Is there a good source for me to read up about the PaX MPROTECT design?
I think that the whole design is about remapping all (R)WX pages to (R)W and not allowing to remap it as X in future.
AllocateRWX uses OS-specific interfaces to workaround it (if possible).
By default attaching to a process with ptrace(2) eliminates this restriction for debuggers. This is needed to insert software breakpoints.
> I think we need to consider this design further before we move to it by default, but I am keen to look into this: to the extent that we can support RWX pages there are some excellent optimizations we can make for JIT'd code that have been on my wish-list for a while.
>
> We could develop the new scheme alongside the old one by introducing parallel RWX-based stub and callback managers.
I recommend to discuss it with @joerg as he is the author of our JIT interface in mmap(2).
I have no personal preferences here, I want to get LLVM JIT functional.
Repository:
rL LLVM
https://reviews.llvm.org/D35558
More information about the llvm-commits
mailing list