qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 11/13] tests/vm: netbsd autoinstall, using seria


From: Kamil Rytarowski
Subject: Re: [Qemu-devel] [PATCH 11/13] tests/vm: netbsd autoinstall, using serial console
Date: Thu, 9 May 2019 19:01:39 +0200
User-agent: Mozilla/5.0 (X11; NetBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0

On 09.05.2019 08:47, Gerd Hoffmann wrote:
>   Hi,
> 
>> I recommend to add one extra step into generated image:
>>
>> echo security.pax.mprotect.enabled=0 >> /etc/sysctl.conf
> 
> Done.
> 

Thanks! Once there will be PaX MPROTECT support in qemu, we can and
should drop it.

>> Alternatively (and preferably) enhance qemu to handle RWX allocation for
>> JIT on NetBSD.
>>
>> Example in libffi.
>>
>> https://github.com/libffi/libffi/commit/2bfcd29955c02b67fa10a68cc4200f6838181e0f
> 
> So, from looking at the patch it seems you need two mappings of the same
> page, one writable and one executable.
> > Or, maybe it is also possible with one mapping which is writable first
> when you fill it with code, then gets flipped over to executable when
> you are done with the initialization and want use it.
> 
> Is that correct?
> 

If we need RWX in the same time we need double mapping (RW and RX). This
has been done in libffi.

If we can switch between RW and RX it's sufficient to use a single
mapping, however there is need to allocate a memory region with mmap(2)
using the PROT_MPROTECT() macro.

Example from the LLVM code:

https://github.com/llvm-mirror/llvm/blob/90dd07f5c5946a3d9d6861effe3291620c88c06f/lib/Support/Unix/Memory.inc#L99

> I suspect supporting that in tcg isn't exactly trivial.
> Does OpenBSD work the same way btw?
> 

No. OpenBSD does not implement escape API.

There is need to pass "-z wxneeded" to the linker flags, but I'm not the
right person to test this or write a patch.

https://man.openbsd.org/ld

FreeBSD does not support W^X.

> cheers,
>   Gerd
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]