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

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 21 16:36:16 PDT 2017


lhames added a comment.

> The current patch switches from requesting RW- pages to RWX, which I don't think is valid on iOS although I'll have to double check that.

Sorry - I just realized this doesn't address your earlier comment:

> 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.

So assuming the AllocateRWX call doesn't actually allocate RWX pages (and the latter calls to mprotect to flip the permissions work) we can go ahead with this patch as is, though I'd love to rename AllocateRWX on mainline to remove the confusion.


Repository:
  rL LLVM

https://reviews.llvm.org/D35558





More information about the llvm-commits mailing list