platform/upstream/glibc.git
6 years agoFix BZ 20419. A PT_NOTE in a binary could be arbitratily large, so using
Paul Pluzhnikov [Sun, 6 May 2018 01:08:27 +0000 (18:08 -0700)]
Fix BZ 20419.  A PT_NOTE in a binary could be arbitratily large, so using
alloca for it may cause stack overflow.  If the note is larger than
__MAX_ALLOCA_CUTOFF, use dynamically allocated memory to read it in.

2018-05-05  Paul Pluzhnikov  <ppluzhnikov@google.com>

[BZ #20419]
* elf/dl-load.c (open_verify): Fix stack overflow.
* elf/Makefile (tst-big-note): New test.
* elf/tst-big-note-lib.S: New.
* elf/tst-big-note.c: New.

6 years agoIgnore absolute symbols in ABI tests.
Joseph Myers [Fri, 4 May 2018 15:46:32 +0000 (15:46 +0000)]
Ignore absolute symbols in ABI tests.

A recent binutils patch
<https://sourceware.org/ml/binutils/2018-04/msg00336.html> stops the
MIPS linker including the _gp_disp absolute symbol in dynamic symbol
tables.

With older binutils, it is included for MIPS o32 (despite the use of
symbol versioning), and this means that all the ABI test baselines for
MIPS o32 include "_gp_disp _gp_disp A".  This symbol is not
meaningfully part of the ABI for shared libraries, since it always has
to be resolved at static link time to the local definition for the
linked object.

All the other absolute symbols in ABI test baselines are the names of
symbol versions.  I don't think the mere existence of a symbol version
with a given name - as opposed to the contents of that version if
nonempty - is part of the ABI either.  Thus, this patch allows the ABI
tests to pass both before and after the binutils change by changing
abilist.awk not to include absolute symbols in its output, and
changing the baselines accordingly.

Tested for x86_64, and with build-many-glibcs.py.

* scripts/abilist.awk: Ignore absolute symbols.
* sysdeps/mach/hurd/i386/ld.abilist: Remove absolute symbols.
* sysdeps/mach/hurd/i386/libBrokenLocale.abilist: Likewise.
* sysdeps/mach/hurd/i386/libanl.abilist: Likewise.
* sysdeps/mach/hurd/i386/libc.abilist: Likewise.
* sysdeps/mach/hurd/i386/libcrypt.abilist: Likewise.
* sysdeps/mach/hurd/i386/libdl.abilist: Likewise.
* sysdeps/mach/hurd/i386/libm.abilist: Likewise.
* sysdeps/mach/hurd/i386/libnsl.abilist: Likewise.
* sysdeps/mach/hurd/i386/libpthread.abilist: Likewise.
* sysdeps/mach/hurd/i386/libresolv.abilist: Likewise.
* sysdeps/mach/hurd/i386/librt.abilist: Likewise.
* sysdeps/mach/hurd/i386/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libcidn.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_compat.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_dns.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_files.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_hesiod.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_nis.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libnss_nisplus.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libresolv.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libthread_db.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libBrokenLocale-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libanl-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libcrypt-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libdl-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libnsl-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libresolv-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libresolv.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/librt-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libthread_db-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libthread_db.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libutil-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libBrokenLocale.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libutil.abilist: Likewise.

6 years agoFix blocking pthread_join. [BZ #23137]
Stefan Liebler [Fri, 4 May 2018 08:00:59 +0000 (10:00 +0200)]
Fix blocking pthread_join. [BZ #23137]

On s390 (31bit) if glibc is build with -Os, pthread_join sometimes
blocks indefinitely. This is e.g. observable with
testcase intl/tst-gettext6.

pthread_join is calling lll_wait_tid(tid), which performs the futex-wait
syscall in a loop as long as tid != 0 (thread is alive).

On s390 (and build with -Os), tid is loaded from memory before
comparing against zero and then the tid is loaded a second time
in order to pass it to the futex-wait-syscall.
If the thread exits in between, then the futex-wait-syscall is
called with the value zero and it waits until a futex-wake occurs.
As the thread is already exited, there won't be a futex-wake.

In lll_wait_tid, the tid is stored to the local variable __tid,
which is then used as argument for the futex-wait-syscall.
But unfortunately the compiler is allowed to reload the value
from memory.

With this patch, the tid is loaded with atomic_load_acquire.
Then the compiler is not allowed to reload the value for __tid from memory.

ChangeLog:

[BZ #23137]
* sysdeps/nptl/lowlevellock.h (lll_wait_tid):
Use atomic_load_acquire to load __tid.

6 years agox86-64/swapcontext: Restore the pointer into %rdx after syscall
H.J. Lu [Thu, 26 Apr 2018 12:01:20 +0000 (05:01 -0700)]
x86-64/swapcontext: Restore the pointer into %rdx after syscall

To prepare for shadow stack support, restore the pointer into %rdx after
syscall and use %rdx, instead of %rsi, to restore context.  There is no
functional change.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/swapcontext.S (__swapcontext):
Restore the pointer into %rdx, after syscall and use %rdx,
instead of %rsi, to restore context.

6 years agocl
H.J. Lu [Wed, 2 May 2018 13:26:04 +0000 (06:26 -0700)]
cl

6 years agox86-64/setcontext: Pop the pointer into %rdx after syscall
H.J. Lu [Wed, 2 May 2018 13:21:09 +0000 (06:21 -0700)]
x86-64/setcontext: Pop the pointer into %rdx after syscall

To prepare for shadow stack support, pop the pointer into %rdx after
syscall and use %rdx, instead of %rsi, to restore context.  There is
no functional change.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/setcontext.S (__setcontext):
Pop the pointer into %rdx after syscall and use %rdx, instead
of %rsi, to restore context.

6 years agox86: Use pad in pthread_unwind_buf to preserve shadow stack register
H.J. Lu [Wed, 2 May 2018 13:17:20 +0000 (06:17 -0700)]
x86: Use pad in pthread_unwind_buf to preserve shadow stack register

The pad array in struct pthread_unwind_buf is used by setjmp to save
shadow stack register.  We assert that size of struct pthread_unwind_buf
is no less than offset of shadow stack pointer + shadow stack pointer
size.

Since functions, like LIBC_START_MAIN, START_THREAD_DEFN as well as
these with thread cancellation, call setjmp, but never return after
__libc_unwind_longjmp, __libc_unwind_longjmp, which is defined as
__libc_longjmp on x86, doesn't need to restore shadow stack register.
__libc_longjmp, which is a private interface for thread cancellation
implementation in libpthread, is changed to call __longjmp_cancel,
instead of __longjmp.  __longjmp_cancel is a new internal function
in libc, which is similar to __longjmp, but doesn't restore shadow
stack register.

The compatibility longjmp and siglongjmp in libpthread.so are changed
to call __libc_siglongjmp, instead of __libc_longjmp, so that they will
restore shadow stack register.

Tested with build-many-glibcs.py.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nptl/pthread_create.c (START_THREAD_DEFN): Clear previous
handlers after setjmp.
* setjmp/longjmp.c (__libc_longjmp): Don't define alias if
defined.
* sysdeps/unix/sysv/linux/x86/setjmpP.h: Include
<libc-pointer-arith.h>.
(_JUMP_BUF_SIGSET_BITS_PER_WORD): New.
(_JUMP_BUF_SIGSET_NSIG): Changed to 96.
(_JUMP_BUF_SIGSET_NWORDS): Changed to use ALIGN_UP and
_JUMP_BUF_SIGSET_BITS_PER_WORD.
* sysdeps/x86/Makefile (sysdep_routines): Add __longjmp_cancel.
* sysdeps/x86/__longjmp_cancel.S: New file.
* sysdeps/x86/longjmp.c: Likewise.
* sysdeps/x86/nptl/pt-longjmp.c: Likewise.

6 years agoFix ChangeLog from cf2478d53ad commit
Adhemerval Zanella [Wed, 2 May 2018 12:06:34 +0000 (09:06 -0300)]
Fix ChangeLog from cf2478d53ad commit

6 years agoDeprecate ustat syscall interface
Adhemerval Zanella [Sun, 18 Mar 2018 03:28:59 +0000 (11:28 +0800)]
Deprecate ustat syscall interface

As for sysctl, ustat has been deprecated in favor of {f}statfs.  Also
some newer ports which uses generic interface builds a stub version that
returns ENOSYS.

This patch deprecates ustat interface by removing ustat.h related headers,
adding a compatibility symbol, and avoiding new ports to build and provide
the symbol.

Checked on x86_64-linux-gnu and i686-linux-gnu.  Also checked with a
check-abi on all affected ABIs.

* NEWS: Add ustat.h deprecation entry.
* bits/ustat.h: Remove file.
* misc/sys/ustat.h: Likewise.
* misc/ustat.h: Likewise.
* sysdeps/unix/sysv/linux/generic/ustat.c: Likewise.
* misc/Makefile (headers): Remove ustat.h and sys/ustat.h.
* misc/ustat.c (__ustat): Rename to __old_ustat and export only in
compatibility mode.
* sysdeps/unix/sysv/linux/ustat.c (__ustat): Likewise.
* sysdeps/unix/sysv/linux/mips/ustat.c: Define DEV_TO_KDEV and use
generic Linux implementation.

6 years agoReplace hidden_def with libm_hidden_def in math
Tulio Magno Quites Machado Filho [Mon, 30 Apr 2018 14:45:42 +0000 (11:45 -0300)]
Replace hidden_def with libm_hidden_def in math

libm_hidden_def expand the parameters and do not require an extra layer
of macros.
These were the last 3 files in math/ still using hidden_def().

* math/w_exp_compat.c: Replace hidden_def with libm_hidden_def..
* math/w_expl_compat.c: Likewise.
* math/w_exp_template.c: Likewise.  Remove hidden_def_x.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
6 years agomanual/startup.texi (Aborting a Program): Remove inappropriate joke.
Raymond Nicholson [Mon, 30 Apr 2018 14:41:44 +0000 (10:41 -0400)]
manual/startup.texi (Aborting a Program): Remove inappropriate joke.

6 years agoConsolidate Linux readahead implementation
Adhemerval Zanella [Sun, 22 Apr 2018 20:55:11 +0000 (17:55 -0300)]
Consolidate Linux readahead implementation

This patch consolidate Linux readahead implementation on generic
sysdeps/unix/sysv/linux/readahead.c one.  The changes are:

  - Assume __NR_readahead existence with current minimum kernel of 3.2
    for all architectures.

  - Use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG, and SYSCALL_LL64 to pass
    the 64 bit offset.  This allows architectures with different abis
    to use the same implementation.

  - Remove arch-specific readahead implementations.

Checked on x86_64-linux-gnu and i686-linux-gnu.

* sysdeps/unix/sysv/linux/arm/readahead.c: Remove file.
* sysdeps/unix/sysv/linux/mips/mips32/readahead.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (readahead):
Remove.
* sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/readahead.c (__readahead): Assume
__NR_readahead existence, and use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG,
and SYSCALL_LL64.

6 years agoReplace M_SUF (M_LN2) with M_MLIT (M_LN2)
Tulio Magno Quites Machado Filho [Fri, 27 Apr 2018 12:56:48 +0000 (09:56 -0300)]
Replace M_SUF (M_LN2) with M_MLIT (M_LN2)

According to math-type-macros.h, M_SUF should be used to paste the
suffix used by functions, while M_MLIT is used with macro constants.

* math/e_exp2_template.c: Replace M_SUF (M_LN2) with M_MLIT (M_LN2).

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
6 years agoReplace M_SUF (fabs) with M_FABS
Tulio Magno Quites Machado Filho [Fri, 27 Apr 2018 12:56:35 +0000 (09:56 -0300)]
Replace M_SUF (fabs) with M_FABS

math-type-macros.h provides the macro M_FABS in order to reference
the correct fabs function for a specific type.
In most of the cases, M_FABS is identical to M_SUF (fabs), but that
may change in the future.

* math/w_acos_template.c: Replace M_SUF (fabs) with M_FABS.
* math/w_asin_template.c: Likewise.
* math/w_atanh_template.c: Likewise.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
6 years agopowerpc64*: fix the order of implied sysdeps directories
Gabriel F. T. Gomes [Fri, 9 Mar 2018 19:59:14 +0000 (16:59 -0300)]
powerpc64*: fix the order of implied sysdeps directories

The creation of the divergent sysdeps directory for powerpc64le

commit 2f7f3cd8cd302bb10908c86f3f7b349df0a78e6a
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Fri Jul 15 18:04:40 2016 -0500

    powerpc64le: Create divergent sysdep directory for powerpc64le.

allowed float128 to be enabled for powerpc64le (little-endian) and not
for powerpc64 (big-endian).  Since the only intended difference between
them was the presence or absence of the float128 interface, the sysdeps
directory for powerpc64le explicitly reused the files from powerpc64
(through the use of Implies files).

Although this works, it also means that files under the powerpc64
directory might be preferred over files under powerpc64le.  For
instance, on a build for powerpc64le with target set to power9, a file
from powerpc64/power5 might get built, even though a file with the same
name exists in powerpc64le/power8.  That happens because the processor
hierarchy was only defined in the sysdeps directory for powerpc64 (and
borrowed by powerpc64le).

This patch fixes this behavior, by creating new subdirectories under
powerpc64 (i.e.: powerpc64/be and powerpc64/le) and creating new Implies
files to provide the hierarchy of processors for powerpc64 and
powerpc64le separately.  These changes have no effect on installed,
stripped binaries (which remain unchanged).

Tested that installed stripped binaries are unchanged and that there are
no regressions on powerpc64 and powerpc64le.

6 years agoRemove tilegx port.
Joseph Myers [Fri, 27 Apr 2018 19:11:24 +0000 (19:11 +0000)]
Remove tilegx port.

Since tile support has been removed from the Linux kernel for 4.17,
this patch removes the (unmaintained) port to tilegx from glibc (the
tilepro support having been previously removed).  This reflects the
general principle that a glibc port needs upstream support for the
architecture in all the components it build-depends on (so binutils,
GCC and the Linux kernel, for the normal case of a port supporting the
Linux kernel but no other OS), in order to be maintainable.

Apart from removal of sysdeps/tile and sysdeps/unix/sysv/linux/tile,
there are updates to various comments referencing tile for which
removal of those references seemed appropriate.  The configuration is
removed from README and from build-many-glibcs.py.  contrib.texi keeps
mention of removed contributions, but I updated Chris Metcalf's entry
to reflect that he also contributed the non-removed support for the
generic Linux kernel syscall interface.
__ASSUME_FADVISE64_64_NO_ALIGN support is removed, as it was only used
by tile.

* sysdeps/tile: Remove.
* sysdeps/unix/sysv/linux/tile: Likewise.
* README (tilegx-*-linux-gnu): Remove from list of supported
configurations.
* manual/contrib.texi (Contributors): Mention Chris Metcalf's
contribution of support for generic Linux kernel syscall
interface.
* scripts/build-many-glibcs.py (Context.add_all_configs): Remove
tilegx configurations.
(Config.install_linux_headers): Do not handle tile.
* sysdeps/unix/sysv/linux/aarch64/ldsodefs.h: Do not mention Tile
in comment.
* sysdeps/unix/sysv/linux/nios2/Makefile: Likewise.
* sysdeps/unix/sysv/linux/posix_fadvise.c: Likewise.
[__ASSUME_FADVISE64_64_NO_ALIGN] (__ALIGNMENT_ARG): Remove
conditional undefine and redefine.
* sysdeps/unix/sysv/linux/posix_fadvise64.c: Do not mention Tile
in comment.
[__ASSUME_FADVISE64_64_NO_ALIGN] (__ALIGNMENT_ARG): Remove
conditional undefine and redefine.

6 years agoAdd tst-sigaction.c to test BZ #23069
Aurelien Jarno [Thu, 26 Apr 2018 20:21:13 +0000 (22:21 +0200)]
Add tst-sigaction.c to test BZ #23069

This simple test uses sigaction to define a signal handler. It then
uses sigaction again to fetch the information about the same signal
handler, and check that they are consistent. This is enough to detect
mismatches between struct kernel_sigaction and the kernel version of
struct sigaction, like in BZ #23069.

Changelog:
       * signal/tst-sigaction.c: New file to test BZ #23069.
       * signal/Makefile (tests): Fix indentation. Add tst-sigaction.

6 years agoIncrease robustness of internal dlopen() by using RTLD_NOW [BZ #22766]
Tulio Magno Quites Machado Filho [Thu, 26 Apr 2018 13:41:43 +0000 (10:41 -0300)]
Increase robustness of internal dlopen() by using RTLD_NOW [BZ #22766]

Prevent random runtime crashes due to missing symbols caused by mixed
libnss_* versions.

[BZ #22766]
* include/dlfcn.h [__libc_dl_open]: Replace RTLD_LAZY with RTLD_NOW.
* sysdeps/gnu/unwind-resume.c (__lib_gcc_s_init): Replace
__libc_dlopen_mode() using RTLD_NOW with __libc_dlopen.
* sysdeps/nptl/unwind-forcedunwind.c: Likewise.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoConsolidate getdirentries{64} implementation
Adhemerval Zanella [Thu, 1 Mar 2018 21:22:16 +0000 (18:22 -0300)]
Consolidate getdirentries{64} implementation

This patch consolidates Linux getdirentries{64} implementation on just
the default sysdeps/unix/sysv/linux/getdirentries{64} ones.  The default
implementation handles the Linux requirements:

  * getdirentries is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * getdirentries64 is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, and
powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/getdirentries.c (getdirentries): Build iff
_DIRENT_MATCHES_DIRENT64 is not defined.
* sysdeps/unix/sysv/linux/getdirentries64.c (getdirentries64): Open
implementation and alias to getdirentries if _DIRENT_MATCHES_DIRENT64
is defined.
* sysdeps/unix/sysv/linux/wordsize-64/getdirentries.c: Remove file.
* sysdeps/unix/sysv/linux/wordsize-64/getdirentries64.c: Remove file.

6 years agoUse GCC 8 in build-many-glibcs.py by default.
Joseph Myers [Wed, 25 Apr 2018 15:05:01 +0000 (15:05 +0000)]
Use GCC 8 in build-many-glibcs.py by default.

Now that GCC 8 has branched, this patch makes build-many-glibcs.py
default to using GCC 8 branch instead of GCC 7.  The effect should be
that all builds complete cleanly and the compilation parts of the
glibc testsuite complete cleanly except for on i686-gnu (with GCC 7
there were testsuite failures for some other configurations as well).

I've replaced my bot building using GCC 6 branch with one using GCC 8
branch.  (Of course glibc should continue building with GCC 6 - and
for that matter GCC 5 and 4.9, which are no longer maintained, are
supported versions as well - but building with GCC 6 will no longer be
included in my bot testing.)

* scripts/build-many-glibcs.py (Context.checkout): Default GCC
version to GCC 8 branch.

6 years agoFix Hurd glibc build with GCC 8.
Joseph Myers [Tue, 24 Apr 2018 16:33:47 +0000 (16:33 +0000)]
Fix Hurd glibc build with GCC 8.

The build of glibc for Hurd has been failing with GCC mainline because
of the checks that aliases have the same type as the symbol aliased;
the Hurd dl-sysdep.c has a macro that defines aliases without using
the proper type.  When GCC 8 branches (soon), I intend to make it the
default version in build-many-glibcs.py, so these failures would mean
the default build-many-glibcs.py build fails for Hurd again.

This patch fixes the Hurd build with GCC 8 by changing the macro that
defines the problem aliases to use the correct type for them.  An
include of <not-errno.h> is needed to avoid this use of typeof
resulting in an error for __access_noerrno not being declared.

Tested compilation for i686-gnu with build-many-glibcs.py.

* sysdeps/mach/hurd/dl-sysdep.c: Include <not-errno.h>.
(check_no_hidden): Use type of original function when declaring
alias.

6 years agoFix tst-strfmon_l test for hr_HR locale
Mike FABIAN [Tue, 24 Apr 2018 13:04:43 +0000 (15:04 +0200)]
Fix tst-strfmon_l test for hr_HR locale

The test needs to be adapted for the change in the thousands separators:

“hr_HR locale: fix thousands_sep and mon_thousands_sep” [BZ #23094]

6 years agoAdd PTRACE_SECCOMP_GET_METADATA from Linux 4.16 to sys/ptrace.h.
Joseph Myers [Tue, 24 Apr 2018 12:11:35 +0000 (12:11 +0000)]
Add PTRACE_SECCOMP_GET_METADATA from Linux 4.16 to sys/ptrace.h.

This patch adds the PTRACE_SECCOMP_GET_METADATA constant from Linux
4.16 to all relevant sys/ptrace.h files.  A type struct
__ptrace_seccomp_metadata, analogous to other such types, is also
added.

Tested for x86_64, and with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): New enum value and macro.
* sysdeps/unix/sysv/linux/bits/ptrace-shared.h
(struct __ptrace_seccomp_metadata): New type.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/arm/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/x86/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.

6 years agoConsolidate alphasort{64} and versionsort{64} implementation
Adhemerval Zanella [Thu, 1 Mar 2018 20:09:42 +0000 (17:09 -0300)]
Consolidate alphasort{64} and versionsort{64} implementation

This patch consolidates both alphasort{64} and versionsort{64}
implementation on just the default dirent/alphasort{64}c and
dirent/versionsort{64} respectively.  It changes the logic
to follow the conventions used on other code consolidation:

  * the non-LFS variant is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * the LFS variant is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

Also on Linux the compat symbol for old non-LFS dirent64 definition
requires a platform-specific scandir64.c.  For powerpc32 and sparcv9
it requires to add specific arch-implementation to override the
generic Linux one because neither ABI exports an compat symbol for
non-LFS alphasort64 and versionsort64 variant.  It is most likely a
bug and it is also not one that can be fixed (in that there would be
existing binaries expecting both meanings of that symbol at its single
existing version, with binaries expecting the new meaning probably much
more common than those expecting the original meaning of that symbol at
that version).

Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, and
powerpc64le-linux-gnu.

* dirent/alphasort.c (alphasort): Build iff _DIRENT_MATCHES_DIRENT64 is
defined.
* dirent/versionsort.c (versionsort): Likewise.
* dirent/alphasort64.c (alphasort64): Build regardless and alias to
alphasort if _DIRENT_MATCHES_DIRENT64 is defined.
* dirent/versionsort64.c (versionsort64): Likewise.
* sysdeps/unix/sysv/linux/i386/alphasort64.c: Remove file.
* sysdeps/unix/sysv/linux/arm/alphasort64.c: Likewise.
* sysdeps/unix/sysv/linux/arm/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/alphasort64.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/alphasort64.c: New file.
* sysdeps/unix/sysv/linux/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/alphasort64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/alphasort64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/versionsort64.c: Likewise.

6 years agoAdd NT_PPC_PKEY from Linux 4.16 to elf.h.
Joseph Myers [Mon, 23 Apr 2018 19:41:09 +0000 (19:41 +0000)]
Add NT_PPC_PKEY from Linux 4.16 to elf.h.

This patch adds the NT_PPC_PKEY macro from Linux 4.16 to elf.h.

Tested for x86_64.

* elf/elf.h (NT_PPC_PKEY): New macro.

6 years agoNEWS: Reindent and copyedit
Zack Weinberg [Mon, 23 Apr 2018 15:25:19 +0000 (11:25 -0400)]
NEWS: Reindent and copyedit

Make the indentation of the "Deprecated and removed features" section
for 2.28 consistent with the indentation of the "Major new features"
section above.  Also, consistently refer to "stdio functions" instead
of "stdio.h functions".

6 years agohr_HR locale: fix thousands_sep and mon_thousands_sep
Dragan Stanojevic - Nevidljivi [Mon, 23 Apr 2018 14:54:31 +0000 (16:54 +0200)]
hr_HR locale: fix thousands_sep and mon_thousands_sep

[BZ #23094]
* localedata/locales/hr_HR: fix thousands_sep and
mon_thousands_sep

6 years agoDefine XTABS to TAB3 on alpha to match Linux 4.16.
Joseph Myers [Fri, 20 Apr 2018 19:52:02 +0000 (19:52 +0000)]
Define XTABS to TAB3 on alpha to match Linux 4.16.

This patch makes the alpha bits/termios.h define XTABS to TAB3, so
matching a change made in Linux 4.16 as well as matching other
architectures where the values are already equal.

Tested with build-many-glibcs.py for alpha-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_MISC]
(XTABS): Define to TAB3.

6 years agoUpdate hppa libm-test-ulps
Adhemerval Zanella [Fri, 20 Apr 2018 18:36:41 +0000 (15:36 -0300)]
Update hppa libm-test-ulps

* sysdeps/hppa/fpu/libm-test-ulps: Update.

6 years agoConsolidate scandir{at}{64} implementation
Adhemerval Zanella [Thu, 1 Mar 2018 12:04:41 +0000 (09:04 -0300)]
Consolidate scandir{at}{64} implementation

This patch consolidates scandir{at}{64} implementation on just
the default dirent/scandir{at}{64}{_r}.c ones.  It changes the logic
to follow the conventions used on other code consolidation:

  * scandir{at} is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * scandir{at}{64} is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

Also on Linux the compat symbol for old non-LFS dirent64 definition
requires a platform-specific scandir64.c.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, and
powerpc64le-linux-gnu.

* dirent/scandir-tail-common.c: New file.
* dirent/scandir-tail.c: Use scandir-tail-common.c.
(__scandir_tail): Build iff _DIRENT_MATCHES_DIRENT64 is not defined.
* dirent/scandir.c: Use scandir-tail-common.c.
* dirent/scandirat.c: Likewise.
* dirent/scandir64-tail.c: Use scandir-tail-common.c.
* dirent/scandir64.c (scandir64): Always build and alias to scandir
if _DIRENT_MATCHES_DIRENT64 is defined.
* dirent/scandirat64.c (scandirat64): Likewise.
* include/dirent.h (__scandir_tail): Only define iff
_DIRENT_MATCHES_DIRENT64 is not defined.
(__scandir64_tail): Define regardless.
(__scandirat, scandirat64): Remove libc_hidden_proto.
* sysdeps/unix/sysv/linux/arm/scandir64.c: Remove file.
* sysdeps/unix/sysv/linux/m68k/scandir64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/scandir64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/scandir64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c: Likewise.
* sysdeps/unix/sysv/linux/scandir64.c: New file.

6 years agoUpdate aarch64 bits/hwcap.h, dl-procinfo.c for Linux 4.16 HWCAP_ASIMDFHM.
Joseph Myers [Fri, 20 Apr 2018 16:36:00 +0000 (16:36 +0000)]
Update aarch64 bits/hwcap.h, dl-procinfo.c for Linux 4.16 HWCAP_ASIMDFHM.

This patch updates the aarch64 bits/hwcap.h and dl-procinfo.c for the
new HWCAP_ASIMDFHM value in Linux 4.16.

Tested with build-many-glibcs.py for aarch64-linux-gnu.

* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_ASIMDFHM):
New macro.
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
Increase to 24.
(_dl_aarch64_cap_flags): Add asimdfhm.

6 years agohurd xfails: Add missing bug references
Samuel Thibault [Fri, 20 Apr 2018 15:14:13 +0000 (17:14 +0200)]
hurd xfails: Add missing bug references

6 years agohurd: XFAIL tests for signal features not implemented yet
Samuel Thibault [Thu, 19 Apr 2018 23:18:22 +0000 (01:18 +0200)]
hurd: XFAIL tests for signal features not implemented yet

* conform/data/signal.h-data (SA_SIGINFO, SA_NOCLDWAIT): XFAIL on
i386-gnu.
* conform/data/sys/wait.h-data (WIFCONTINUED, WEXITED, WSTOPPED,
WCONTINUED, WNOWAIT): XFAIL on i386-gnu.

6 years agohurd: XFAIL appearance of sched_param and sched_priority from <sys/types.h>
Samuel Thibault [Thu, 19 Apr 2018 20:05:13 +0000 (22:05 +0200)]
hurd: XFAIL appearance of sched_param and sched_priority from <sys/types.h>

Reported at BZ #23088.

* sysdeps/mach/hurd/i386/Makefile
(test-xfail-POSIX/fcntl.h/conform): Add.
(test-xfail-POSIX/signal.h/conform): Add.
(test-xfail-POSIX/semaphore.h/conform): Add.
(test-xfail-POSIX/regex.h/conform): Add.
(test-xfail-POSIX/aio.h/conform): Add.
(test-xfail-POSIX/mqueue.h/conform): Add.
(test-xfail-POSIX/sys/types.h/conform): Add.
(test-xfail-UNIX98/fcntl.h/conform): Add.
(test-xfail-UNIX98/netdb.h/conform): Add.
(test-xfail-UNIX98/signal.h/conform): Add.
(test-xfail-UNIX98/semaphore.h/conform): Add.
(test-xfail-UNIX98/regex.h/conform): Add.
(test-xfail-UNIX98/aio.h/conform): Add.
(test-xfail-UNIX98/ftw.h/conform): Add.
(test-xfail-UNIX98/mqueue.h/conform): Add.
(test-xfail-UNIX98/netinet/in.h/conform): Add.
(test-xfail-UNIX98/sys/wait.h/conform): Add.
(test-xfail-UNIX98/sys/sem.h/conform): Add.
(test-xfail-UNIX98/sys/uio.h/conform): Add.
(test-xfail-UNIX98/sys/socket.h/conform): Add.
(test-xfail-UNIX98/sys/types.h/conform): Add.
(test-xfail-UNIX98/stdlib.h/conform): Add.
(test-xfail-UNIX98/arpa/inet.h/conform): Add.
(test-xfail-POSIX2008/fcntl.h/conform): Add.
(test-xfail-POSIX2008/netdb.h/conform): Add.
(test-xfail-POSIX2008/signal.h/conform): Add.
(test-xfail-POSIX2008/semaphore.h/conform): Add.
(test-xfail-POSIX2008/regex.h/conform): Add.
(test-xfail-POSIX2008/aio.h/conform): Add.
(test-xfail-POSIX2008/mqueue.h/conform): Add.
(test-xfail-POSIX2008/netinet/in.h/conform): Add.
(test-xfail-POSIX2008/sys/wait.h/conform): Add.
(test-xfail-POSIX2008/sys/socket.h/conform): Add.
(test-xfail-POSIX2008/sys/types.h/conform): Add.
(test-xfail-POSIX2008/arpa/inet.h/conform): Add.
(test-xfail-XOPEN2K/fcntl.h/conform): Add.
(test-xfail-XOPEN2K/netdb.h/conform): Add.
(test-xfail-XOPEN2K/signal.h/conform): Add.
(test-xfail-XOPEN2K/semaphore.h/conform): Add.
(test-xfail-XOPEN2K/regex.h/conform): Add.
(test-xfail-XOPEN2K/aio.h/conform): Add.
(test-xfail-XOPEN2K/ftw.h/conform): Add.
(test-xfail-XOPEN2K/mqueue.h/conform): Add.
(test-xfail-XOPEN2K/netinet/in.h/conform): Add.
(test-xfail-XOPEN2K/sys/wait.h/conform): Add.
(test-xfail-XOPEN2K/sys/sem.h/conform): Add.
(test-xfail-XOPEN2K/sys/uio.h/conform): Add.
(test-xfail-XOPEN2K/sys/socket.h/conform): Add.
(test-xfail-XOPEN2K/sys/types.h/conform): Add.
(test-xfail-XOPEN2K/stdlib.h/conform): Add.
(test-xfail-XOPEN2K/arpa/inet.h/conform): Add.
(test-xfail-XOPEN2K8/fcntl.h/conform): Add.
(test-xfail-XOPEN2K8/netdb.h/conform): Add.
(test-xfail-XOPEN2K8/signal.h/conform): Add.
(test-xfail-XOPEN2K8/semaphore.h/conform): Add.
(test-xfail-XOPEN2K8/regex.h/conform): Add.
(test-xfail-XOPEN2K8/aio.h/conform): Add.
(test-xfail-XOPEN2K8/ftw.h/conform): Add.
(test-xfail-XOPEN2K8/mqueue.h/conform): Add.
(test-xfail-XOPEN2K8/netinet/in.h/conform): Add.
(test-xfail-XOPEN2K8/sys/wait.h/conform): Add.
(test-xfail-XOPEN2K8/sys/sem.h/conform): Add.
(test-xfail-XOPEN2K8/sys/uio.h/conform): Add.
(test-xfail-XOPEN2K8/sys/socket.h/conform): Add.
(test-xfail-XOPEN2K8/sys/types.h/conform): Add.
(test-xfail-XOPEN2K8/stdlib.h/conform): Add.
(test-xfail-XOPEN2K8/arpa/inet.h/conform): Add.

6 years agoRevert "hurd: Fix mach installed headers test"
Samuel Thibault [Thu, 19 Apr 2018 22:54:18 +0000 (00:54 +0200)]
Revert "hurd: Fix mach installed headers test"

This reverts commit d4379e0216d01fd1395b1f3b37255e3486760135: the proper
headers are actually already getting installed.

6 years agoDrop fpregset unused symbol exposition
Samuel Thibault [Thu, 19 Apr 2018 22:10:55 +0000 (00:10 +0200)]
Drop fpregset unused symbol exposition

* sysdeps/arm/sys/ucontext.h: Remove fpregset struct name, unused and
non-compliant.
* sysdeps/i386/sys/ucontext.h: Likewise.
* sysdeps/m68k/sys/ucontext.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise.

6 years agohurd: Fix hurd installed headers test
Samuel Thibault [Thu, 19 Apr 2018 22:16:40 +0000 (00:16 +0200)]
hurd: Fix hurd installed headers test

* sysdeps/hurd/include/hurd.h [!_ISOMAC]: Do not declare libc hidden
prototypes.
* sysdeps/hurd/include/hurd/fd.h [!_ISOMAC]: Likewise.
* sysdeps/hurd/include/hurd/signal.h [!_ISOMAC]: Likewise.

6 years agohurd: Add missing RLIM_SAVED_MAX/CUR
Samuel Thibault [Thu, 19 Apr 2018 21:55:13 +0000 (23:55 +0200)]
hurd: Add missing RLIM_SAVED_MAX/CUR

* bits/resource.h (RLIM_SAVED_MAX, RLIM_SAVED_CUR): New macros.

6 years agohurd: Fix termios.h symbols
Samuel Thibault [Thu, 19 Apr 2018 21:50:12 +0000 (23:50 +0200)]
hurd: Fix termios.h symbols

* bits/termios.h [__USE_XOPEN || __USE_XOPEN2K8] (IXANY): Define.
[__USE_XOPEN && !__USE_XOPEN2K] (IUCLC, OLCUC): Define.
[__USE_XOPEN] (OFDEL): New macro.
[__USE_XOPEN && !__USE_XOPEN2K] (XCASE): New macro.

6 years agohurd: remove non-standard siginfo symbol
Samuel Thibault [Thu, 19 Apr 2018 19:34:07 +0000 (21:34 +0200)]
hurd: remove non-standard siginfo symbol

* bits/types/siginfo_t.h: Remove siginfo struct name, unused and
non-compliant.

6 years agohurd: fix sigevent's sigev_notify_attributes field type
Samuel Thibault [Thu, 19 Apr 2018 18:55:12 +0000 (20:55 +0200)]
hurd: fix sigevent's sigev_notify_attributes field type

* sysdeps/pthread/bits/types/sigevent_t.h: New file, based on the
generic version but include <bits/pthreadtypes.h> to make struct
sigevent's sigev_notify_attributes field a pthread_attr_t*.

6 years agoUpdate sysdeps/nios2/libm-test-ulps
Chung-Lin Tang [Thu, 19 Apr 2018 19:00:58 +0000 (12:00 -0700)]
Update sysdeps/nios2/libm-test-ulps

6 years agohurd: Avoid exposing all <sched.h> symbols from sys/types.h
Samuel Thibault [Thu, 19 Apr 2018 18:21:33 +0000 (20:21 +0200)]
hurd: Avoid exposing all <sched.h> symbols from sys/types.h

* bits/sched.h: Include <bits/types/struct_sched_param.h> and move struct
sched_param definition to it.
* sysdeps/unix/sysv/linux/bits/sched.h: Likewise.
* bits/types/struct_sched_param.h: New file.
* sysdeps/htl/bits/types/struct___pthread_attr.h: Include
<bits/types/struct_sched_param.h> instead of <sched.h>.
* posix/Makefile (headers): Add bits/types/struct_sched_param.h.

6 years agoFix mips64n32 getdents alias
Adhemerval Zanella [Thu, 19 Apr 2018 18:19:19 +0000 (15:19 -0300)]
Fix mips64n32 getdents alias

Fix commit 298d0e3 for mips64n32, checked on a mips64n32-linux-gnu build.

* sysdeps/unix/sysv/linux/mips/mips64/getdents64.c (__getdents64):
Only alias to __getdents for _DIRENT_MATCHES_DIRENT64.

6 years agohurd: Fix symbols exposition
Samuel Thibault [Thu, 19 Apr 2018 18:14:45 +0000 (20:14 +0200)]
hurd: Fix symbols exposition

* bits/in.h [!__USE_MISC]: Do not define struct ip_opts.
* conform/data/netinet/in.h-data: Allow sin_ and sin6_ prefix.
* sysdeps/gnu/bits/msq.h (struct msqid_ds): Use __wait_queue struct
instead of wait_queue.
* sysdeps/gnu/bits/shm.h (struct shmid_ds): Use __vm_area_struct
instead of vm_area_struct.

6 years agoConsolidate Linux getdents{64} implementation
Adhemerval Zanella [Wed, 28 Feb 2018 18:37:17 +0000 (15:37 -0300)]
Consolidate Linux getdents{64} implementation

This patch consolidates Linux getdents{64} implementation on just
the default sysdeps/unix/sysv/linux/getdents{64}{_r}.c ones.

Although this symbol is used only internally, the non-LFS version
still need to be build due the non-LFS getdirentries which requires
its semantic.

The non-LFS default implementation now uses the wordsize-32 as base
which uses getdents64 syscall plus adjustment for overflow (it allows
to use the same code for architectures that does not support non-LFS
getdents syscall).  It has two main differences to wordsize-32 one:

  - DIRENT_SET_DP_INO is added to handle alpha requirement to zero
    the padding.

  - alloca is removed by allocating a bounded temporary buffer (it
    increases stack usage by roughly 276 bytes).

The default implementation handle the Linux requirements:

  * getdents is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * getdents64 is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

  * A compat symbol is added for getdents64 for ABI that used to
    export the old non-LFS version.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, and
powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/getdents.c: Add comments with alpha
requirements.
 (_DIRENT_MATCHES_DIRENT64): Undef
* sysdeps/unix/sysv/linux/alpha/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/arm/getdents64.c: Remove file.
* sysdeps/unix/sysv/linux/generic/getdents.c: Likewise.
* sysdeps/unix/sysv/linux/generic/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/getdents.c: Likewise.
* sysdeps/unix/sysv/linux/getdents.c: Simplify implementation by
use getdents64 syscalls as base.
* sysdeps/unix/sysv/linux/getdents64.c: Likewise and add compatibility
symbol if required.
* sysdeps/unix/sysv/linux/hppa/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/getdents.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
(__get_clockfreq_via_proc_openprom): Use __getdents64.
* sysdeps/unix/sysv/linux/mips/mips64/getdents64.c: New file.

6 years agoDisable lock elision for mutex pretty printer tests.
Stefan Liebler [Thu, 19 Apr 2018 10:38:37 +0000 (12:38 +0200)]
Disable lock elision for mutex pretty printer tests.

If e.g. the testcase nptl/test-mutex-printers is run
with enabled lock-elision, it fails on s390x with:
Error: Response does not match the expected pattern.
Command: print *mutex
Expected pattern: pthread_mutex_t
Response:  No symbol "mutex" in current context.
(gdb)

See https://www.sourceware.org/ml/libc-alpha/2018-03/msg00583.html
for more details.

In fact the mutex pretty printer tests rely on looking at the
internal details of the lock, thus we disable it by setting up
the GLIB_TUNABLES environment variable inside gdb.

ChangeLog:

* scripts/test_printers_common.py (init_test): Disable lock elision.

6 years agoUse volatile global counters in test-tgmath.c.
Stefan Liebler [Thu, 19 Apr 2018 10:32:50 +0000 (12:32 +0200)]
Use volatile global counters in test-tgmath.c.

If build with -Os on s390x, the test-tgmath fails with:
float functions not called often enough (-10000)

Within compile_testf(), the counter (count_float) is saved
before the complex functions are called.
Afterwards the saved counter differs to the current-counter.

But the tests with the complex functions do not increment count_float!
Instead count_float is saved to a register before calling totalorder
and totalordermag which both increment count_float.
The compiler is allowed to do that as totalorderf and totalordermagf
is declared with __attribute__ ((__const__)) in math/bits/mathcalls.h.

Thus this patch adjusts the global counters to be volatile.
Then count_float is saved after totalordermag.

ChangeLog:

* math/test-tgmath.c (count_double, count_float,
count_ldouble, count_cdouble, count_cfloat,
count_cldouble): Use volatile int.

6 years agohurd: Update struct statfs according to struct statvfs
Samuel Thibault [Thu, 19 Apr 2018 00:25:03 +0000 (02:25 +0200)]
hurd: Update struct statfs according to struct statvfs

* sysdeps/mach/hurd/bits/statfs.h (struct statfs): Make f_bsize,
f_namemax, f_frsize, and f_flag fields unsigned long int instead of
unsigned int.
(struct statfs64): Likewise.

6 years agohurd: Fix standard compliance of some statvfs fields
Samuel Thibault [Thu, 19 Apr 2018 00:05:54 +0000 (02:05 +0200)]
hurd: Fix standard compliance of some statvfs fields

Standards require that the f_bsize, f_frsize, f_flag and f_namemax fields be
unsigned long.  They used to be only unsigned on hurd, which happens to be
compatible with unsigned long on the only existing, 32bit, port.  We can
thus merely fix the type.

* sysdeps/mach/hurd/bits/statvfs.h (struct statvfs): Make f_bsize,
f_namemax, f_frsize, and f_flag fields unsigned long int instead of
unsigned int.
(struct statvfs64): Likewise.

6 years agohurd: xfail some structure fields ABI incompatibility with standards
Samuel Thibault [Wed, 18 Apr 2018 23:51:45 +0000 (01:51 +0200)]
hurd: xfail some structure fields ABI incompatibility with standards

* sysdeps/mach/hurd/i386/Makefile [$(subdir) = conform]
(conformtest-xfail-conds): Add i386-gnu.
* conform/data/fcntl.h-data (flock.l_type, flock.l_whence): XFAIL for
i386-gnu.
* conform/data/sys/ipc.h-data (ipc_perm.uid, ipc_perm.gid,
ipc_perm.cuid, ipc_perm.cgid): Likewise.
* conform/data/sys/msg.h-data (msqid_ds.msg_lspid,
msqid_ds.msg_lrpid): Likewise.
* conform/data/sys/shm.h-data (shmid_ds.shm_lpid, shmid_ds.shm_cpid):
Likewise.
* conform/data/sys/stat.h-data (stat.st_dev): Likewise.
* conform/data/sys/statvfs.h-data (statvfs.f_fsid): Likewise.

6 years agohurd: Fix mach installed headers test
Samuel Thibault [Wed, 18 Apr 2018 22:42:14 +0000 (00:42 +0200)]
hurd: Fix mach installed headers test

* include/lock-intern.h [!_ISOMAC]: Do not declare libc hidden
prototypes.
* include/mach.h [!_ISOMAC]: Likewise.
* include/mach/mig_support.h [!_ISOMAC]: Likewise.
* include/mach_error.h [!_ISOMAC]: Likewise.

6 years agoRevert "Fix sched_param"
Samuel Thibault [Wed, 18 Apr 2018 22:09:58 +0000 (00:09 +0200)]
Revert "Fix sched_param"

This reverts commit 783c4820303fb6b031d401564f8089ecaf154b62 which
accidentaly flew out.

6 years agoconform sys/un.h: Allow sun_ prefix, not only sun_len
Samuel Thibault [Wed, 18 Apr 2018 19:07:04 +0000 (21:07 +0200)]
conform sys/un.h: Allow sun_ prefix, not only sun_len

* conform/data/sys/un.h-data: Allow sun_ prefix.

6 years agoFix sched_param
Samuel Thibault [Tue, 17 Apr 2018 22:27:31 +0000 (00:27 +0200)]
Fix sched_param

6 years agoMake build-many-glibcs.py build GCC for powerpcspe with --enable-obsolete.
Joseph Myers [Wed, 18 Apr 2018 16:07:19 +0000 (16:07 +0000)]
Make build-many-glibcs.py build GCC for powerpcspe with --enable-obsolete.

The powerpcspe GCC port has been obsoleted in GCC 8 for not having had
the removal of code for non-SPE processors completed.  This patch
accordingly arranges for build-many-glibcs.py to configure GCC with
--enable-obsolete for affected configurations.  This is temporary;
either the port gets cleaned up and unobsoleted in GCC and the
configure option can be removed, or the port gets removed in GCC and
we should remove the corresponding glibc support.

Tested with build-many-glibcs.py for the affected configurations.

* scripts/build-many-glibcs.py (Context.add_all_configs): Use
--enable-obsolete for powerpc-linux-gnuspe.

6 years agohurd: Fix spurious installation of headers defining hidden prototypes
Samuel Thibault [Wed, 18 Apr 2018 00:07:17 +0000 (02:07 +0200)]
hurd: Fix spurious installation of headers defining hidden prototypes

* sysdeps/mach/include/lock-intern.h: Move to include/.
* sysdeps/mach/include/mach.h: Move to include/.
* sysdeps/mach/include/mach/mig_support.h: Move to include/mach/.
* sysdeps/mach/include/mach_error.h: Move to include/.

6 years agohurd: fix conformity test for sys/un.h
Samuel Thibault [Tue, 17 Apr 2018 22:34:18 +0000 (00:34 +0200)]
hurd: fix conformity test for sys/un.h

sun_len is used by BSD systems, and conformant.

* conform/data/sys/un.h-data (struct sockaddr_un): Allow sun_len
member.

6 years agoarm: Remove ununsed ARM code in optimized implementation
Adhemerval Zanella [Mon, 16 Apr 2018 11:18:23 +0000 (08:18 -0300)]
arm: Remove ununsed ARM code in optimized implementation

This patch removes the ununsed ARM code path for armv6t2 memchr and
strlen and armv7 memch and strcmp.  In all implementation, the ARM
code is not used in any possible build (unless glibc is explicit
build with the non-documented NO_THUMB compiler flag) and for armv7
the resulting code either produces wrong results (memchr) and throw
build error (strcmp).

Checked on arm-linux-gnueabihf built targeting both armv6 and
armv7.

* sysdeps/arm/armv6t2/memchr.S (memchr): Remove ARM code path.
* sysdeps/arm/armv6t2/strlen.S (memchr): Likewise.
* sysdeps/arm/armv7/multiarch/memchr_neon.S (memchr): Likewise.
* sysdeps/arm/armv7/strcmp.S (strcmp): Likewise.

6 years agoAdd aliases to recognize normalized charset names (bug 19527)
Andreas Schwab [Thu, 28 Jan 2016 13:19:39 +0000 (14:19 +0100)]
Add aliases to recognize normalized charset names (bug 19527)

6 years agoImproves __ieee754_exp(x) performance by 18-37% when |x| < 1.0397
Patrick McGehearty [Sun, 15 Apr 2018 22:46:37 +0000 (18:46 -0400)]
Improves __ieee754_exp(x) performance by 18-37% when |x| < 1.0397

Adds a fast path to e_exp.c when |x| < 1.03972053527832.
When values are tested in isolation, reduction in execution
time is: aarch 30%, sparc 18%, x86 37%.
When comparing benchtests/bench.out which includes values
outside that range, the gains are:
aarch 8%, sparc 5%, x86 9%.

make check is clean (no increase in ulp for any math test).
Testing 20M values for each rounding mode in that range shows
approximately one in 200 values is off by 1 ulp. No value tested
for exp(x) changed by 2 or more ulp.

No observed change in performance or accuracy for x outside
fast path range.

These changes will be active for all platforms that don't provide
their own exp() routines. They will also be active for ieee754
versions of ccos, ccosh, cosh, csin, csinh, sinh, exp10, gamma, and
erf.

6 years agoUpdate kernel version in syscall-names.list to 4.16.
DJ Delorie [Thu, 12 Apr 2018 19:25:50 +0000 (15:25 -0400)]
Update kernel version in syscall-names.list to 4.16.

Linux 4.16 does not add any new syscalls; this patch updates the
version number in syscall-names.list to reflect that it's still
current for 4.16.

Tested for x86_64 (compilation with build-many-glibcs.py, using Linux
4.16).

* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 4.16.

6 years agoS390: Fix struct sigaction for 31bit in kernel_sigaction.h.
Stefan Liebler [Thu, 12 Apr 2018 07:37:26 +0000 (09:37 +0200)]
S390: Fix struct sigaction for 31bit in kernel_sigaction.h.

The recent commit b4a5d26d8835d972995f0a0a2f805a8845bafa0b
"linux: Consolidate sigaction implementation" changed the definition
of struct sigaction for s390 (31bit). Unfortunately the order of the
fields were wrong.

This leads to blocking testcases e.g. nptl/tst-sem11.
A thread which blocks due to sem_wait() is cancelled via pthread_cancel()
and the signal-handler sigcancel_handler (see <glibc-src>/nptl/nptl-init.c
is called.
But it just returns as the siginfo_t argument is not setup by the kernel.
Then the main-thread is blocking due to pthread_join().

The flag SA_SIGINFO is set in sa_flags in struct sigaction and
is copied to the "kernel_sigaction.h" struct by the sigaction() call,
but due to the wrong ordering of the struct fields,
the kernel does not recognize it.

6 years agoresolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
Florian Weimer [Mon, 9 Apr 2018 08:08:07 +0000 (10:08 +0200)]
resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]

6 years agoConsolidate Linux readdir{64}{_r} implementation
Adhemerval Zanella [Wed, 28 Feb 2018 12:25:58 +0000 (09:25 -0300)]
Consolidate Linux readdir{64}{_r} implementation

This patch consolidates Linux readdir{64}{_r} implementation on just
the default sysdeps/unix/sysv/linux/readdir{64}{_r}.c ones.  The
default implementation handle the Linux requirements:

  * readdir{_r} is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * readdir64{_r} is always built and aliased to readdir{_r} for
    ABI that define _DIRENT_MATCHES_DIRENT64.

  * A compat symbol is added for readdir64{_r} for ABI that used to
    export the old non-LFS version.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, and
powerpc64le-linux-gnu.

* sysdeps/posix/readdir.c (__READDIR, __GETDENTS, DIRENTY_TYPE,
__READDIR_ALIAS): Undefine after usage.
* sysdeps/posix/readdir_r.c (__READDIR_R, __GETDENTS, DIRENT_TYPE,
__READDIR_R_ALIAS): Likewise.
* sysdeps/unix/sysv/linux/arm/readdir64.c: Remove file.
* sysdeps/unix/sysv/linux/arm/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/readdir.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Likewise.
* sysdeps/unix/sysv/linux/readdir.c: New file.
* sysdeps/unix/sysv/linux/readdir_r.c: Likewise.
* sysdeps/unix/sysv/linux/readdir64.c: Add compat symbol if required.
* sysdeps/unix/sysv/linux/readdir64_r.c: Likewise.

6 years agoUpdate i386 libm-test-ulps.
Adhemerval Zanella [Fri, 6 Apr 2018 20:24:15 +0000 (17:24 -0300)]
Update i386 libm-test-ulps.

Updated ulps after recent commit "[PATCH 1/7] sin/cos slow paths:
avoid slow paths for small inputs"
(19a8b9a300f2f1f0012aff0f2b70b09430f50d9e).

* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Update.

6 years agoFix missing @ before texinfo command
Andreas Schwab [Fri, 6 Apr 2018 06:44:07 +0000 (08:44 +0200)]
Fix missing @ before texinfo command

6 years agoUpdate SPARC libm-test-ulps.
Adhemerval Zanella [Thu, 5 Apr 2018 19:31:37 +0000 (16:31 -0300)]
Update SPARC libm-test-ulps.

* sysdeps/sparc/fpu/libm-test-ulps: Update.

6 years agoUpdate ARM libm-test-ulps.
Adhemerval Zanella [Thu, 5 Apr 2018 19:31:27 +0000 (16:31 -0300)]
Update ARM libm-test-ulps.

* sysdeps/arm/libm-test-ulps: Update.

6 years agolinux: Consolidate sigaction implementation
Adhemerval Zanella [Thu, 2 Nov 2017 13:04:18 +0000 (11:04 -0200)]
linux: Consolidate sigaction implementation

This patch consolidates all Linux sigaction implementations on the default
sysdeps/unix/sysv/linux/sigaction.c.  The idea is remove redundant code
and simplify new ports addition by following the current generic
Linux User API (UAPI).

The UAPI for new ports defines a generic extensible sigaction struct as:

  struct sigaction
  {
    __sighandler_t sa_handler;
    unsigned long sa_flags;
  #ifdef SA_RESTORER
    void (*sa_restorer) (void);
  #endif
    sigset_t sa_mask;
  };

Where SA_RESTORER is just placed for compatibility reasons (news ports
should not add it).  A similar definition is used on generic
kernel_sigaction.h.

The user exported sigaction definition is not changed, so for most
architectures it requires an adjustment to kernel expected one for the
syscall.

The main changes are:

  - All architectures now define and use a kernel_sigaction struct meant
    for the syscall, even for the architectures where the user sigaction
    has the same layout of the kernel expected one (s390-64 and ia64).
    Although it requires more work for these architectures, it simplifies
    the generic implementation. Also, sigaction is hardly a hotspot where
    micro optimization would play an important role.

  - The generic kernel_sigaction definition is now aligned with expected
    UAPI one for newer ports, where SA_RESTORER and sa_restorer are not
    expected to be defined.  This means adding kernel_sigaction for
    current architectures that does define it (m68k, nios2, powerpc, s390,
    sh, sparc, and tile) and which rely on previous generic definition.

  - Remove old MIPS usage of sa_restorer.  This was removed since 2.6.27
    (2957c9e61ee9c - "[MIPS] IRIX: Goodbye and thanks for all the fish").

  - The remaining arch-specific sigaction.c are to handle ABI idiosyncrasies
    (like SPARC kernel ABI for rt_sigaction that requires an additional
    stub argument).

So for new ports the generic implementation should work if its uses
Linux UAPI.  If SA_RESTORER is still required (due some architecture
limitation), it should define its own kernel_sigaction.h, define it and
include generic header (assuming it still uses the default generic kernel
layout).

Checked on x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabihf,
aarch64-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, powerpc-linux-gnu,
powerpc64-linux-gnu, ia64-linux-gnu and alpha-linux-gnu.  I also checked the
build on all remaining affected ABIs.

* sysdeps/unix/sysv/linux/aarch64/sigaction.c: Use default Linux version
as base implementation.
* sysdeps/unix/sysv/linux/arm/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h: Add include guards,
remove unrequired definitions and update comments.
* sysdeps/unix/sysv/linux/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/kernel_sigaction.h: New file.
* sysdeps/unix/sysv/linux/m68k/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel_sigaction: Likewise.
* sysdeps/unix/sysv/linux/s390/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/sh/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/tile/kernel_sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sigaction.c: Remove file.
* sysdeps/unix/sysv/linux/mips/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/sigaction.c: Add STUB, SET_SA_RESTORER,
and RESET_SA_RESTORER hooks.

6 years agoS390: Regenerate ULPs.
Stefan Liebler [Thu, 5 Apr 2018 14:20:03 +0000 (16:20 +0200)]
S390: Regenerate ULPs.

Updated ulps after recent commit
"[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs"
(19a8b9a300f2f1f0012aff0f2b70b09430f50d9e).

ChangeLog:

* sysdeps/s390/fpu/libm-test-ulps: Regenerated.

6 years agomanual: Various fixes to the mbstouwcs example, and mbrtowc update
Florian Weimer [Thu, 5 Apr 2018 10:52:19 +0000 (12:52 +0200)]
manual: Various fixes to the mbstouwcs example, and mbrtowc update

The example did not work because the null byte was not converted, and
mbrtowc was called with a zero-length input string.  This results in a
(size_t) -2 return value, so the function always returns NULL.

The size computation for the heap allocation of the result was
incorrect because it did not deal with integer overflow.

Error checking was missing, and the allocated memory was not freed on
error paths.  All error returns now set errno.  (Note that there is an
assumption that free does not clobber errno.)

The slightly unportable comparision against (size_t) -2 to catch both
(size_t) -1 and (size_t) -2 return values is gone as well.

A null wide character needs to be stored in the result explicitly, to
terminate it.

The description in the manual is updated to deal with these finer
points.  The (size_t) -2 behavior (consuming the input bytes) matches
what is specified in ISO C11.

6 years agomanual: Move mbstouwcs to an example C file
Florian Weimer [Thu, 5 Apr 2018 10:50:58 +0000 (12:50 +0200)]
manual: Move mbstouwcs to an example C file

6 years agoRevert "hurd: Avoid PLTs for longjmp & siglongjmp"
Samuel Thibault [Thu, 5 Apr 2018 07:38:58 +0000 (09:38 +0200)]
Revert "hurd: Avoid PLTs for longjmp & siglongjmp"

This reverts commit e5f9508a32426b7c3948dc741d84355071ed9539.

6 years agohurd: Avoid PLT for dirfd
Samuel Thibault [Wed, 4 Apr 2018 23:52:29 +0000 (01:52 +0200)]
hurd: Avoid PLT for dirfd

* include/dirent.h (dirfd): Add hidden proto.
* dirent/dirfd.c (dirfd): Add hidden def.
* sysdeps/mach/hurd/dirfd.c (dirfd): Add hidden def.
* sysdeps/posix/dirfd.c (dirfd): Add hidden def.

6 years agohurd: Avoid PLTs for longjmp & siglongjmp
Samuel Thibault [Wed, 4 Apr 2018 23:19:18 +0000 (23:19 +0000)]
hurd: Avoid PLTs for longjmp & siglongjmp

* include/setjmp.h (longjmp, siglongjmp): Add hidden protos.
* setjmp/longjmp.c (longjmp, siglongjmp): Add hidden defs.
* sysdeps/s390/longjmp.c (longjmp, siglongjmp): Add hidden defs.

6 years agopowerpc: Update sin, cos and sincos ULPs
Tulio Magno Quites Machado Filho [Wed, 4 Apr 2018 22:17:13 +0000 (19:17 -0300)]
powerpc: Update sin, cos and sincos ULPs

* sysdeps/powerpc/fpu/libm-test-ulps: Increase double-precision
sin, cos and sincos to 1 ULP.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
6 years agoelf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818]
Maciej W. Rozycki [Wed, 4 Apr 2018 22:09:37 +0000 (23:09 +0100)]
elf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818]

Do not relocate absolute symbols by the base address.  Such symbols have
SHN_ABS as the section index and their value is not supposed to be
affected by relocation as per the ELF gABI[1]:

"SHN_ABS
    The symbol has an absolute value that will not change because of
    relocation."

The reason for our non-conformance here seems to be an old SysV linker
bug causing symbols like _DYNAMIC to be incorrectly emitted as absolute
symbols[2].  However in a previous discussion it was pointed that this
is seriously flawed by preventing the lone purpose of the existence of
absolute symbols from being used[3]:

"On the contrary, the only interpretation that makes sense to me is that
it will not change because of relocation at link time or at load time.
Absolute symbols, from the days of the earliest linking loaders, have
been used to represent addresses that are outside the address space of
the module (e.g., memory-mapped addresses or kernel gateway pages).
They've even been used to represent true symbolic constants (e.g.,
system entry point numbers, sizes, version numbers).  There's no other
way to represent a true absolute symbol, while the meaning you seek is
easily represented by giving the symbol a non-negative st_shndx value."

and we ought to stop supporting our current broken interpretation.

Update processing for dladdr(3) and dladdr1(3) so that SHN_ABS symbols
are ignored, because under the corrected interpretation they do not
represent addresses within a mapped file and therefore are not supposed
to be considered.

References:

[1] "System V Application Binary Interface - DRAFT - 19 October 2010",
    The SCO Group, Section "Symbol Table",
    <http://www.sco.com/developers/gabi/2012-12-31/ch4.symtab.html>

[2] Alan Modra, "Absolute symbols"
    <https://sourceware.org/ml/binutils/2012-05/msg00019.html>

[3] Cary Coutant, "Re: Absolute symbols"
    <https://sourceware.org/ml/binutils/2012-05/msg00020.html>

[BZ #19818]
* sysdeps/generic/ldsodefs.h (SYMBOL_ADDRESS): Handle SHN_ABS
symbols.
* elf/dl-addr.c (determine_info): Ignore SHN_ABS symbols.
* elf/tst-absolute-sym.c: New file.
* elf/tst-absolute-sym-lib.c: New file.
* elf/tst-absolute-sym-lib.lds: New file.
* elf/Makefile (tests): Add `tst-absolute-sym'.
(modules-names): Add `tst-absolute-sym-lib'.
(LDLIBS-tst-absolute-sym-lib.so): New variable.
($(objpfx)tst-absolute-sym-lib.so): New dependency.
($(objpfx)tst-absolute-sym): New dependency.

6 years agoelf: Unify symbol address run-time calculation [BZ #19818]
Maciej W. Rozycki [Wed, 4 Apr 2018 22:09:37 +0000 (23:09 +0100)]
elf: Unify symbol address run-time calculation [BZ #19818]

Wrap symbol address run-time calculation into a macro and use it
throughout, replacing inline calculations.

There are a couple of variants, most of them different in a functionally
insignificant way.  Most calculations are right following RESOLVE_MAP,
at which point either the map or the symbol returned can be checked for
validity as the macro sets either both or neither.  In some places both
the symbol and the map has to be checked however.

My initial implementation therefore always checked both, however that
resulted in code larger by as much as 0.3%, as many places know from
elsewhere that no check is needed.  I have decided the size growth was
unacceptable.

Having looked closer I realized that it's the map that is the culprit.
Therefore I have modified LOOKUP_VALUE_ADDRESS to accept an additional
boolean argument telling it to access the map without checking it for
validity.  This in turn has brought quite nice results, with new code
actually being smaller for i686, and MIPS o32, n32 and little-endian n64
targets, unchanged in size for x86-64 and, unusually, marginally larger
for big-endian MIPS n64, as follows:

i686:
   text    data     bss     dec     hex filename
 152255    4052     192  156499   26353 ld-2.27.9000-base.so
 152159    4052     192  156403   262f3 ld-2.27.9000-elf-symbol-value.so
MIPS/o32/el:
   text    data     bss     dec     hex filename
 142906    4396     260  147562   2406a ld-2.27.9000-base.so
 142890    4396     260  147546   2405a ld-2.27.9000-elf-symbol-value.so
MIPS/n32/el:
   text    data     bss     dec     hex filename
 142267    4404     260  146931   23df3 ld-2.27.9000-base.so
 142171    4404     260  146835   23d93 ld-2.27.9000-elf-symbol-value.so
MIPS/n64/el:
   text    data     bss     dec     hex filename
 149835    7376     408  157619   267b3 ld-2.27.9000-base.so
 149787    7376     408  157571   26783 ld-2.27.9000-elf-symbol-value.so
MIPS/o32/eb:
   text    data     bss     dec     hex filename
 142870    4396     260  147526   24046 ld-2.27.9000-base.so
 142854    4396     260  147510   24036 ld-2.27.9000-elf-symbol-value.so
MIPS/n32/eb:
   text    data     bss     dec     hex filename
 142019    4404     260  146683   23cfb ld-2.27.9000-base.so
 141923    4404     260  146587   23c9b ld-2.27.9000-elf-symbol-value.so
MIPS/n64/eb:
   text    data     bss     dec     hex filename
 149763    7376     408  157547   2676b ld-2.27.9000-base.so
 149779    7376     408  157563   2677b ld-2.27.9000-elf-symbol-value.so
x86-64:
   text    data     bss     dec     hex filename
 148462    6452     400  155314   25eb2 ld-2.27.9000-base.so
 148462    6452     400  155314   25eb2 ld-2.27.9000-elf-symbol-value.so

[BZ #19818]
* sysdeps/generic/ldsodefs.h (LOOKUP_VALUE_ADDRESS): Add `set'
parameter.
(SYMBOL_ADDRESS): New macro.
[!ELF_FUNCTION_PTR_IS_SPECIAL] (DL_SYMBOL_ADDRESS): Use
SYMBOL_ADDRESS for symbol address calculation.
* elf/dl-runtime.c (_dl_fixup): Likewise.
(_dl_profile_fixup): Likewise.
* elf/dl-symaddr.c (_dl_symbol_address): Likewise.
* elf/rtld.c (dl_main): Likewise.
* sysdeps/aarch64/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/arm/dl-machine.h (elf_machine_rel): Likewise.
(elf_machine_rela): Likewise.
* sysdeps/hppa/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Likewise.
* sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
(elf_machine_rela): Likewise.
* sysdeps/ia64/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/microblaze/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
Likewise.
(elf_machine_reloc): Likewise.
(elf_machine_got_rel): Likewise.
* sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise.
* sysdeps/nios2/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela):
Likewise.
* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela):
Likewise.
* sysdeps/riscv/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela):
Likewise.
* sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela):
Likewise.
* sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela):
Likewise.
* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela):
Likewise.
* sysdeps/tile/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoMake sysdeps/generic/internal-signals.h less stubby.
Zack Weinberg [Wed, 4 Apr 2018 16:37:23 +0000 (12:37 -0400)]
Make sysdeps/generic/internal-signals.h less stubby.

Three of the functions defined by internal-signals.h were not actually
fulfilling their contracts when the sysdeps/generic version of that
file was used.  Also, the Linux version included several more headers
than the generic version, which is the root cause of a build failure
on Hurd (already addressed in another way, but I think it is proper to
make the headers match).

* sysdeps/generic/internal-signals.h: Include signal.h,
sigsetops.h, and stdbool.h.
(__libc_signal_block_all): Actually block all signals.
(__libc_signal_block_app): Likewise.
(__libc_signal_restore_set): Actually restore the signal mask.

6 years agoinet: Actually build and run tst-deadline
Florian Weimer [Wed, 4 Apr 2018 14:08:18 +0000 (16:08 +0200)]
inet: Actually build and run tst-deadline

6 years agohurd: Fix typo
Samuel Thibault [Wed, 4 Apr 2018 00:31:23 +0000 (02:31 +0200)]
hurd: Fix typo

* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Fix typo in IFNAMSIZ.

6 years agohurd: fix build
Samuel Thibault [Wed, 4 Apr 2018 00:28:20 +0000 (02:28 +0200)]
hurd: fix build

* signal/sigaddset.c: Include <sigsetopts.h>.
* signal/sigdelset.c: Likewise.

6 years agohurd: Add missing symbols
Samuel Thibault [Wed, 4 Apr 2018 00:17:49 +0000 (02:17 +0200)]
hurd: Add missing symbols

* sysdeps/mach/hurd/i386/exc2signal.c (_hurd_exception2signal): Add
hidden def.
* mach/spin-lock.c (__mutex_unlock): Add hidden def.

6 years agohurd: Silence warning
Samuel Thibault [Wed, 4 Apr 2018 00:06:16 +0000 (02:06 +0200)]
hurd: Silence warning

* hurd/hurdsig.c (interrupted_reply_port_location): Use
DIAG_IGNORE_NEEDS_COMMENT to silence warning with GCC 6 and before.

6 years agohurd: Fix missing trailing NUL in __if_nametoindex
Samuel Thibault [Tue, 3 Apr 2018 22:01:19 +0000 (00:01 +0200)]
hurd: Fix missing trailing NUL in __if_nametoindex

* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Pass the whole buffer
size to strncpy.

6 years agohurd: Make __if_nametoindex return ENODEV if ifname is too long
Samuel Thibault [Tue, 3 Apr 2018 21:13:13 +0000 (23:13 +0200)]
hurd: Make __if_nametoindex return ENODEV if ifname is too long

rather than truncating it.

* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Return ENODEV if
ifname is too long.

6 years agoRevert parts of "hurd: Avoid more libc.so local PLTs"
Samuel Thibault [Tue, 3 Apr 2018 21:00:14 +0000 (23:00 +0200)]
Revert parts of "hurd: Avoid more libc.so local PLTs"

This reverts parts of commit 82dbf555a4d41690f63b94ccb4db4bf43d873aa0.

6 years agoRevert "s390x: Fix hidden aliases"
Samuel Thibault [Tue, 3 Apr 2018 20:59:17 +0000 (22:59 +0200)]
Revert "s390x: Fix hidden aliases"

This reverts commit 811836a411a1c97a0e70e7f096e57f316dc19c72.

6 years agoUpdate RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947]
H.J. Lu [Tue, 3 Apr 2018 19:19:20 +0000 (12:19 -0700)]
Update RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947]

Add RWF_APPEND to RWF_SUPPORTED to support Linux kernel 4.16.

[BZ #22947]
* bits/uio-ext.h (RWF_APPEND): New.
* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_APPEND): Likewise.
* manual/llio.texi: Document RWF_APPEND.
* misc/tst-preadvwritev2-common.c (RWF_APPEND): New.
(RWF_SUPPORTED): Add RWF_APPEND.

6 years agoFilter out NPTL internal signals (BZ #22391)
Adhemerval Zanella [Wed, 1 Nov 2017 01:10:37 +0000 (23:10 -0200)]
Filter out NPTL internal signals (BZ #22391)

This patch filters out the internal NPTL signals (SIGCANCEL/SIGTIMER and
SIGSETXID) from signal functions.  GLIBC on Linux requires both signals to
proper implement pthread cancellation, posix timers, and set*id posix
thread synchronization.

And not filtering out the internal signal is troublesome:

  - A conformant program on a architecture that does not filter out the
    signals might inadvertently disable pthread asynchronous cancellation,
    set*id synchronization or posix timers.

  - It might also to security issues if SIGSETXID is masked and set*id
    functions are called (some threads might have effective user or group
    id different from the rest).

The changes are basically:

  - Change __is_internal_signal to bool and used on all signal function
    that has a signal number as input.  Also for signal function which accepts
    signals sets (sigset_t) it assumes that canonical function were used to
    add/remove signals which lead to some input simplification.

  - Fix tst-sigset.c to avoid check for SIGCANCEL/SIGTIMER and SIGSETXID.
    It is rewritten to check each signal indidually and to check realtime
    signals using canonical macros.

  - Add generic __clear_internal_signals and __is_internal_signal
    version since both symbols are used on generic implementations.

  - Remove superflous sysdeps/nptl/sigfillset.c.

  - Remove superflous SIGTIMER handling on Linux __is_internal_signal
    since it is the same of SIGCANCEL.

  - Remove dangling define and obvious comment on nptl/sigaction.c.

Checked on x86_64-linux-gnu.

[BZ #22391]
* nptl/sigaction.c (__sigaction): Use __is_internal_signal to
check for internal nptl signals.
* nptl/sigaction.c (__sigaction): Likewise.
* signal/sigaddset.c (sigaddset): Likewise.
* signal/sigdelset.c (sigdelset): Likewise.
* sysdeps/posix/signal.c (__bsd_signal): Likewise.
* sysdeps/posix/sigset.c (sigset): Call and check sigaddset return
value.
* signal/sigfillset.c (sigfillset): User __clear_internal_signals
to filter out internal nptl signals.
* signal/tst-sigset.c (do_test): Check ech signal indidually and
also check realtime signals using standard macros.
* sysdeps/generic/internal-signals.h (__clear_internal_signals,
__is_internal_signal, __libc_signal_block_all,
__libc_signal_block_app, __libc_signal_restore_set): New functions.
* sysdeps/nptl/sigfillset.c: Remove file.
* sysdeps/unix/sysv/linux/internal-signals.h (__is_internal_signal):
Change return to bool.
(__clear_internal_signals): Remove SIGTIMER clean since it is
equal to SIGCANEL on Linux.
* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Assume
signal set was constructed using standard functions.

Reported-by: Yury Norov <ynorov@caviumnetworks.com>
6 years agohurd: Fix buffer overrun in __if_nametoindex
Samuel Thibault [Tue, 3 Apr 2018 16:06:15 +0000 (18:06 +0200)]
hurd: Fix buffer overrun in __if_nametoindex

and building with mainline GCC which reports it.

* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Always end
ifr.fr_name with a NUL caracter.

6 years ago[PATCH 7/7] sin/cos slow paths: refactor sincos implementation
Wilco Dijkstra [Tue, 3 Apr 2018 15:49:33 +0000 (16:49 +0100)]
[PATCH 7/7] sin/cos slow paths: refactor sincos implementation

Refactor the sincos implementation - rather than rely on odd partial inlining
of preprocessed portions from sin and cos, explicitly write out the cases.
This makes sincos much easier to maintain and provides an additional 16-20%
speedup between 0 and 2^27.  The overall speedup of sincos is 48% over this range.
Between 0 and PI it is 66% faster.

* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Cleanup ifdefs.
(__cos): Likewise.
* sysdeps/ieee754/dbl-64/s_sin.c (__sincos): Refactor using the same
logic as sin and cos.

6 years ago[PATCH 6/7] sin/cos slow paths: refactor duplicated code into dosin
Wilco Dijkstra [Tue, 3 Apr 2018 15:46:10 +0000 (16:46 +0100)]
[PATCH 6/7] sin/cos slow paths: refactor duplicated code into dosin

Refactor duplicated code into do_sin.  Since all calls to do_sin use copysign to
set the sign of the result, move it inside do_sin.  Small inputs use a separate
polynomial, so move this into do_sin as well (the check is based on the more
conservative case when doing large range reduction, but could be relaxed).

* sysdeps/ieee754/dbl-64/s_sin.c (do_sin): Use TAYLOR_SIN for small
inputs.  Return correct sign.
(do_sincos): Remove small input check before do_sin, let do_sin set
the sign.
(__sin): Likewise.
(__cos): Likewise.

6 years ago[PATCH 5/7] sin/cos slow paths: remove unused slowpath functions
Wilco Dijkstra [Tue, 3 Apr 2018 15:43:34 +0000 (16:43 +0100)]
[PATCH 5/7] sin/cos slow paths: remove unused slowpath functions

Remove all unused slowpath functions.

* sysdeps/ieee754/dbl-64/s_sin.c (TAYLOR_SLOW): Remove.
(do_cos_slow): Likewise.
(do_sin_slow): Likewise.
(reduce_and_compute): Likewise.
(slow): Likewise.
(slow1): Likewise.
(slow2): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(sloww2): Likewise.
(bslow): Likewise.
(bslow1): Likewise.
(bslow2): Likewise.
(cslow2): Likewise.

6 years ago[PATCH 4/7] sin/cos slow paths: remove slow paths from huge range reduction
Wilco Dijkstra [Tue, 3 Apr 2018 15:41:36 +0000 (16:41 +0100)]
[PATCH 4/7] sin/cos slow paths: remove slow paths from huge range reduction

For huge inputs use the improved do_sincos function as well.  Now no cases use
the correction factor returned by do_sin, do_cos and TAYLOR_SIN, so remove it.

* sysdeps/ieee754/dbl-64/s_sin.c (TAYLOR_SIN): Remove cor parameter.
(do_cos): Remove corp parameter and calculations.
(do_sin): Likewise.
(do_sincos): Remove cor variable.
(__sin): Use do_sincos for huge inputs.
(__cos): Likewise.
* sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Likewise.
(reduce_and_compute_sincos): Remove unused function.

6 years ago[PATCH 3/7] sin/cos slow paths: remove slow paths from small range reduction
Wilco Dijkstra [Tue, 3 Apr 2018 15:33:13 +0000 (16:33 +0100)]
[PATCH 3/7] sin/cos slow paths: remove slow paths from small range reduction

This patch improves the accuracy of the range reduction.  When the input is
large (2^27) and very close to a multiple of PI/2, using 110 bits of PI is not
enough.  Improve range reduction accuracy to 136 bits.  As a result the special
checks for results close to zero can be removed.  The ULP of the polynomials is
at worst 0.55ULP, so there is no reason for the slow functions, and they can be
removed.

* sysdeps/ieee754/dbl-64/s_sin.c (reduce_sincos_1): Rename to
reduce_sincos, improve accuracy to 136 bits.
(do_sincos_1): Rename to do_sincos, remove fallbacks to slow functions.
(__sin): Use improved reduction and simplified do_sincos calculation.
(__cos): Likewise.
* sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Likewise.

6 years ago[PATCH 2/7] sin/cos slow paths: remove large range reduction
Wilco Dijkstra [Tue, 3 Apr 2018 15:28:03 +0000 (16:28 +0100)]
[PATCH 2/7] sin/cos slow paths: remove large range reduction

This patch removes the large range reduction code and defers to the huge range
reduction code.  The first level range reducer supports inputs up to 2^27,
which is way too large given that inputs for sin/cos are typically small
(< 10), and optimizing for a smaller range would give a significant speedup.

Input values above 2^27 are practically never used, so there is no reason for
supporting range reduction between 2^27 and 2^48.  Removing it significantly
simplifies code and enables further speedups.  There is about a 2.3x slowdown
in this range due to __branred being extremely slow  (a better algorithm could
easily more than double performance).

* sysdeps/ieee754/dbl-64/s_sin.c (reduce_sincos_2): Remove function.
(do_sincos_2): Likewise.
(__sin): Remove middle range reduction case.
(__cos): Likewise.
* sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Remove middle range
reduction case.

6 years ago[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs
Wilco Dijkstra [Tue, 3 Apr 2018 15:24:29 +0000 (16:24 +0100)]
[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs

This series of patches removes the slow patchs from sin, cos and sincos.
Besides greatly simplifying the implementation, the new version is also much
faster for inputs up to PI (41% faster) and for large inputs needing range
reduction (27% faster).

ULP is ~0.55 with no errors found after testing 1.6 billion inputs across most
of the range with mpsin and mpcos.  The number of incorrectly rounded results
(ie. ULP >0.5) is at most ~2750 per million inputs between 0.125 and 0.5,
the average is ~850 per million between 0 and PI.

Tested on AArch64 and x86_64 with no regressions.

The first patch removes the slow paths for the cases where the input is small
and doesn't require range reduction.  Update ULP tables for sin, cos and sincos
on AArch64 and x86_64.

* sysdeps/aarch64/libm-test-ulps: Update ULP for sin, cos, sincos.
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Remove slow paths for small
inputs.
(__cos): Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps: Update ULP for sin, cos, sincos.

6 years agoUse Linux 4.16 in build-many-glibcs.py.
Joseph Myers [Tue, 3 Apr 2018 15:41:08 +0000 (15:41 +0000)]
Use Linux 4.16 in build-many-glibcs.py.

* scripts/build-many-glibcs.py (Context.checkout): Default Linux
version to 4.16.