Bug 92820 - [10 Regression] libgo.so.15 has executable stack
Summary: [10 Regression] libgo.so.15 has executable stack
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 10.0
: P1 normal
Target Milestone: 10.0
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-05 11:44 UTC by Matthias Klose
Modified: 2019-12-06 20:01 UTC (History)
3 users (show)

See Also:
Host:
Target: i686-linux-gnu, s390x-linux-gnu, arm-linux-gnueabihf, arm-linux-gnueabi, alpha-linux-gnu, powerpc-linux-gnu, sparc64-linux-gnu, sh4-linux-gnu
Build:
Known to work: 9.2.1
Known to fail: 10.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2019-12-05 11:44:19 UTC
seen with trunk 20191204, almost all architectures except x86_64-linux-gnu. the lintian tool detected that while packaging GCC 10.
Comment 1 Andreas Schwab 2019-12-05 12:59:30 UTC
Don't see that on aarch64 or riscv64.
Comment 2 Matthias Klose 2019-12-05 13:13:58 UTC
I don't see it here on x86_64-linux-gnu, aarch64-linux-gnu, powerpc64le-linux-gnu.
Comment 3 Ian Lance Taylor 2019-12-05 16:40:38 UTC
What architectures do you see it on?  Do we just need to move the
	.section	.note.GNU-stack,"",@progbits
in runtime/go-context.S out of the #ifdef?
Comment 4 Matthias Klose 2019-12-05 17:02:51 UTC
these are the architectures I see this:
i686-linux-gnu, s390x-linux-gnu, arm-linux-gnueabihf, arm-linux-gnueabi, alpha-linux-gnu, powerpc-linux-gnu, sparc64-linux-gnu, sh4-linux-gnu
Comment 5 ian@gcc.gnu.org 2019-12-05 17:51:41 UTC
Author: ian
Date: Thu Dec  5 17:51:10 2019
New Revision: 279010

URL: https://gcc.gnu.org/viewcvs?rev=279010&root=gcc&view=rev
Log:
	PR go/92820
    runtime: always mark assembly file as non-executable stack
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210037

Modified:
    trunk/gcc/go/gofrontend/MERGE
    trunk/libgo/runtime/go-context.S
Comment 6 Ian Lance Taylor 2019-12-05 18:00:11 UTC
Hopefully fixed.  Let me know if not.
Comment 7 Eric Gallager 2019-12-05 22:27:06 UTC
related: bug 28036
Comment 8 Matthias Klose 2019-12-06 00:45:43 UTC
an arm-linux-gnuebaihf build now fails with:

./../../src/libgo/runtime/go-context.S: Assembler messages:
../../../src/libgo/runtime/go-context.S:74: Error: junk at end of line, first unrecognized character is `,'
make[6]: *** [Makefile:1441: runtime/go-context.lo] Error 1
Comment 9 Matthias Klose 2019-12-06 00:47:28 UTC
not fixed on arm-linux-gnuaebi-hf
Comment 10 Matthias Klose 2019-12-06 11:56:29 UTC
that fixes it ...

--- libgo/runtime/go-context.S	(revision 279039)
+++ libgo/runtime/go-context.S	(working copy)
@@ -71,4 +71,8 @@
 
 #endif
 
+#if defined(__ARM_EABI__)
+	.section	.note.GNU-stack,"",%progbits
+#else
 	.section	.note.GNU-stack,"",@progbits
+#endif
Comment 11 Jakub Jelinek 2019-12-06 17:31:15 UTC
As elsewhere, the .note should be guarded on Linux or so, either
#ifdef __linux__
or something similar.  And the second thing is that @progbits is only recognized on some platforms, others need %progbits, but ARM isn't the only one, e.g. AArch64, SH, microblaze, and I believe SPARC Solaris as need that too.  Maybe PA too?
Maybe %progbits works everywhere, e.g. libphobos/libdruntime/config/common/threadasm.S
uses
#if (__linux__ || __FreeBSD__ || __NetBSD__ || __DragonFly__) && __ELF__
    .section .note.GNU-stack,"",%progbits
#endif
Comment 12 ian@gcc.gnu.org 2019-12-06 19:53:20 UTC
Author: ian
Date: Fri Dec  6 19:52:46 2019
New Revision: 279063

URL: https://gcc.gnu.org/viewcvs?rev=279063&root=gcc&view=rev
Log:
	PR go/92820
    runtime: only build go-context for x86 GNU/Linux
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210258

Modified:
    trunk/gcc/go/gofrontend/MERGE
    trunk/libgo/Makefile.am
    trunk/libgo/Makefile.in
Comment 13 Ian Lance Taylor 2019-12-06 20:01:57 UTC
Fixed again.  This time for sure.