Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 712356

Summary: sys-libs/glibc-2.31-r1 : [TEST] FAIL: elf/ifuncmain9picstatic
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://sourceware.org/PR25680
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge-info.txt
emerge-history.txt
environment
etc.portage.tbz2
logs.tbz2
sys-libs:glibc-2.31-r1:20200313-061141.log.bz2
temp.tbz2

Description Toralf Förster gentoo-dev 2020-03-13 10:01:28 UTC
  . argp assert catgets conform crypt csu ctype debug dirent dlfcn elf gmon gnulib grp gshadow hesiod iconv iconvdata inet intl io libio locale localedata login malloc manual math mathvec misc nis nptl nptl_db nscd nss po posix pwd resolv resource rt setjmp shadow signal socket stdio-common stdlib string sunrpc support sysvipc termios time timezone wcsmbs wctype \
  > /var/tmp/portage/sys-libs/glibc-2.31-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/tests.sum
FAIL: elf/ifuncmain9picstatic
FAIL: elf/ifuncmain9static
FAIL: elf/tst-dlopen-self-container
FAIL: elf/tst-dlopen-tlsmodid-container

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_desktop-test-20200310-081612

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-9.2.0 *



Available Python interpreters, in order of preference:
  [1]   python3.7
  [2]   python3.6
  [3]   python3.8 (fallback)
  [4]   python2.7 (fallback)






repository:
==> /var/db/repos/gentoo/metadata/timestamp.chk <==
Fri, 13 Mar 2020 03:38:34 +0000

emerge -qpvO sys-libs/glibc
[ebuild     U ] sys-libs/glibc-2.31-r1 [2.29-r7] USE="(crypt%*) multiarch (multilib) ssp (static-libs%*) test* -audit -caps (-cet) -compile-locales -custom-cflags% -doc -gd -headers-only -nscd -profile (-selinux) -suid -systemtap (-vanilla)"
Comment 1 Toralf Förster gentoo-dev 2020-03-13 10:01:31 UTC
Created attachment 618390 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2020-03-13 10:01:34 UTC
Created attachment 618392 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2020-03-13 10:01:37 UTC
Created attachment 618394 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2020-03-13 10:01:41 UTC
Created attachment 618396 [details]
etc.portage.tbz2
Comment 5 Toralf Förster gentoo-dev 2020-03-13 10:01:43 UTC
Created attachment 618398 [details]
logs.tbz2
Comment 6 Toralf Förster gentoo-dev 2020-03-13 10:01:47 UTC
Created attachment 618400 [details]
sys-libs:glibc-2.31-r1:20200313-061141.log.bz2
Comment 7 Toralf Förster gentoo-dev 2020-03-13 10:01:50 UTC
Created attachment 618402 [details]
temp.tbz2
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-13 22:27:50 UTC
*-container tests would probably not work under sandbox. picstatic test failures worth an extra look at in detail.

Can you fetch all *.out and *.test-result files from the build log?
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-14 00:21:35 UTC
Reproduced 'ifuncmain9static' failure locally. Crash likely happens due to gcc's '--enable-default-ssp' which inject stack check before TLS is initialized.

gdb -q --args ./build-x86-x86_64-pc-linux-gnu-nptl/elf/ifuncmain9static
Reading symbols from ./build-x86-x86_64-pc-linux-gnu-nptl/elf/ifuncmain9static...
(gdb) run
Starting program: /tmp/portage/sys-libs/glibc-2.31-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/ifuncmain9static

Program received signal SIGSEGV, Segmentation fault.
0x08049f1d in resolver () at ifuncmain9.c:47
47	{
(gdb) bt
#0  0x08049f1d in resolver () at ifuncmain9.c:47
#1  0x0804a534 in elf_ifunc_invoke (addr=<optimized out>) at ../sysdeps/i386/dl-irel.h:44
#2  elf_irel (reloc=0x80481c4) at ../sysdeps/i386/dl-irel.h:44
#3  apply_irel () at ../csu/libc-start.c:79
#4  __libc_start_main (main=0x8049750 <main>, argc=1, argv=0xffffca04, init=0x804ad70 <__libc_csu_init>, fini=0x804ae10 <__libc_csu_fini>, rtld_fini=0x0, stack_end=0xffffc9fc)
    at ../csu/libc-start.c:194
#5  0x08049d82 in _start () at ../sysdeps/i386/start.S:113
(gdb) disassemble
Dump of assembler code for function resolver:
   0x08049f10 <+0>:	call   0x8049f55 <__x86.get_pc_thunk.ax>
   0x08049f15 <+5>:	add    $0x9d0eb,%eax
   0x08049f1a <+10>:	sub    $0x1c,%esp
=> 0x08049f1d <+13>:	mov    %gs:0x14,%ecx
   0x08049f24 <+20>:	mov    %ecx,0xc(%esp)
   0x08049f28 <+24>:	xor    %ecx,%ecx
   0x08049f2a <+26>:	mov    0x12dc(%eax),%edx
   0x08049f30 <+32>:	add    $0x1,%edx
   0x08049f33 <+35>:	mov    %edx,0x12dc(%eax)
   0x08049f39 <+41>:	mov    0xc(%esp),%ecx
   0x08049f3d <+45>:	sub    %gs:0x14,%ecx
   0x08049f44 <+52>:	jne    0x8049f50 <resolver+64>
   0x08049f46 <+54>:	lea    -0x9d140(%eax),%eax
   0x08049f4c <+60>:	add    $0x1c,%esp
   0x08049f4f <+63>:	ret
   0x08049f50 <+64>:	call   0x807a830 <__stack_chk_fail>
End of assembler dump.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-14 09:19:56 UTC
We don't enable static-pie in glibc. These tests should not run on such configuration.
Comment 11 Larry the Git Cow gentoo-dev 2020-03-14 09:54:19 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6aac4bf276a0338c18fccd41d48ad7952f0a731

commit a6aac4bf276a0338c18fccd41d48ad7952f0a731
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-03-14 09:26:18 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-03-14 09:54:13 +0000

    sys-libs/glibc: add USE=static-pie to install rcrt1.o
    
    To add support for gcc's -static-pie flag glibc needs
    to provide a few runtile files like rcrt1.o. Let's install
    those when requested.
    
    Noticed when looked at static-pie failures in bug #712356.
    The change should not fix test failures, but will provide
    a way to easily sanity-check static-pie health with minimal
    test.
    
    Bug: https://bugs.gentoo.org/712356
    Package-Manager: Portage-2.3.93, Repoman-2.3.20
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-libs/glibc/glibc-2.31-r1.ebuild | 6 ++++--
 sys-libs/glibc/glibc-9999.ebuild    | 3 ++-
 sys-libs/glibc/metadata.xml         | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-14 11:13:22 UTC
Building glibc with USE=static-pie on glibc with USE=static-pie did not help. static-pie ifunc resolver is likely broken on --enable-default-ssp sompiler.
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-15 10:19:11 UTC
Filed https://sourceware.org/PR25680 for ifuncmain9picstatic / ifuncmain9picstatic test failures.
Comment 14 Larry the Git Cow gentoo-dev 2020-03-15 13:50:54 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=959cf0a3b9fbb0de4181bb128a9c484d9f0153f1

commit 959cf0a3b9fbb0de4181bb128a9c484d9f0153f1
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-03-15 13:50:35 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-03-15 13:50:47 +0000

    sys-libs/glibc: disable container tests, bug #712356
    
    sandbox is not very compatible with filesystem unshare().
    It can't check if mkdir(/proc) is a safe operation under
    unshare/chroot. Let's disable container tests.
    
    One day we can enable them if not running under sandbox.
    
    Shoul deal with the following test failures:
    
        FAIL: elf/tst-dlopen-self-container
        FAIL: elf/tst-dlopen-tlsmodid-container
        FAIL: elf/tst-ifunc-fault-bindnow
        FAIL: elf/tst-ifunc-fault-lazy
        FAIL: elf/tst-ldconfig-bad-aux-cache
        FAIL: elf/tst-ldconfig-ld_so_conf-update
        FAIL: elf/tst-pldd
    
    Reported-by: Toralf Förster
    Bug: https://bugs.gentoo.org/712356
    Package-Manager: Portage-2.3.94, Repoman-2.3.20
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-libs/glibc/glibc-2.31-r1.ebuild | 6 +++++-
 sys-libs/glibc/glibc-9999.ebuild    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
Comment 15 Larry the Git Cow gentoo-dev 2020-03-15 15:46:44 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=551958422d949b8e43393b6c9c00a2ce7c4cc4c6

commit 551958422d949b8e43393b6c9c00a2ce7c4cc4c6
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-03-15 15:17:09 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-03-15 15:46:25 +0000

    sys-libs/glibc: switch -fstack-protector-all to -strong, bug #712356
    
    --enable-stack-protector=all adds protection to functions that don't
    have a chance to corrupt stack. On top of that glibc's own tests fail
    on static IFUNC resolver.
    
    Let's use -fstack-protector-strong which matches Gentoo's gcc default.
    
    Should fix at least the following test failures:
        FAIL: elf/ifuncmain9picstatic
        FAIL: elf/ifuncmain9static
    
    Reported-by: Toralf Förster
    Bug: https://bugs.gentoo.org/712356
    Bug: https://sourceware.org/PR25680
    Package-Manager: Portage-2.3.94, Repoman-2.3.20
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-libs/glibc/glibc-2.31-r1.ebuild | 6 +++++-
 sys-libs/glibc/glibc-9999.ebuild    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
Comment 16 Andreas K. Hüttel archtester gentoo-dev 2020-03-23 21:04:39 UTC
Also fixed in 2.30-r6, so we can close this.
Comment 17 cilly 2020-04-24 03:19:47 UTC
Really? That's not a fix, that's a dirty workaround.
Comment 18 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-24 06:37:42 UTC
(In reply to cilly from comment #17)
> Really? That's not a fix, that's a dirty workaround.

If the fix does not work for you please open a new bug and we will debug it.

Otherwise please work on a proper fix in https://sourceware.org/PR25680 upstream.