From 047624e51819b1ad142495ef55d428fccfab7c68 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 30 Jan 2014 14:02:36 +0900 Subject: [PATCH] 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 --- ...executable-stack-for-the-linker-note.patch | 37 +++++++++++++++++++ ghc.spec | 11 +++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 ghc-7.6-driver-Disable-executable-stack-for-the-linker-note.patch diff --git a/ghc-7.6-driver-Disable-executable-stack-for-the-linker-note.patch b/ghc-7.6-driver-Disable-executable-stack-for-the-linker-note.patch new file mode 100644 index 0000000..63583af --- /dev/null +++ b/ghc-7.6-driver-Disable-executable-stack-for-the-linker-note.patch @@ -0,0 +1,37 @@ +From 08a38628f29df63ac842f4d083efb414f42d7bff Mon Sep 17 00:00:00 2001 +From: "Edward Z. Yang" +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 +--- + 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 + diff --git a/ghc.spec b/ghc.spec index a966b29..1fce3dd 100644 --- a/ghc.spec +++ b/ghc.spec @@ -25,7 +25,7 @@ Version: 7.6.3 # - release can only be reset if *all* library versions get bumped simultaneously # (sometimes after a major release) # - minor release numbers for a branch should be incremented monotonically -Release: 21%{?dist} +Release: 22%{?dist} Summary: Glasgow Haskell Compiler License: %BSDHaskellReport @@ -56,6 +56,8 @@ Patch15: ghc-64bit-bigendian-rts-hang-989593.patch Patch16: ghc-cabal-unversion-docdir.patch # fix libffi segfaults on 32bit (upstream in 7.8) 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 # %{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 +%patch18 -p1 -b .orig + %global gen_contents_index gen_contents_index.orig %if %{undefined without_haddock} if [ ! -f "libraries/%{gen_contents_index}" ]; then @@ -476,6 +480,11 @@ fi %changelog +* Thu Jan 30 2014 Jens Petersen - 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 - 7.6.3-21 - fix segfault on i686 when using ffi double-mapping for selinux (#907515) see http://hackage.haskell.org/trac/ghc/ticket/7629