commit:     b14c692fa08dc7bc53a81d32d36ddb1231769040
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 22:19:47 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Dec  6 22:15:25 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b14c692f

sys-libs/glibc: disable stack protection by default on mips* targets

Otherwise dlopen() crashes (found on 'top' from 'procps' package).

Original backtrace from qemu-mipsn32 (fails the same way on native host):

```
Program received signal SIGSEGV, Segmentation fault.
0x408cb908 in _dlerror_run (operate=operate <AT> entry=0x408cadf0 
<dlopen_doit>, args=args@entry=0x407feb28) at dlerror.c:163
163       result->errcode = _dl_catch_error (&result->objname, 
&result->errstring,
(gdb) bt
 #0  0x408cb908 in _dlerror_run (operate=operate <AT> entry=0x408cadf0 
<dlopen_doit>, args=args@entry=0x407feb28) at dlerror.c:163
 #1  0x408caf4c in __dlopen (file=file <AT> entry=0x10012d58 "libnuma.so", 
mode=mode@entry=1) at dlopen.c:87
 #2  0x1000306c in before (me=0x407ff382 
"/usr/mips64-unknown-linux-gnu/usr/bin/top") at top/top.c:3308
 #3  0x10001a10 in main (dont_care_argc=<optimized out>, argv=0x407ff1a4) at 
top/top.c:5721
```

Reported-by: Matt Turner
Bug: https://bugs.gentoo.org/640130
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/toolchain-glibc.eclass       | 5 +++++
 sys-libs/glibc/glibc-2.26-r3.ebuild | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
index e9cf01cf8c2..6580be2fb1e 100644
--- a/eclass/toolchain-glibc.eclass
+++ b/eclass/toolchain-glibc.eclass
@@ -796,6 +796,11 @@ glibc_do_configure() {
 
        if version_is_at_least 2.25 ; then
                case ${CTARGET} in
+                       mips*)
+                               # dlopen() detects stack smash on mips n32 ABI.
+                               # Cause is unknown: 
https://bugs.gentoo.org/640130
+                               myconf+=( --enable-stack-protector=no )
+                               ;;
                        powerpc-*)
                                # Currently gcc on powerpc32 generates invalid 
code for
                                # __builtin_return_address(0) calls. Normally 
programs

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild 
b/sys-libs/glibc/glibc-2.26-r3.ebuild
index c2f06079940..0edb97902c8 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -316,6 +316,11 @@ glibc_do_configure() {
        popd > /dev/null
 
        case ${CTARGET} in
+               mips*)
+                       # dlopen() detects stack smash on mips n32 ABI.
+                       # Cause is unknown: https://bugs.gentoo.org/640130
+                       myconf+=( --enable-stack-protector=no )
+                       ;;
                powerpc-*)
                        # Currently gcc on powerpc32 generates invalid code for
                        # __builtin_return_address(0) calls. Normally programs

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 60b17cfe67b..e29a0778fd5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -316,6 +316,11 @@ glibc_do_configure() {
        local myconf=()
 
        case ${CTARGET} in
+               mips*)
+                       # dlopen() detects stack smash on mips n32 ABI.
+                       # Cause is unknown: https://bugs.gentoo.org/640130
+                       myconf+=( --enable-stack-protector=no )
+                       ;;
                powerpc-*)
                        # Currently gcc on powerpc32 generates invalid code for
                        # __builtin_return_address(0) calls. Normally programs

Reply via email to