[PATCH] D35558: Use sys::Memory::AllocateRWX for JIT code

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 17:09:29 PDT 2017


joerg 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?


They are not allocated RWX, they are allocated RW with the option for later X. I.e. the kernel enforces W^X, but you can request
additional protections for later use. Without that, mprotect with X would be rejected later. There are patching for Linux for similar effect, but I don't think
they ever got merged. libffi is a victim of that on Linux.


Repository:
  rL LLVM

https://reviews.llvm.org/D35558





More information about the llvm-commits mailing list