do not link executables with executable stack flag set (#973512)

- upstream patch by Edward Z Yang
- http://ghc.haskell.org/trac/ghc/ticket/703
- note this changes the ABI hash of the ghc library
This commit is contained in:
Jens Petersen 2014-01-30 14:02:36 +09:00
parent f22b491c67
commit 1086f85751
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 08a38628f29df63ac842f4d083efb414f42d7bff Mon Sep 17 00:00:00 2001
From: "Edward Z. Yang" <ezyang@mit.edu>
Date: Tue, 9 Jul 2013 00:01:43 -0700
Subject: [PATCH] Disable executable stack for the linker note, fixing #703
(again)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
---
compiler/main/DriverPipeline.hs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 67377e6..26425ae 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1640,7 +1640,17 @@ mkNoteObjsToLinkIntoBinary dflags dep_packages = do
text elfSectionNote,
text "\n",
- text "\t.ascii \"", info', text "\"\n" ]
+ text "\t.ascii \"", info', text "\"\n",
+
+ -- ALL generated assembly must have this section to disable
+ -- executable stacks. See also
+ -- compiler/nativeGen/AsmCodeGen.lhs for another instance
+ -- where we need to do this.
+ (if platformHasGnuNonexecStack (targetPlatform dflags)
+ then text ".section .note.GNU-stack,\"\",@progbits\n"
+ else empty)
+
+ ]
where
info' = text $ escape info
--
1.8.1.2

View File

@ -25,7 +25,7 @@ Version: 7.6.3
# - release can only be reset if *all* library versions get bumped simultaneously # - release can only be reset if *all* library versions get bumped simultaneously
# (sometimes after a major release) # (sometimes after a major release)
# - minor release numbers for a branch should be incremented monotonically # - minor release numbers for a branch should be incremented monotonically
Release: 21%{?dist} Release: 22%{?dist}
Summary: Glasgow Haskell Compiler Summary: Glasgow Haskell Compiler
License: %BSDHaskellReport License: %BSDHaskellReport
@ -56,6 +56,8 @@ Patch15: ghc-64bit-bigendian-rts-hang-989593.patch
Patch16: ghc-cabal-unversion-docdir.patch Patch16: ghc-cabal-unversion-docdir.patch
# fix libffi segfaults on 32bit (upstream in 7.8) # fix libffi segfaults on 32bit (upstream in 7.8)
Patch17: ghc-7.6.3-rts-Adjustor-32bit-segfault.patch Patch17: ghc-7.6.3-rts-Adjustor-32bit-segfault.patch
# add .note.GNU-stack to assembly output to avoid execstack (#973512)
Patch18: ghc-7.6-driver-Disable-executable-stack-for-the-linker-note.patch
# fedora ghc has been bootstrapped on # fedora ghc has been bootstrapped on
# %{ix86} x86_64 ppc alpha sparcv9 ppc64 armv7hl armv5tel s390 s390x # %{ix86} x86_64 ppc alpha sparcv9 ppc64 armv7hl armv5tel s390 s390x
@ -245,6 +247,8 @@ ln -s $(pkg-config --variable=includedir libffi)/*.h rts/dist/build
%patch17 -p0 -b .orig %patch17 -p0 -b .orig
%patch18 -p1 -b .orig
%global gen_contents_index gen_contents_index.orig %global gen_contents_index gen_contents_index.orig
%if %{undefined without_haddock} %if %{undefined without_haddock}
if [ ! -f "libraries/%{gen_contents_index}" ]; then if [ ! -f "libraries/%{gen_contents_index}" ]; then
@ -476,6 +480,11 @@ fi
%changelog %changelog
* Thu Jan 30 2014 Jens Petersen <petersen@redhat.com> - 7.6.3-22
- do not set executable stack on executables (#973512)
(upstream patch by Edward Z Yang)
- note this patch changes the ABI hash of the ghc library
* Wed Jan 29 2014 Jens Petersen <petersen@redhat.com> - 7.6.3-21 * Wed Jan 29 2014 Jens Petersen <petersen@redhat.com> - 7.6.3-21
- fix segfault on i686 when using ffi double-mapping for selinux (#907515) - fix segfault on i686 when using ffi double-mapping for selinux (#907515)
see http://hackage.haskell.org/trac/ghc/ticket/7629 see http://hackage.haskell.org/trac/ghc/ticket/7629