gnustep-dev
[Top][All Lists]
Advanced

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

Re: [Gnustep-cvs] r26723 - in /libs/base/trunk: ChangeLog Headers/Additi


From: Richard Frith-Macdonald
Subject: Re: [Gnustep-cvs] r26723 - in /libs/base/trunk: ChangeLog Headers/Additions/GNUstepBase/config.h.in Source/GSFFIInvocation.m configure configure.ac
Date: Sun, 29 Jun 2008 10:38:10 +0100


On 29 Jun 2008, at 08:54, David Ayers wrote:

Hello David

David Chisnall schrieb:
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

I'm not sure what advantage valloc() has over mmap() ... all the examples/recommendations I found on the web were for mmap().


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

Good, point ... the code already uses mprotect if available, but I also changed it to refrain from trying to map the memory as executable in the case where we can later use mprotect. This should avoid problems on systems (I don't have one to test on) where an attempt to map memory which is both writable and executable would fail.


My man page for vmalloc states:
      The  obsolete  function  valloc()  allocates  size bytes and
returns a pointer to the allocated memory. The memory address will be a
multiple of the page
      size.  It is equivalent to memalign(sysconf(_SC_PAGESIZE),size).

I'm not sure whether you are aware of the fact that this function is
considered obsolete.

Hi Richard,

My man page for mmap states:
      MAP_ANON
             Synonym for MAP_ANONYMOUS.  Deprecated.

So to me it seems the new #ifndef logic is inverted.

Thanks ... I changed that round to use MAP_ANONYMOUS preferentially.




reply via email to

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