[LIBFFI] Re: Re: [PATCH] Add support for PaX enable kernels (MPROTECT)
Thu Feb 21 19:20:00 GMT 2013
On 07/11/2012 00:14, Magnus Granberg wrote:
> 2012-11-07 Magnus Granberg <zorry@gentoo...
> Pavel Labushev <pavel.labushev@runbox...
> * configure.ac: Add --enable-pax_emutramp for PaX enable kernels.
> * src/closures.c: Add emutramp_enabled_check. Don't mmap with PROT_EXEC
> on PaX enable Kernels.
> * README: Add description for --enable-pax_emutramp.
> * fficonfig.h.in: Rebuilt.
> * configure.ac: Rebuilt.
There was a small problem with this (upstream relative to gcc) libffi
patch(*). The entire #ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX clause is contained
within an outer #if !defined(X86_WIN32) && !defined(X86_WIN64) clause. That
means that Windows platforms don't get the default definition of
is_emutramp_enabled() supplied by the #else clause. However,
is_emutramp_enabled() is unconditionally referenced in dlmmap(), and without
this default definition Windows targets fail to compile.
The attached patch fixes this by moving the #else clause with the default
is_emutramp_enabled() definition to a standalone #ifndef clause outside any
enclosing conditional compilation test. I couldn't think of a better way to
do it; the #if !(windows) clause is followed by a #elif (cygwin/interix)
clause, so I'd have had to put a default definition in there and also a second
one in a subsequent unconditional #else if I didn't move it out of the
enclosing #if scope altogether.
Gcc-patches: Assuming AG approves, can we commit this without waiting for an
upstream libffi release and doing a full merge? Currently GCC HEAD won't
build libffi (and hence libjava) without it.
2013-02-21 Dave Korn <email@example.com>
* src/closures.c (is_emutramp_enabled [!FFI_MMAP_EXEC_EMUTRAMP_PAX]):
Move default definition outside enclosing #if scope.
(*) - Patch: http://sourceware.org/ml/libffi-discuss/2012/msg00269.html
- Thread: http://sourceware.org/ml/libffi-discuss/2012/threads.html#00247
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 850 bytes
Desc: not available
More information about the Gcc-patches