[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Emulation without RWX
From: |
Kamil Rytarowski |
Subject: |
Re: [Qemu-devel] Emulation without RWX |
Date: |
Tue, 13 Jun 2017 15:23:45 +0200 |
User-agent: |
Mozilla/5.0 (X11; NetBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 13.06.2017 14:44, Peter Maydell wrote:
> On 13 June 2017 at 12:54, Antonio Groza <address@hidden> wrote:
>> Hello, i am trying to emulate x86 on a platform that won't allow me to map
>> memory pages as RWX(Apple's iOS) and i was wondering if there was any way
>> of running qemu without doing that. I've had a brief look at your
>> documentation and it looks like you are transpiling between 2 different
>> instruction sets and i don't know how that would be possible without a rwx
>> page.
>
> It's certainly possible in theory -- you'd just need to be more
> careful than we are currently about mapping the memory RW when
> writing or patching code and then R-X when executing. (Now we're
> multithreaded this is probably trickier than when we only had
> a single thread, though.) But we don't do it currently and it
> would require (possibly complicated) code changes to do it.
>
> thanks
> -- PMM
>
MacOSX and NetBSD both have this RWX MPROTECT restriction and both have
option to relax it on per-page basis.
Example code inspiration is in LLVM's: Memory::AllocateRWX
(llvm/lib/Support/Unix/Memory.inc). [NetBSD code is still pending
upstream in review]
Proper PaX MPROTECT is not about toggling RW-RX memory region, as once a
memory page was allocated with W mode, it won't in regular circumstances
mapped to X anymore.
signature.asc
Description: OpenPGP digital signature