Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920836 - dev-lang/ghc-9.2.8 StgCRunAsm.o contain writable and executable sections
Summary: dev-lang/ghc-9.2.8 StgCRunAsm.o contain writable and executable sections
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-27 23:12 UTC by Attila Tóth
Modified: 2023-12-28 03:36 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
ghc-9.2.8_StgCRunAsm-GNU-stack.patch (ghc-9.2.8_StgCRunAsm-GNU-stack.patch,503 bytes, patch)
2023-12-27 23:12 UTC, Attila Tóth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Tóth 2023-12-27 23:12:27 UTC
* QA Notice: The following files contain writable and executable sections
 *  Files with such sections will not work properly (or at all!) on some
 *  architectures/operating systems.  A bug should be filed at
 *  https://bugs.gentoo.org/ to make sure the issue is fixed.
 *  For more information, see:
 *
 *    https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
 *
 *  Please include the following list of files in your report:
 *  Note: Bugs should be filed for the respective maintainers
 *  of the package in question and not hardened@gentoo.org.
 * !WX --- --- usr/lib64/ghc-9.2.8/rts/libHSrts_thr_l.a:StgCRunAsm.thr_l_o
 * !WX --- --- usr/lib64/ghc-9.2.8/rts/libHSrts_thr.a:StgCRunAsm.thr_o
 * !WX --- --- usr/lib64/ghc-9.2.8/rts/libHSrts_l.a:StgCRunAsm.l_o
 * !WX --- --- usr/lib64/ghc-9.2.8/rts/libHSrts_thr_debug.a:StgCRunAsm.thr_debug_o
 * !WX --- --- usr/lib64/ghc-9.2.8/rts/libHSrts_debug.a:StgCRunAsm.debug_o
 * !WX --- --- usr/lib64/ghc-9.2.8/rts/libHSrts.a:StgCRunAsm.o

Reproducible: Always




On x86_64, the object file is essentially empty. The source includes GNU stack progbits for several architectures, but not for x86_64. The following change solves the notice:
diff -urNp ghc-9.2.8-orig/rts/StgCRunAsm.S ghc-9.2.8-dwok/rts/StgCRunAsm.S
--- ghc-9.2.8-orig/rts/StgCRunAsm.S     2023-05-26 01:03:00.000000000 +0200
+++ ghc-9.2.8-dwok/rts/StgCRunAsm.S     2023-12-27 09:39:41.747353995 +0100
@@ -376,6 +376,11 @@ StgReturn:
        .size StgReturn, .-StgReturn

        .section        .note.GNU-stack,"",@progbits
+#else
+/* mark stack as nonexecutable */
+#if defined(__linux__) && defined(__ELF__)
+       .section        .note.GNU-stack,"",@progbits
+#endif
 #endif

 #endif /* !USE_MINIINTERPRETER */
Comment 1 Attila Tóth 2023-12-27 23:12:58 UTC
Created attachment 880786 [details, diff]
ghc-9.2.8_StgCRunAsm-GNU-stack.patch

Proposed patch solves the notice.