Upstream bugs in glibc: https://sourceware.org/bugzilla/show_bug.cgi?id=22016 in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81996 Crash happens at glibc install time and looks like: $ gdb --quiet --args elf/ld.so --library-path . /bin/ls Reading symbols from elf/ld.so...done. (gdb) run Starting program: /root/glibc-build/elf/ld.so --library-path . /bin/ls Program received signal SIGSEGV, Segmentation fault. 0x0fed1df8 in __GI___libc_malloc (bytes=5) at malloc.c:3062 3062 return (*hook)(bytes, RETURN_ADDRESS (0)); (gdb) bt #0 0x0fed1df8 in __GI___libc_malloc (bytes=5) at malloc.c:3062 #1 0x0fe723ec in _nl_normalize_codeset (codeset=codeset@entry=0xffffede1 "UTF-8", name_len=name_len@entry=5) at l10nflist.c:321 #2 0x0fe6b10c in _nl_load_locale_from_archive (category=category@entry=12, namep=namep@entry=0xffffdc64) at loadarchive.c:174 #3 0x0fe69eb0 in _nl_find_locale (locale_path=0x0, locale_path_len=0, category=category@entry=12, name=name@entry=0xffffdc64) at findlocale.c:154 #4 0x0fe69618 in __GI_setlocale (category=<optimized out>, locale=<optimized out>) at setlocale.c:340 #5 0x10001778 in ?? () #6 0x0fe5d9d4 in generic_start_main (main=0x100016e0, argc=1, argv=0xffffe350, auxvec=0xffffe3f0, init=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>, fini=<optimized out>) at ../csu/libc-start.c:306 #7 0x0fe5db98 in __libc_start_main (argc=<optimized out>, argv=<optimized out>, ev=<optimized out>, auxvec=<optimized out>, rtld_fini=<optimized out>, stinfo=<optimized out>, stack_on_entry=<optimized out>) at ../sysdeps/unix/sysv/linux/powerpc/libc-start.c:102 #8 0x00000000 in ?? ()
glibc-2.24 happens to work on powerpc because it was the last version where gentoo did not enable glibc stack protection by default: if version_is_at_least 2.25 ; then myconf+=( --enable-stack-protector=all ) fi
Created attachment 490874 [details, diff] 0001-powerpc-disable-calculation-of-caller-address-in-mal.patch Attached patch that avoids early chars and renders glibc mostly working. '$ make check' output: Summary of test results: 64 FAIL 3659 PASS 8 UNSUPPORTED 29 XFAIL 2 XPASS
(In reply to Sergei Trofimovich from comment #2) > Created attachment 490874 [details, diff] [details, diff] > 0001-powerpc-disable-calculation-of-caller-address-in-mal.patch > > Attached patch that avoids early chars and renders glibc mostly working. > > '$ make check' output: > > Summary of test results: > 64 FAIL > 3659 PASS > 8 UNSUPPORTED > 29 XFAIL > 2 XPASS And it's not ebough. Basic sanity checks pass but emerge still SIGSEGVs.
Bug has been referenced in the following commit: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=604495b43aa4a5b7aed2044b84ca0d88e600d1df commit 604495b43aa4a5b7aed2044b84ca0d88e600d1df Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2017-09-10 09:45:39 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2017-09-10 10:12:18 +0000 glibc: disable stack protector on ARCH=ppc Currently gcc on powerpc32 generates invalid code for __builtin_return_address(0) calls. Normally programs don't do that but malloc() hooks in glibc do: Bug: https://gcc.gnu.org/PR81996 Bug: https://bugs.gentoo.org/629054 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain-glibc.eclass | 14 +++++++++++++- sys-libs/glibc/glibc-2.26-r1.ebuild | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-)