|
From: | David Chisnall |
Subject: | Re: [Gnustep-cvs] r26723 - in /libs/base/trunk: ChangeLog Headers/Additions/GNUstepBase/config.h.in Source/GSFFIInvocation.m configure configure.ac |
Date: | Sat, 28 Jun 2008 19:51:03 +0100 |
On 28 Jun 2008, at 10:56, David Ayers wrote:
Richard Frith-Macdonald schrieb:Author: rfm Date: Sat Jun 28 07:13:47 2008 New Revision: 26723 URL: http://svn.gna.org/viewcvs/gnustep?rev=26723&view=rev Log: Try to ensure that ffi uses executable memory and doesn't segfaultAhh! Yes, mmap! Thank you!
I think calling mmap directly is the wrong solution here. You should be using valloc() with the requested size rounded up to the nearest page size, and then use mprotect to set it as executable. Note that most sane operating systems (and Vista) are moving to W^X, so you need to set it as writeable while creating it, then executable while using it (i.e. call mprotect immediately before the return).
David
[Prev in Thread] | Current Thread | [Next in Thread] |