[commit: ghc] ghc-7.10: libffi: backport noexecstack fix for x86/win32.S (56ecec4)

git at git.haskell.org git at git.haskell.org
Thu Apr 2 21:06:25 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/56ecec4986d21468e7146017831a110bd3a4a86c/ghc

>---------------------------------------------------------------

commit 56ecec4986d21468e7146017831a110bd3a4a86c
Author: Sergei Trofimovich <siarheit at google.com>
Date:   Thu Apr 2 22:02:57 2015 +0100

    libffi: backport noexecstack fix for x86/win32.S
    
    Got detected by gentoo's QA preinstall hook:
     * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2
     * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so
     * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o
     * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o
    
    Signed-off-by: Sergei Trofimovich <siarheit at google.com>
    
    Test Plan: built ghc-7.10.1 binary and checked stacks as NX
    
    Reviewers: rwbarton, hvr, austin
    
    Reviewed By: austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D764
    
    GHC Trac Issues: #10208
    
    (cherry picked from commit 47f821a1a24553dc29b9581b1a259a9b1394c955)


>---------------------------------------------------------------

56ecec4986d21468e7146017831a110bd3a4a86c
 libffi/ghc.mk                     |  3 +++
 libffi/libffi.x86-execstack.patch | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/libffi/ghc.mk b/libffi/ghc.mk
index a5645de..59e089d 100644
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -67,6 +67,9 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP)
 # will use cygwin symbolic links which cannot be read by mingw gcc.
 	chmod +x libffi/ln
 
+	# don't report nonselinux systems as selinux
+	( cd libffi/build && "$(PATCH_CMD)" -p0 < ../libffi.x86-execstack.patch; )
+
 	# We need to use -MMD rather than -MD, as otherwise we get paths
 	# like c:/... in the dependency files on Windows, and the extra
 	# colons break make
diff --git a/libffi/libffi.x86-execstack.patch b/libffi/libffi.x86-execstack.patch
new file mode 100644
index 0000000..baea18f
--- /dev/null
+++ b/libffi/libffi.x86-execstack.patch
@@ -0,0 +1,24 @@
+ * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2
+ * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so
+ * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o
+ * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o
+
+http://bugs.gentoo.org/511634
+http://sourceware.org/ml/libffi-discuss/2014/msg00058.html
+
+--- src/x86/win32.S
++++ src/x86/win32.S
+@@ -1304,3 +1304,6 @@
+ 
+ #endif /* !_MSC_VER */
+ 
++#if defined __ELF__ && defined __linux__
++	.section        .note.GNU-stack,"", at progbits
++#endif



More information about the ghc-commits mailing list