[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 16:35:21 PDT 2017


krytarowski added a comment.

In https://reviews.llvm.org/D35558#815333, @lhames wrote:

> Is AllocateRWX returning RWX blocks? If so, is anyone clearing the W bit later?
>
> For architectures that support it, I think I would like to keep the existing scheme: JIT'd memory is initialized while in RW- mode, then switched to RX- mode prior to execution. That means JIT'd code has no easy way to modify itself during execution.
>
> I'm also open to changing the model (I'm not a security expert) but that would require more consideration.


Right, the pages are allocated RWX.

As far as I can tell, this interface is not prepared to disable R, W, X properties at least in a portable way.

I've missed that we need to use ReleaseRWX() for the RWX regions.

Switching a page from the W mode to X is prohibited with PaX MPROTECT (on NetBSD).


Repository:
  rL LLVM

https://reviews.llvm.org/D35558





More information about the llvm-commits mailing list