Re: [PATCH 0/2] sparc: Fix IFUNC startup and ldd-trace regressions

"Andreas K. Huettel" <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Gentoo Linux
Message-ID <[email protected]>
> Patch 1 fixes BZ#34396: on a static (non-PIE) binary __libc_setup_tls
> issuse _dl_allocate_tls_init which copies the TLS init image with the
> IFUNC __mempcpy, which now runs before the static IFUNC (IRELATIVE)
> relocations are applied, so the call jumps through an unrelocated PLT
> slot and dies with SIGILL.  It redirects the mem* routines reached on
> that path to their non-IFUNC ultra1 implementations.
[...]
> With an working toolchain, running the sparc testsuite with patch 1 applied
> exposed two further regressions:
> 
>   FAIL: elf/tst-ifunc-fault-bindnow
>   FAIL: elf/tst-ifunc-fault-lazy
> 
> Patch 2 fixes those by proper handling R_SPARC_JMP_IREL.  I also checked
> other ABIs for similar issues and powerpc64 (ELFv1) uses a similar second
> reloc (R_PPC64_JMP_IREL).  The patch fixes it as well.

Tested on sparc64 (catbus) and improves the situation a lot - down to 12 failures
from >200. Feel free to add 

Tested-by: Andreas K. Hüttel <[email protected]>

In detail, the remaining failures are:

FAIL: elf/tst-pldd (*)
FAIL: elf/tst-thp-1
FAIL: elf/tst-thp-1-no-s-code
FAIL: elf/tst-thp-1-no-s-code-pde
FAIL: elf/tst-thp-1-no-s-code-static
FAIL: elf/tst-thp-1-pde
FAIL: elf/tst-thp-1-static
FAIL: elf/tst-thp-align
FAIL: math/test-float64x-float128-mul (*)
FAIL: posix/tst-chmod
FAIL: socket/tst-socket-timestamp (*)
FAIL: stdlib/tst-setcontext2 (*)
                === Summary of results ===
     12 FAIL
   6727 PASS
     70 UNSUPPORTED
     17 XFAIL
      2 XPASS

This machine was offline for a while; my last baseline is 2.41. 
All tests marked (*) above already failed back then. About the remaining 
regressions, all except one seem to be internally an identical problem:

elf/tst-thp-1.out:
===================================
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 6291456 (0x600000); from: from % thp_size
  right: 0 (0x0); from: 0
error: 1 test failures

elf/tst-thp-1-no-s-code.out:
===================================
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 4194304 (0x400000); from: from % thp_size
  right: 0 (0x0); from: 0
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 4194304 (0x400000); from: from % thp_size
  right: 0 (0x0); from: 0
error: 2 test failures

elf/tst-thp-1-no-s-code-pde.out:
===================================
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 2097152 (0x200000); from: from % thp_size
  right: 0 (0x0); from: 0
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 2097152 (0x200000); from: from % thp_size
  right: 0 (0x0); from: 0
error: 2 test failures

elf/tst-thp-1-no-s-code-static.out:
===================================
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 2097152 (0x200000); from: from % thp_size
  right: 0 (0x0); from: 0
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 2097152 (0x200000); from: from % thp_size
  right: 0 (0x0); from: 0
error: 2 test failures

elf/tst-thp-align.out:
===================================
../sysdeps/unix/sysv/linux/tst-thp-align-check.h:59: numeric comparison failure (widths 64 and 32)
   left: 4194304 (0x400000); from: from % thp_size
  right: 0 (0x0); from: 0
error: 1 test failures

posix/tst-chmod.out:
===================================
chmod(".../file",0600) did not set ctime correctly







> 
> The existing tests do not catch it there because they only take the
> resolver's *address*, which powerpc64 emits as R_PPC64_IRELATIVE; the
> JMP_IREL slot is emitted only when the IFUNC is actually *called*. All
> other ABIs use a single IRELATIVE type and are unaffected.
> 
> Adhemerval Zanella (2):
>   sparc: Fix static IFUNC startup crash by redirecting __mempcpy (BZ
>     #34396)
>   elf: Defer arch PLT IFUNC relocations in the two-phase relocation
>     split
> 
>  elf/do-rel.h                                  |  8 ++++++-
>  sysdeps/powerpc/powerpc64/dl-machine.h        |  1 +
>  .../multiarch => }/dl-symbol-redir-ifunc.h    | 13 +++++++++-
>  sysdeps/sparc/sparc32/dl-machine.h            |  1 +
>  sysdeps/sparc/sparc64/dl-machine.h            |  1 +
>  .../sparc64/multiarch/dl-symbol-redir-ifunc.h | 24 -------------------
>  6 files changed, 22 insertions(+), 26 deletions(-)
>  rename sysdeps/sparc/{sparc32/sparcv9/multiarch => }/dl-symbol-redir-ifunc.h (70%)
>  delete mode 100644 sysdeps/sparc/sparc64/multiarch/dl-symbol-redir-ifunc.h
> 
> 


-- 
PD Dr. Andreas K. Hüttel
[email protected]
Gentoo Linux developer 
(council, comrel, toolchain, base-system, perl, libreoffice)
https://wiki.gentoo.org/wiki/User:Dilfridge
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEE/Rnm0xsZLuTcY+rT3CsWIV7VQSoFAmpXdnobFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJENwrFiFe1UEqtGQP/A4+CMWP+xbimxWRWrs9
brdjNPXOW/c4gtcF/gZX3Wq8CP1+Ba0S0j9/pMomzNXOafO7HFcsNXRfNuLUsBiI
Va0Wpf0AknJ59n4m/Qlu8I6e2I6SFn6j0cztBI7c50csxL6BKpN/UWnTMgRind5f
5yIdfnY0dbt4auUrXs6g3WW/uQ9uLSUNyPQQ1mQutn8SoPkzdCD/0IHtIB52AhDD
DecemoKavfp+bsOyQmly1B8IRksr3H/VdOrSdZMW4aOEDew/KVhgVpo7f2JCbBeD
7LTFxPWPMzrAwy7XiOrACgSke45GsJtPSH1N/Vg+7u7bE4CWOKf1wceHJX27FieS
YL8ZC9EzHn9xc71i77q0Jxp8bPWYYgbtvWft/jProrZCX/SuOhSrN25HdNs2YfI3
k9amjU2oNWGjNxtRd7ghakfhGZ5rD3O397IQUU0Faf/E7zxKTU8yLC08sLe8DYhu
bKcOIQoqqxB9Gbs0LpHJwBLZVaPKLySGiToQM2WQgiLJGIYjjxt4TLIq13Jafycq
sAy0TAsyOjbtudSICks2X/WDZjZgL3kYGqZaLEHoi3wH/XvdDfg8ZoDArPAj0zJG
Utr/d+K9av/DUjxxa2SuZOVx8RcUAxGd3IC3gmW0xe0SEKc1lyCKAy8WdsbrILiS
Z7TdfSJhp6CIZoa6rcl+7hsu
=mBuG
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.