Public bug reported:
The gcc 8 RISC-V cross-compiler on Ubuntu 18.04, in contrast to other
architectures such as ARM and x86, does not use noexecstack by default.
$ riscv64-linux-gnu-gcc-8 --version
'riscv64-linux-gnu-gcc-8 (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ echo "int main() { return 0; }" > test.c
$ riscv64-linux-gnu-gcc-8 test.c -o test
$ readelf -lW test|grep GNU_STACK
(no output)
Expected output:
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW 0x10
$ riscv64-linux-gnu-gcc-8 test.c -c -o test.o
$ scanelf -e test.o
TYPE STK/REL/PTL FILE
ET_REL !WX --- --- test.o
Expected output:
TYPE STK/REL/PTL FILE
ET_REL --- --- --- test.o
$ riscv64-linux-gnu-gcc-8 test.c -o test
I've checked with the RISC-V toolchain on Fedora, and that does set the
correct GNU_STACK permissions.
So I don't think this is expected behavior, and might result in cross-
compiled executables being less hardened than expected.
As a workaround, `-Wl,-z,noexecstack` can be passed to the linker, or
`-Wa,-noexecstack` to gcc.
** Affects: gcc-8-cross-ports (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1853740
Title:
gcc-8-riscv64-linux-gnu produces binaries with executable stack by
default
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-8-cross-ports/+bug/1853740/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs