Commit Graph

22778 Commits

Author SHA1 Message Date
H.J. Lu 394df3815e x86/CET: Extend arch_prctl syscall for CET control
CET arch_prctl bits should be defined in <asm/prctl.h> from Linux kernel
header files.  Add x86 <include/asm/prctl.h> for pre-CET kernel header
files.

Note: sysdeps/unix/sysv/linux/x86/include/asm/prctl.h should be removed
if <asm/prctl.h> from the required kernel header files contains CET
arch_prctl bits.

 /* CET features:
    IBT:   GNU_PROPERTY_X86_FEATURE_1_IBT
    SHSTK: GNU_PROPERTY_X86_FEATURE_1_SHSTK
  */

 /* Return CET features in unsigned long long *addr:
      features: addr[0].
      shadow stack base address: addr[1].
      shadow stack size: addr[2].
  */
 # define ARCH_CET_STATUS		0x3001
 /* Disable CET features in unsigned int features.  */
 # define ARCH_CET_DISABLE		0x3002
 /* Lock all CET features.  */
 # define ARCH_CET_LOCK			0x3003
 /* Allocate a new shadow stack with unsigned long long *addr:
      IN: requested shadow stack size: *addr.
      OUT: allocated shadow stack address: *addr.
  */
 # define ARCH_CET_ALLOC_SHSTK		0x3004
 /* Return legacy region bitmap info in unsigned long long *addr:
     address: addr[0].
     size: addr[1].
  */
 # define ARCH_CET_LEGACY_BITMAP	0x3005

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/unix/sysv/linux/x86/include/asm/prctl.h: New file.
	* sysdeps/unix/sysv/linux/x86/cpu-features.c: Include
	<sys/prctl.h> and <asm/prctl.h>.
	(get_cet_status): Call arch_prctl with ARCH_CET_STATUS.
	* sysdeps/unix/sysv/linux/x86/dl-cet.h: Include <sys/prctl.h>
	and <asm/prctl.h>.
	(dl_cet_allocate_legacy_bitmap): Call arch_prctl with
	ARCH_CET_LEGACY_BITMAP.
	(dl_cet_disable_cet): Call arch_prctl with ARCH_CET_DISABLE.
	(dl_cet_lock_cet): Call arch_prctl with ARCH_CET_LOCK.
	* sysdeps/x86/libc-start.c: Include <startup.h>.
2018-07-24 12:23:17 -07:00
Florian Weimer 465455306f sh: Do not define __ASSUME_STATX 2018-07-24 21:05:07 +02:00
Rical Jasan 9d0a979e5d Add manual documentation for threads.h
This patch updates the manual and adds a new chapter to the manual,
explaining types macros, constants and functions defined by ISO C11
threads.h standard.

	[BZ# 14092]
	* manual/debug.texi: Update adjacent chapter name.
	* manual/probes.texi: Likewise.
	* manual/threads.texi (ISO C Threads): New section.
	(POSIX Threads): Convert to a section.
2018-07-24 14:07:31 -03:00
Adhemerval Zanella 0a07288b13 nptl: Add test cases for ISO C11 threads
This patch adds to testsuite new test cases to test all new introduced
C11 threads functions, types and macros are tested.

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	Juan Manuel Torres Palma  <jmtorrespalma@gmail.com>

	[BZ #14092]
	* nptl/Makefile (tests): Add new test files.
	* nptl/tst-call-once.c : New file. Tests C11 functions and types.
	* nptl/tst-cnd-basic.c: Likewise.
	* nptl/tst-cnd-broadcast.c: Likewise.
	* nptl/tst-cnd-timedwait.c: Likewise.
	* nptl/tst-mtx-basic.c: Likewise.
	* nptl/tst-mtx-recursive.c: Likewise.
	* nptl/tst-mtx-timedlock.c: Likewise.
	* nptl/tst-mtx-trylock.c: Likewise.
	* nptl/tst-thrd-basic.c: Likewise.
	* nptl/tst-thrd-detach.c: Likewise.
	* nptl/tst-thrd-sleep.c: Likewise.
	* nptl/tst-tss-basic.c: Likewise.
2018-07-24 14:07:25 -03:00
Adhemerval Zanella c6dd669bed nptl: Add abilist symbols for C11 threads
This patch adds the required abilist symbols for C11 thread support.

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	[BZ #14092]
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.28]
	(thrd_current, thrd_equal, thrd_sleep, thrd_yield): Add C11 thread
	symbols.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.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/riscv/rv64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist [[GLIBC_2.28]
	(call_once, cnd_broadcast, cnd_destroy, cnd_init, cnd_signal,
	cnd_timedwait, cnd_wait, mtx_destroy, mtx_init, mtx_lock,
	mtx_timedlock, mtx_trylock, mtx_unlokc, thrd_create, thrd_detach,
	thrd_exit, thrd_join, tss_create, tss_delete, tss_get, tss_set):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libpthread.abilist: Likewise.
	ikewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist:
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist: Likewise.
2018-07-24 14:07:18 -03:00
Adhemerval Zanella 78d401327f nptl: Add C11 threads tss_* functions
This patch adds the tss_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically tss_create, tss_delete, tss_get, tss_set, and required
types.

Mostly of the definitions are composed based on POSIX conterparts, including
tss_t (pthread_key_t).

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	[BZ #14092]
	* conform/data/threads.h-data (thread_local): New macro.
	(TSS_DTOR_ITERATIONS): Likewise.
	(tss_t): New type.
	(tss_dtor_t): Likewise.
	(tss_create): New function.
	(tss_get): Likewise.
	(tss_set): Likewise.
	(tss_delete): Likewise.
	* nptl/Makefile (libpthread-routines): Add tss_create, tss_delete,
	tss_get, and tss_set objects.
	* nptl/Versions (libpthread) [GLIBC_2.28]: Likewise.
	* nptl/tss_create.c: New file.
	* nptl/tss_delete.c: Likewise.
	* nptl/tss_get.c: Likewise.
	* nptl/tss_set.c: Likewise.
	* sysdeps/nptl/threads.h (thread_local): New define.
	(TSS_DTOR_ITERATIONS): Likewise.
	(tss_t): New typedef.
	(tss_dtor_t): Likewise.
	(tss_create): New prototype.
	(tss_get): Likewise.
	(tss_set): Likewise.
	(tss_delete): Likewise.
2018-07-24 14:07:12 -03:00
Adhemerval Zanella 918311a3a3 nptl: Add C11 threads cnd_* functions
This patch adds the cnd_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically cnd_broadcast, cnd_destroy, cnd_init, cnd_signal,
cnd_timedwait, cnd_wait, and required types.

Mostly of the definitions are composed based on POSIX conterparts, and
cnd_t is also based on internal pthreads fields, but with distinct internal
layout to avoid possible issues with code interchange (such as trying to pass
POSIX structure on C11 functions and to avoid inclusion of pthread.h).  The
idea is to make it possible to share POSIX internal implementation for mostly
of the code making adjust where only required.

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	[BZ #14092]
	* conform/data/threads.h-data (cnd_t): New type.
	(cnd_init): New function.
	(cnd_signal): Likewise.
	(cnd_broadcast): Likewise.
	(cnd_wait): Likewise.
	(cnd_timedwait): Likewise.
	(cnd_destroy): Likewise.
	* nptl/Makefile (libpthread-routines): Add cnd_broadcast,
	cnd_destroy, cnd_init, cnd_signal, cnd_timedwait, and cnd_wait
	object.
	* nptl/Versions (libpthread) [GLIBC_2.28]: Likewise.
	* nptl/cnd_broadcast.c: New file.
	* nptl/cnd_destroy.c: Likewise.
	* nptl/cnd_init.c: Likewise.
	* nptl/cnd_signal.c: Likewise.
	* nptl/cnd_timedwait.c: Likewise.
	* nptl/cnd_wait.c: Likewise.
	* sysdeps/nptl/threads.h (cnd_t): New type.
	(cnd_init): New prototype.
	(cnd_signa): Likewise.
	(cnd_broadcast): Likewise.
	(cnd_wait): Likewise.
	(cnd_timedwait): Likewise.
	(cnd_destroy): Likewise.
2018-07-24 14:07:07 -03:00
Adhemerval Zanella 3c20a679b6 nptl: Add C11 threads call_once functions
This patch adds the call_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically call_once and required types.

Mostly of the definitions are composed based on POSIX conterparts,including
once_flag (pthread_once_t).  The idea is to make possible to share POSIX
internal implementations for mostly of the code (and making adjustment only
when required).

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	[BZ #14092]
	* conform/data/threads.h-data (ONCE_FLAG_INIT): New macro.
	(once_flag): New type.
	(call_once): New function.
	* nptl/Makefile (libpthread-routines): Add call_once object.
	* nptl/Versions (libphread) [GLIBC_2.28]: Add call_once symbol.
	* nptl/call_once.c: New file.
	* sysdeps/nptl/threads.h (ONCE_FLAG_INIT): New define.
	(once_flag): New type.
	(call_once): New prototype.
2018-07-24 14:07:01 -03:00
Adhemerval Zanella 18d59c1b36 nptl: Add C11 threads mtx_* functions
This patch adds the mtx_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically mtx_init, mtx_destroy, mtx_lock, mtx_timedlock, mtx_trylock,
mtx_unlock, and required types.

Mostly of the definitions are composed based on POSIX conterparts, and mtx_t
is also based on internal pthread fields, but with a distinct internal layout
to avoid possible issues with code interchange (such as trying to pass POSIX
structure on C11 functions and to avoid inclusion of pthread.h).  The idea
is to make possible to share POSIX internal implementations for mostly of
the code (and making adjustment only when required).

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	[BZ #14092]
	* conform/data/threads.h-data (mtx_plain): New constant.
	(mtx_recursive): Likewise.
	(mtx_timed): Likewise.
	(mtx_t): New type.
	(mtx_init): New function.
	(mtx_lock): Likewise.
	(mtx_timedlock): Likewise.
	(mtx_trylock): Likewise.
	(mtx_unlock): Likewise.
	(mtx_destroy): Likewise.
	* nptl/Makefile (libpthread-routines): Add mtx_destroy, mtx_init,
	mtx_lock, mtx_timedlock, mtx_trylock, and mtx_unlock object.
	* nptl/Versions (libpthread) [GLIBC_2.28]): Add mtx_init, mtx_lock,
	mtx_timedlock, mtx_trylock, mtx_unlock, and mtx_destroy.
	* nptl/mtx_destroy.c: New file.
	* nptl/mtx_init.c: Likewise.
	* nptl/mtx_lock.c: Likewise.
	* nptl/mtx_timedlock.c: Likewise.
	* nptl/mtx_trylock.c: Likewise.
	* nptl/mtx_unlock.c: Likewise.
	* sysdeps/nptl/threads.h (mtx_plain): New enumeration.
	(mtx_recursive): Likewise.
	(mtx_timed): Likewise.
	(mtx_t): New type.
	(mtx_init): New prototype.
	(mtx_lock): Likewise.
	(mtx_timedlock): Likewise.
	(mtx_trylock): Likewise.
	(mtx_unlock): Likewise.
	(mtx_destroy): Likewise.
2018-07-24 14:06:54 -03:00
Adhemerval Zanella ce7528f637 nptl: Add C11 threads thrd_* functions
This patch adds the thrd_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically thrd_create, thrd_curent, rhd_detach, thrd_equal,
thrd_exit, thrd_join, thrd_sleep, thrd_yield, and required types.

Mostly of the definitions are composed based on POSIX conterparts, such as
thrd_t (using pthread_t).  For thrd_* function internally direct
POSIX pthread call are used with the exceptions:

  1. thrd_start uses pthread_create internal implementation, but changes
     how to actually calls the start routine.  This is due the difference
     in signature between POSIX and C11, where former return a 'void *'
     and latter 'int'.
     To avoid calling convention issues due 'void *' to int cast, routines
     from C11 threads are started slight different than default pthread one.
     Explicit cast to expected return are used internally on pthread_create
     and the result is stored back to void also with an explicit cast.

  2. thrd_sleep uses nanosleep internal direct syscall to avoid clobbering
     errno and to handle expected standard return codes.  It is a
     cancellation entrypoint to be consistent with both thrd_join and
     cnd_{timed}wait.

  3. thrd_yield also uses internal direct syscall to avoid errno clobbering.

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).

Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.

	[BZ #14092]
	* conform/Makefile (conformtest-headers-ISO11): Add threads.h.
	(linknamespace-libs-ISO11): Add libpthread.a.
	* conform/data/threads.h-data: New file: add C11 thrd_* types and
	functions.
	* include/stdc-predef.h (__STDC_NO_THREADS__): Remove definition.
	* nptl/Makefile (headers): Add threads.h.
	(libpthread-routines): Add new C11 thread thrd_create, thrd_current,
	thrd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, and
	thrd_yield.
	* nptl/Versions (libpthread) [GLIBC_2.28]): Add new C11 thread
	thrd_create, thrd_current, thrd_detach, thrd_equal, thrd_exit,
	thrd_join, thrd_sleep, and thrd_yield symbols.
	* nptl/descr.h (struct pthread): Add c11 field.
	* nptl/pthreadP.h (ATTR_C11_THREAD): New define.
	* nptl/pthread_create.c (START_THREAD_DEFN): Call C11 thread start
	routine with expected function prototype.
	(__pthread_create_2_1): Add C11 threads check based on attribute
	value.
	* sysdeps/unix/sysdep.h (INTERNAL_SYSCALL_CANCEL): New macro.
	* nptl/thrd_create.c: New file.
	* nptl/thrd_current.c: Likewise.
	* nptl/thrd_detach.c: Likewise.
	* nptl/thrd_equal.c: Likewise.
	* nptl/thrd_exit.c: Likewise.
	* nptl/thrd_join.c: Likewise.
	* nptl/thrd_priv.h: Likewise.
	* nptl/thrd_sleep.c: Likewise.
	* nptl/thrd_yield.c: Likewise.
	* include/threads.h: Likewise.
2018-07-24 14:06:45 -03:00
H.J. Lu e27f41ba2b Add <bits/indirect-return.h>
Add <bits/indirect-return.h> and include it in <ucontext.h>.
__INDIRECT_RETURN defined in <bits/indirect-return.h> indicates if
swapcontext requires special compiler treatment.  The default
__INDIRECT_RETURN is empty.

On x86, when shadow stack is enabled, __INDIRECT_RETURN is defined
with indirect_return attribute, which has been added to GCC 9, to
indicate that swapcontext returns via indirect branch.  Otherwise
__INDIRECT_RETURN is defined with returns_twice attribute.

When shadow stack is enabled, remove always_inline attribute from
prepare_test_buffer in string/tst-xbzero-opt.c to avoid:

tst-xbzero-opt.c: In function ‘prepare_test_buffer’:
tst-xbzero-opt.c:105:1: error: function ‘prepare_test_buffer’ can never be inlined because it uses setjmp
 prepare_test_buffer (unsigned char *buf)

when indirect_return attribute isn't available.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* bits/indirect-return.h: New file.
	* misc/sys/cdefs.h (__glibc_has_attribute): New.
	* sysdeps/x86/bits/indirect-return.h: Likewise.
	* stdlib/Makefile (headers): Add bits/indirect-return.h.
	* stdlib/ucontext.h: Include <bits/indirect-return.h>.
	(swapcontext): Add __INDIRECT_RETURN.
	* string/tst-xbzero-opt.c (ALWAYS_INLINE): New.
	(prepare_test_buffer): Use it.
2018-07-24 07:55:47 -07:00
Andreas Schwab 21526a507d Fix out-of-bounds access in IBM-1390 converter (bug 23448)
The IBM-1390 converter can consume/produce two UCS4 characters in each
loop.
2018-07-24 16:45:46 +02:00
H.J. Lu 3650e1d928 x86: Update vfork to pop shadow stack
The shadow stack prevents us from pushing the saved return PC onto
the stack and returning normally.  Instead we pop the shadow stack
and return directly.  This is the safest way to return and ensures
any stack manipulations done by the vfork'd child doesn't cause the
parent to terminate when CET is enabled.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/unix/sysv/linux/i386/vfork.S (SYSCALL_ERROR_HANDLER):
	Redefine if shadow stack is enabled.
	(SYSCALL_ERROR_LABEL): Likewise.
	(__vfork): Pop shadow stack and jump back to to caller directly
	when shadow stack is in use.
	* sysdeps/unix/sysv/linux/x86_64/vfork.S (SYSCALL_ERROR_HANDLER):
	Redefine if shadow stack is enabled.
	(SYSCALL_ERROR_LABEL): Likewise.
	(__vfork): Pop shadow stack and jump back to to caller directly
	when shadow stack is in use.
2018-07-24 05:21:07 -07:00
H.J. Lu ca027e0f62 x86-64: Add endbr64 to tst-quadmod[12].S
Add endbr64 to tst-quadmod1.S and tst-quadmod2.S so that func and foo
can be called indirectly.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/x86_64/tst-quadmod1.S (func): Add endbr64 if IBT is
	enabled.
	(foo): Likewise.
	* sysdeps/x86_64/tst-quadmod2.S (func) : Likewise.
	(foo): Likewise.
2018-07-24 05:12:14 -07:00
Joseph Myers b99f1c957d Use binutils 2.31 branch in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default
	binutils version to 2.31 branch.
2018-07-20 16:11:15 +00:00
Zong Li c8fabb8434 Change URL of gcc's tarball
After 7.1.0 version, there is no .bz2 format of gcc's tarball.

	* scripts/build-many-glibcs.py (Context.checkout_tar): Change the
	URL of gcc's tarball.
2018-07-20 15:30:05 +00:00
Florian Weimer 786658a088 regcomp: Fix off-by-one bug in build_equiv_class [BZ #23396]
This bug is very similar to bug 23036: The existing code assumed that
the length count included the length byte itself.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-20 11:58:51 +02:00
Samuel Thibault 2d5c41ded9 check-execstack: Permit sysdeps to xfail some libs
* scripts/check-execstack.awk: Consider `xfail' variable containing a
	list
	of libraries whose stack executability is expected.
	* elf/Makefile ($(objpfx)check-execstack.out): Pass
	$(check-execstack-xfail) to check-execstack.awk through `xfail'
	variable.
	* sysdeps/mach/hurd/i386/Makefile (check-execstack-xfail): Set to ld.so
	libc.so libpthread.so.
2018-07-20 03:28:14 +02:00
Samuel Thibault 8ba1520e8c hurd: Fix installed-headers tests
* sysdeps/mach/include/mach-shortcuts-hidden.h [!_ISOMAC]: Do not
	declare libc hidden prototypes.
	* sysdeps/mach/include/mach/mach_traps.h [!_ISOMAC]: Likewise.
2018-07-20 03:28:08 +02:00
Thomas Schwinge de195be015 hurd: Implement pipe2
* sysdeps/mach/hurd/pipe2.c: New file, copy from pipe.c.  Evolve it to
	implement __pipe2.
	* sysdeps/mach/hurd/pipe.c (__pipe): Reimplement using __pipe2.
2018-07-20 01:29:55 +02:00
Thomas Schwinge 75d5e4a09e hurd: SOCK_CLOEXEC and SOCK_NONBLOCK for socketpair
* sysdeps/mach/hurd/socketpair.c (__socketpair): Handle SOCK_CLOEXEC
	and SOCK_NONBLOCK.
2018-07-20 01:24:41 +02:00
Thomas Schwinge 6008824221 hurd: SOCK_CLOEXEC and SOCK_NONBLOCK for socket
* sysdeps/mach/hurd/socket.c (__socket): Handle SOCK_CLOEXEC and
	SOCK_NONBLOCK.
2018-07-20 01:22:12 +02:00
Samuel Thibault 46f2474e93 hurd: Enable thread-safe i386 atomic instructions
* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Set multiple_threads
	to 1.
2018-07-20 01:12:08 +02:00
Leonardo Sandoval 1cf4ae7fe6 benchtests: improve argument parsing through argparse library
The argparse library is used on compare_bench script to improve command line
argument parsing. The 'schema validation file' is now optional, reducing by
one the number of required parameters.

	* benchtests/scripts/compare_bench.py (__main__): use the argparse
	library to improve command line parsing.
	(__main__): make schema file as optional parameter (--schema),
	defaulting to benchtests/scripts/benchout.schema.json.
	(main): move out of the parsing stuff to __main_  and leave it
	only as caller of main comparison functions.
2018-07-19 14:53:37 -05:00
H.J. Lu e84bd8514c INSTALL: Add a note for Intel CET status
* NEWS: Add a note for Intel CET status.
	* manual/install.texi: Likewise.
	* INSTALL: Regenerated.
2018-07-19 12:05:10 -07:00
Quentin PAGÈS df467d229a oc_FR locale: Multiple updates (bug 23140, bug 23422).
Multiple updates for Occitan language including alternative month names,
update abday and abmon, fix typos in day, fix d_fmt, correct LC_NAME,
and use “copy "ca_ES"” as LC_COLLATE.

	[BZ #23140]
	* localedata/locales/oc_FR (mon): Rename to...
	(alt_mon): This, then update October (typo fix).
	(mon): New content (genitive case, month names preceded by
	"de" or "d’").

	[BZ #23422]
	* localedata/locales/oc_FR (abday): Update all items.
	(day): Update Wednesday and Saturday (typo fixes).
	(abmon): Update all items, except May.
	(d_fmt): Update "%d.%m.%Y" -> "%d/%m/%Y".
	(LC_IDENTIFICATION): Bump the revision number and date.
	Keep the "category" entries in alphabetic order.
	(LC_ADDRESS): Remove no longer needed comment.
	(LC_COLLATE): Use “copy "ca_ES"”.
	(LC_NAME): Set the correct values of "name_fmt", "name_mr", and
	"name_mrs".

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-18 23:17:17 +02:00
Joseph Myers 5c112f1b62 Avoid insecure usage of tmpnam in tests.
Various glibc testcases use tmpnam in ways subject to race conditions
(generate a temporary file name, then later open that file without
O_EXCL).

This patch fixes those tests to use mkstemp - generally a minimal
local fix to use mkstemp instead of tmpnam, rather than a larger fix
to use other testsuite infrastructure for temporary files.  The
unchanged use of tmpnam in posix/wordexp-test.c would fail safe in the
event of a race (it's generating a name for use with mkdir rather than
for a file to be opened for writing).

Tested for x86_64.

	* grp/tst_fgetgrent.c: Include <unistd.h>.
	(main): Use mkstemp instead of tmpnam.
	* io/test-utime.c (main): Likewise.
	* posix/annexc.c (macrofile): Change to modifiable array.
	(get_null_defines): Use mkstemp instead of tmpnam.  Do not remove
	macrofile here.
	* posix/bug-getopt1.c: Include <stdlib.h>.
	(do_test): Use mkstemp instead of tmpnam.
	* posix/bug-getopt2.c: Include <stdlib.h>.
	(do_test): Use mkstemp instead of tmpnam.
	* posix/bug-getopt3.c: Include <stdlib.h>.
	(do_test): Use mkstemp instead of tmpnam.
	* posix/bug-getopt4.c: Include <stdlib.h>.
	(do_test): Use mkstemp instead of tmpnam.
	* posix/bug-getopt5.c: Include <stdlib.h>.
	(do_test): Use mkstemp instead of tmpnam.
	* stdio-common/bug7.c: Include <stdlib.h> and <unistd.h>.
	(main): Use mkstemp instead of tmpnam.
	* stdio-common/tst-fdopen.c: Include <stdlib.h>.
	(main): Use mkstemp instead of tmpnam.
	* stdio-common/tst-ungetc.c: Include <stdlib.h>.
	(main): use mkstemp instead of tmpnam.
	* stdlib/isomac.c (macrofile): Change to modifiable array.
	(get_null_defines): Use mkstemp instead of tmpnam.  Do not remove
	macrofile here.
2018-07-18 21:04:12 +00:00
H.J. Lu 6d90776dff x86/CET: Document glibc.tune.x86_ibt and glibc.tune.x86_shstk
* manual/tunables.texi: Document glibc.tune.x86_ibt and
	glibc.tune.x86_shstk.
2018-07-18 11:35:03 -07:00
H.J. Lu e6c695099b Intel CET: Document --enable-cet
* NEWS: Mention --enable-cet.
	* manual/install.texi: Document --enable-cet.
	* INSTALL: Regenerated.
2018-07-18 09:52:53 -07:00
H.J. Lu e2d40a8822 x86-64: Use _CET_NOTRACK in memcmp-sse4.S
* sysdeps/x86_64/multiarch/memcmp-sse4.S (BRANCH_TO_JMPTBL_ENTRY):
	Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18 08:07:32 -07:00
H.J. Lu 77a8ae0948 i386: Use _CET_NOTRACK in memset-sse2-rep.S
* sysdeps/i386/i686/multiarch/memset-sse2-rep.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 08:04:12 -07:00
H.J. Lu 90d15dc577 i386: Use _CET_NOTRACK in strcat-sse2.S
* sysdeps/i386/i686/multiarch/strcat-sse2.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 08:03:15 -07:00
H.J. Lu f1574581c7 i386: Use _CET_NOTRACK in strcpy-sse2.S
* sysdeps/i386/i686/multiarch/strcpy-sse2.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 08:02:26 -07:00
H.J. Lu 7fb613361c i386: Use _CET_NOTRACK in memcpy-ssse3.S
* sysdeps/i386/i686/multiarch/memcpy-ssse3.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 08:01:06 -07:00
H.J. Lu 0a899af097 i386: Use _CET_NOTRACK in memcpy-ssse3-rep.S
* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
	(BRANCH_TO_JMPTBL_ENTRY_TAIL): Likewise.
2018-07-18 08:00:09 -07:00
H.J. Lu 177824e232 i386: Use _CET_NOTRACK in memcmp-sse4.S
* sysdeps/i386/i686/multiarch/memcmp-sse4.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 07:59:04 -07:00
H.J. Lu 00e7b76a8f i386: Use _CET_NOTRACK in memset-sse2.S
* sysdeps/i386/i686/multiarch/memset-sse2.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 07:57:59 -07:00
H.J. Lu 7e119cd582 i386: Use _CET_NOTRACK in i686/memcmp.S
* sysdeps/i386/i686/memcmp.S (memcmp): Add _CET_NOTRACK before
	indirect jump to jump table.
2018-07-18 07:56:58 -07:00
H.J. Lu 03aaf49b68 x86-64: Use _CET_NOTRACK in memcpy-ssse3.S
* sysdeps/x86_64/multiarch/memcpy-ssse3.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
	(MEMCPY): Likewise.
2018-07-18 06:39:46 -07:00
H.J. Lu 811e9e52b2 x86-64: Use _CET_NOTRACK in memcpy-ssse3-back.S
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
	(MEMCPY): Likewise.
2018-07-18 06:38:23 -07:00
H.J. Lu 8817df4265 x86-64: Use _CET_NOTRACK in strcmp-sse42.S
* sysdeps/x86_64/multiarch/strcmp-sse42.S (STRCMP_SSE42): Add
	_CET_NOTRACK before indirect jump to jump table.
2018-07-18 06:37:09 -07:00
H.J. Lu 921595d151 x86-64: Use _CET_NOTRACK in strcpy-sse2-unaligned.S
* sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S
	(BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump
	to jump table.
2018-07-18 06:33:06 -07:00
H.J. Lu 4ef60d9597 x86_64: Use _CET_NOTRACK in strcmp.S
* sysdeps/x86_64/strcmp.S (STRCMP): Add _CET_NOTRACK before
	indirect jump to jump table.
2018-07-18 06:31:53 -07:00
Valery Timiriliyev 61c4aad705 New locale: Yakut (Sakha) for Russia (sah_RU) [BZ #22241]
* localedata/Makefile (test-input): Add sah_RU.UTF-8.
	(LOCALES): Likewise.
	* localedata/SUPPORTED (sah_RU/UTF-8): New entry.
	* localedata/locales/sah_RU: New file.
	* localedata/sah_RU.UTF-8.in: New file.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-18 11:45:44 +02:00
H.J. Lu be9ccd27c0 i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.S
i386 add_n.S and sub_n.S use a trick to implment jump tables with LEA.
We can't use conditional branches nor normal jump tables since jump
table entries use EFLAGS set by jump table index.  This patch adds
_CET_ENDBR to indirect jump targets and adjust destination for
_CET_ENDBR.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/i386/add_n.S: Include <sysdep.h>, instead of
	"sysdep.h".
	(__mpn_add_n): Save and restore %ebx if IBT is enabed.  Add
	_CET_ENDBR to indirect jump targets and adjust jump destination
	for _CET_ENDBR.
	* sysdeps/i386/i686/add_n.S: Include <sysdep.h>, instead of
	"sysdep.h".
	(__mpn_add_n): Save and restore %ebx if IBT is enabed.  Add
	_CET_ENDBR to indirect jump targets and adjust jump destination
	for _CET_ENDBR.
	* sysdeps/i386/sub_n.S: Include <sysdep.h>, instead of
	"sysdep.h".
	(__mpn_sub_n): Save and restore %ebx if IBT is enabed.  Add
	_CET_ENDBR to indirect jump targets and adjust jump destination
	for _CET_ENDBR.
2018-07-17 16:11:44 -07:00
H.J. Lu 5efc6777ad x86-64: Add _CET_ENDBR to STRCMP_SSE42
Add _CET_ENDBR to STRCMP_SSE42, which is called indirectly, to support
IBT.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/x86_64/multiarch/strcmp-sse42.S (STRCMP_SSE42): Add
	_CET_ENDBR.
2018-07-17 16:08:47 -07:00
H.J. Lu 562837c002 x86: Add _CET_ENDBR to functions in dl-tlsdesc.S
Add _CET_ENDBR to functions in dl-tlsdesc.S, which are called indirectly,
to support IBT.

Tested on i686 and x86-64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_return): Add
	_CET_ENDBR.
	(_dl_tlsdesc_undefweak): Likewise.
	(_dl_tlsdesc_dynamic): Likewise.
	(_dl_tlsdesc_resolve_abs_plus_addend): Likewise.
	(_dl_tlsdesc_resolve_rel): Likewise.
	(_dl_tlsdesc_resolve_rela): Likewise.
	(_dl_tlsdesc_resolve_hold): Likewise.
	* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_return): Likewise.
	(_dl_tlsdesc_undefweak): Likewise.
	(_dl_tlsdesc_dynamic): Likewise.
	(_dl_tlsdesc_resolve_rela): Likewise.
	(_dl_tlsdesc_resolve_hold): Likewise.
2018-07-17 16:07:17 -07:00
H.J. Lu 124bcde683 x86: Add _CET_ENDBR to functions in crti.S
Add _CET_ENDBR to functions in crti.S, which are called indirectly, to
support IBT.

Tested on i686 and x86-64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/i386/crti.S (_init): Add _CET_ENDBR.
	(_fini): Likewise.
	* sysdeps/x86_64/crti.S (_init): Likewise.
	(_fini): Likewise.
2018-07-17 16:05:18 -07:00
Rafal Luzynski 9145f0333d os_RU: Add alternative month names (bug 23140).
[BZ #23140]
	* localedata/locales/os_RU (mon): Rename to...
	(alt_mon): This.
	(mon): Import from CLDR (genitive case).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-17 23:58:56 +02:00
H.J. Lu ba2ea23d05 x86: Always include <dl-cet.h>/cet-tunables.h> for --enable-cet
Always include <dl-cet.h> and cet-tunables.h> when CET is enabled.
Otherwise, configure glibc with --enable-cet --disable-tunables will
fail to build.

	* sysdeps/x86/cpu-features.c: Always include <dl-cet.h> and
	cet-tunables.h> when CET is enabled.
2018-07-17 04:16:35 -07:00
H.J. Lu f753fa7dea x86: Support IBT and SHSTK in Intel CET [BZ #21598]
Intel Control-flow Enforcement Technology (CET) instructions:

https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-en
forcement-technology-preview.pdf

includes Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK).

GNU_PROPERTY_X86_FEATURE_1_IBT is added to GNU program property to
indicate that all executable sections are compatible with IBT when
ENDBR instruction starts each valid target where an indirect branch
instruction can land.  Linker sets GNU_PROPERTY_X86_FEATURE_1_IBT on
output only if it is set on all relocatable inputs.

On an IBT capable processor, the following steps should be taken:

1. When loading an executable without an interpreter, enable IBT and
lock IBT if GNU_PROPERTY_X86_FEATURE_1_IBT is set on the executable.
2. When loading an executable with an interpreter, enable IBT if
GNU_PROPERTY_X86_FEATURE_1_IBT is set on the interpreter.
  a. If GNU_PROPERTY_X86_FEATURE_1_IBT isn't set on the executable,
     disable IBT.
  b. Lock IBT.
3. If IBT is enabled, when loading a shared object without
GNU_PROPERTY_X86_FEATURE_1_IBT:
  a. If legacy interwork is allowed, then mark all pages in executable
     PT_LOAD segments in legacy code page bitmap.  Failure of legacy code
     page bitmap allocation causes an error.
  b. If legacy interwork isn't allowed, it causes an error.

GNU_PROPERTY_X86_FEATURE_1_SHSTK is added to GNU program property to
indicate that all executable sections are compatible with SHSTK where
return address popped from shadow stack always matches return address
popped from normal stack.  Linker sets GNU_PROPERTY_X86_FEATURE_1_SHSTK
on output only if it is set on all relocatable inputs.

On a SHSTK capable processor, the following steps should be taken:

1. When loading an executable without an interpreter, enable SHSTK if
GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on the executable.
2. When loading an executable with an interpreter, enable SHSTK if
GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on interpreter.
  a. If GNU_PROPERTY_X86_FEATURE_1_SHSTK isn't set on the executable
     or any shared objects loaded via the DT_NEEDED tag, disable SHSTK.
  b. Otherwise lock SHSTK.
3. After SHSTK is enabled, it is an error to load a shared object
without GNU_PROPERTY_X86_FEATURE_1_SHSTK.

To enable CET support in glibc, --enable-cet is required to configure
glibc.  When CET is enabled, both compiler and assembler must support
CET.  Otherwise, it is a configure-time error.

To support CET run-time control,

1. _dl_x86_feature_1 is added to the writable ld.so namespace to indicate
if IBT or SHSTK are enabled at run-time.  It should be initialized by
init_cpu_features.
2. For dynamic executables:
   a. A l_cet field is added to struct link_map to indicate if IBT or
      SHSTK is enabled in an ELF module.  _dl_process_pt_note or
      _rtld_process_pt_note is called to process PT_NOTE segment for
      GNU program property and set l_cet.
   b. _dl_open_check is added to check IBT and SHSTK compatibilty when
      dlopening a shared object.
3. Replace i386 _dl_runtime_resolve and _dl_runtime_profile with
_dl_runtime_resolve_shstk and _dl_runtime_profile_shstk, respectively if
SHSTK is enabled.

CET run-time control can be changed via GLIBC_TUNABLES with

$ export GLIBC_TUNABLES=glibc.tune.x86_shstk=[permissive|on|off]
$ export GLIBC_TUNABLES=glibc.tune.x86_ibt=[permissive|on|off]

1. permissive: SHSTK is disabled when dlopening a legacy ELF module.
2. on: IBT or SHSTK are always enabled, regardless if there are IBT or
SHSTK bits in GNU program property.
3. off: IBT or SHSTK are always disabled, regardless if there are IBT or
SHSTK bits in GNU program property.

<cet.h> from CET-enabled GCC is automatically included by assembly codes
to add GNU_PROPERTY_X86_FEATURE_1_IBT and GNU_PROPERTY_X86_FEATURE_1_SHSTK
to GNU program property.  _CET_ENDBR is added at the entrance of all
assembly functions whose address may be taken.  _CET_NOTRACK is used to
insert NOTRACK prefix with indirect jump table to support IBT.  It is
defined as notrack when _CET_NOTRACK is defined in <cet.h>.

	 [BZ #21598]
	* configure.ac: Add --enable-cet.
	* configure: Regenerated.
	* elf/Makefille (all-built-dso): Add a comment.
	* elf/dl-load.c (filebuf): Moved before "dynamic-link.h".
	Include <dl-prop.h>.
	(_dl_map_object_from_fd): Call _dl_process_pt_note on PT_NOTE
	segment.
	* elf/dl-open.c: Include <dl-prop.h>.
	(dl_open_worker): Call _dl_open_check.
	* elf/rtld.c: Include <dl-prop.h>.
	(dl_main): Call _rtld_process_pt_note on PT_NOTE segment.  Call
	_rtld_main_check.
	* sysdeps/generic/dl-prop.h: New file.
	* sysdeps/i386/dl-cet.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/cpu-features.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/dl-cet.h: Likewise.
	* sysdeps/x86/cet-tunables.h: Likewise.
	* sysdeps/x86/check-cet.awk: Likewise.
	* sysdeps/x86/configure: Likewise.
	* sysdeps/x86/configure.ac: Likewise.
	* sysdeps/x86/dl-cet.c: Likewise.
	* sysdeps/x86/dl-procruntime.c: Likewise.
	* sysdeps/x86/dl-prop.h: Likewise.
	* sysdeps/x86/libc-start.h: Likewise.
	* sysdeps/x86/link_map.h: Likewise.
	* sysdeps/i386/dl-trampoline.S (_dl_runtime_resolve): Add
	_CET_ENDBR.
	(_dl_runtime_profile): Likewise.
	(_dl_runtime_resolve_shstk): New.
	(_dl_runtime_profile_shstk): Likewise.
	* sysdeps/linux/x86/Makefile (sysdep-dl-routines): Add dl-cet
	if CET is enabled.
	(CFLAGS-.o): Add -fcf-protection if CET is enabled.
	(CFLAGS-.os): Likewise.
	(CFLAGS-.op): Likewise.
	(CFLAGS-.oS): Likewise.
	(asm-CPPFLAGS): Add -fcf-protection -include cet.h if CET
	is enabled.
	(tests-special): Add $(objpfx)check-cet.out.
	(cet-built-dso): New.
	(+$(cet-built-dso:=.note)): Likewise.
	(common-generated): Add $(cet-built-dso:$(common-objpfx)%=%.note).
	($(objpfx)check-cet.out): New.
	(generated): Add check-cet.out.
	* sysdeps/x86/cpu-features.c: Include <dl-cet.h> and
	<cet-tunables.h>.
	(TUNABLE_CALLBACK (set_x86_ibt)): New prototype.
	(TUNABLE_CALLBACK (set_x86_shstk)): Likewise.
	(init_cpu_features): Call get_cet_status to check CET status
	and update dl_x86_feature_1 with CET status.  Call
	TUNABLE_CALLBACK (set_x86_ibt) and TUNABLE_CALLBACK
	(set_x86_shstk).  Disable and lock CET in libc.a.
	* sysdeps/x86/cpu-tunables.c: Include <cet-tunables.h>.
	(TUNABLE_CALLBACK (set_x86_ibt)): New function.
	(TUNABLE_CALLBACK (set_x86_shstk)): Likewise.
	* sysdeps/x86/sysdep.h (_CET_NOTRACK): New.
	(_CET_ENDBR): Define if not defined.
	(ENTRY): Add _CET_ENDBR.
	* sysdeps/x86/dl-tunables.list (glibc.tune): Add x86_ibt and
	x86_shstk.
	* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Add
	_CET_ENDBR.
	(_dl_runtime_profile): Likewise.
2018-07-16 14:08:27 -07:00
Rogerio Alves 52b2a80fae powerpc64: Always restore TOC on longjmp [BZ #21895]
This patch changes longjmp to always restore the TOC pointer (r2 register)
to the caller frame on powerpc64 and powerpc64le.  This is related to bug
21895 that reports a situation where you have a static longjmp to a
shared object file.

	[BZ #21895]
	* sysdeps/powerpc/powerpc64/__longjmp-common.S: Remove condition code for
	restoring r2 in longjmp.
	* sysdeps/powerpc/powerpc64/Makefile: Added tst-setjmp-bug21895-static to
	test list.
	Added rules to build test tst-setjmp-bug21895-static.
	Added module setjmp-bug21895 and rules to build a shared object from it.
	* sysdeps/powerpc/powerpc64/setjmp-bug21895.c: New test file.
	* sysdeps/powerpc/powerpc64/tst-setjmp-bug21895-static.c: New test file.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-07-16 16:08:41 -03:00
Wilco Dijkstra 3ae725dfb6 Improve strstr performance
Improve strstr performance.  Strstr tends to be slow because it uses
many calls to memchr and a slow byte loop to scan for the next match.
Performance is significantly improved by using strnlen on larger blocks
and using strchr to search for the next matching character.  strcasestr
can also use strnlen to scan ahead, and memmem can use memchr to check
for the next match.

On the GLIBC bench tests the performance gains on Cortex-A72 are:
strstr: +25%
strcasestr: +4.3%
memmem: +18%

On a 256KB dataset strstr performance improves by 67%, strcasestr by 47%.

    Reviewd-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2018-07-16 17:51:52 +01:00
H.J. Lu 31e422ca96 x86_64: Undef SHADOW_STACK_POINTER_OFFSET last
Since SHADOW_STACK_POINTER_OFFSET is defined in jmp_buf-ssp.h, we must
undef SHADOW_STACK_POINTER_OFFSET after including <jmp_buf-ssp.h>.

	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Undef
	SHADOW_STACK_POINTER_OFFSET after including <jmp_buf-ssp.h>.
2018-07-15 08:48:54 -07:00
H.J. Lu faaee1f07e x86: Support shadow stack pointer in setjmp/longjmp
Save and restore shadow stack pointer in setjmp and longjmp to support
shadow stack in Intel CET.  Use feature_1 in tcbhead_t to check if
shadow stack is enabled before saving and restoring shadow stack pointer.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/i386/__longjmp.S: Include <jmp_buf-ssp.h>.
	(__longjmp): Restore shadow stack pointer if shadow stack is
	enabled, SHADOW_STACK_POINTER_OFFSET is defined and __longjmp
	isn't defined for __longjmp_cancel.
	* sysdeps/i386/bsd-_setjmp.S: Include <jmp_buf-ssp.h>.
	(_setjmp): Save shadow stack pointer if shadow stack is enabled
	and SHADOW_STACK_POINTER_OFFSET is defined.
	* sysdeps/i386/bsd-setjmp.S: Include <jmp_buf-ssp.h>.
	(setjmp): Save shadow stack pointer if shadow stack is enabled
	and SHADOW_STACK_POINTER_OFFSET is defined.
	* sysdeps/i386/setjmp.S: Include <jmp_buf-ssp.h>.
	(__sigsetjmp): Save shadow stack pointer if shadow stack is
	enabled and SHADOW_STACK_POINTER_OFFSET is defined.
	* sysdeps/unix/sysv/linux/i386/____longjmp_chk.S: Include
	<jmp_buf-ssp.h>.
	(____longjmp_chk): Restore shadow stack pointer if shadow stack
	is enabled and SHADOW_STACK_POINTER_OFFSET is defined.
	* sysdeps/unix/sysv/linux/x86/Makefile (gen-as-const-headers):
	Remove jmp_buf-ssp.sym.
	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Include
	<jmp_buf-ssp.h>.
	(____longjmp_chk): Restore shadow stack pointer if shadow stack
	is enabled and SHADOW_STACK_POINTER_OFFSET is defined.
	* sysdeps/x86/Makefile (gen-as-const-headers): Add
	jmp_buf-ssp.sym.
	* sysdeps/x86/jmp_buf-ssp.sym: New dummy file.
	* sysdeps/x86_64/__longjmp.S: Include <jmp_buf-ssp.h>.
	(__longjmp): Restore shadow stack pointer if shadow stack is
	enabled, SHADOW_STACK_POINTER_OFFSET is defined and __longjmp
	isn't defined for __longjmp_cancel.
	* sysdeps/x86_64/setjmp.S: Include <jmp_buf-ssp.h>.
	(__sigsetjmp): Save shadow stack pointer if shadow stack is
	enabled and SHADOW_STACK_POINTER_OFFSET is defined.
2018-07-14 05:59:53 -07:00
H.J. Lu ebff9c5cfa x86: Rename __glibc_reserved1 to feature_1 in tcbhead_t [BZ #22563]
feature_1 has X86_FEATURE_1_IBT and X86_FEATURE_1_SHSTK bits for CET
run-time control.

CET_ENABLED, IBT_ENABLED and SHSTK_ENABLED are defined to 1 or 0 to
indicate that if CET, IBT and SHSTK are enabled.

<tls-setup.h> is added to set up thread-local data.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	[BZ #22563]
	* nptl/pthread_create.c: Include <tls-setup.h>.
	(__pthread_create_2_1): Call tls_setup_tcbhead.
	* sysdeps/generic/tls-setup.h: New file.
	* sysdeps/x86/nptl/tls-setup.h: Likewise.
	* sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
	* sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET):
	Likewise.
	* sysdeps/i386/nptl/tls.h (tcbhead_t): Rename __glibc_reserved1
	to feature_1.
	* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise.
	* sysdeps/x86/sysdep.h (X86_FEATURE_1_IBT): New.
	(X86_FEATURE_1_SHSTK): Likewise.
	(CET_ENABLED): Likewise.
	(IBT_ENABLED): Likewise.
	(SHSTK_ENABLED): Likewise.
2018-07-14 05:56:46 -07:00
Rafal Luzynski 0a83bad2aa dsb_DE locale: Fix syntax error and add tests (bug 23208).
Fixed syntax error in the collation rules of Lower Sorbian language.
Collation test added in order to test the bugs like this early.

Reported-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

	[BZ #23208]
	* localedata/Makefile (test-input): Add dsb_DE.UTF-8.
	(LOCALES): Likewise.
	* localedata/dsb_DE.UTF-8.in: New file.
	* localedata/locales/dsb_DE (LC_COLLATE): Fix syntax error.
2018-07-13 23:06:32 +02:00
Florian Weimer 046bfed9de nptl: Use __mprotect consistently for _STACK_GROWS_UP 2018-07-12 15:01:43 +02:00
Florian Weimer 93304f5f7a Install <bits/statx.h> header 2018-07-11 08:59:51 +02:00
Mike FABIAN 4beefeeb8e Put the correct Unicode version number 11.0.0 into the generated files
In some places there was still the old Unicode version 10.0.0 in the files.

	* localedata/charmaps/UTF-8: Use correct Unicode version 11.0.0 in comment.
	* localedata/locales/i18n_ctype: Use correct Unicode version in comments
	and headers.
	* localedata/unicode-gen/utf8_gen.py: Add option to specify Unicode version
	* localedata/unicode-gen/Makefile: Use option to specify Unicode version
	for utf8_gen.py
2018-07-10 17:30:31 +02:00
Florian Weimer fd70af4552 Add the statx function 2018-07-10 16:14:45 +02:00
Adhemerval Zanella b444e8f7cc Comment tst-ofdlocks-compat expected failure in some Linux releases
As pointed out in a libc-alpha thread [1], the misc/tst-ofdlocks-compat
may fail in some specific Linux releases.  This patch adds a comment
along with a link to discussion in the test source code.

No changes are expected.

	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Add a comment about
	a kernel issue which lead to test failure in some cases.

[1] https://sourceware.org/ml/libc-alpha/2018-07/msg00243.html
2018-07-10 10:28:39 -03:00
Florian Weimer 7b2f4cedf0 regexec: Fix off-by-one bug in weight comparison [BZ #23036]
Each weight is prefixed by its length, and the length does not include
itself in the count.  This can be seen clearly from the find_idx
function in string/strxfrm_l.c, for example.  The old code behaved as if
the length itself counted, thus comparing an additional byte after the
weight, leading to spurious comparison failures and incorrect further
partitioning of character equivalence classes.
2018-07-10 11:18:26 +02:00
Florian Weimer 4fa34da679 Fix copyright years in recent commits 2018-07-10 11:03:08 +02:00
Florian Weimer 916124ed84 nss_files: Fix re-reading of long lines [BZ #18991]
Use the new __libc_readline_unlocked function to pick up
reading at the same line in case the buffer needs to be enlarged.
2018-07-06 17:52:54 +02:00
Florian Weimer 3f5e3f5d06 libio: Implement internal function __libc_readline_unlocked
This is a variant of fgets which fails with ERANGE if the
buffer is too small, and the buffer length is given as an
argument of type size_t.

This function will be useful for implementing NSS file reading
operations.  Compared to a direct implementation using the public API,
it avoids an lseek system call in case the line terminator can be
found in the internal read buffer.
2018-07-06 17:52:54 +02:00
Szabolcs Nagy 397c54c1af aarch64: add HWCAP_ATOMICS to HWCAP_IMPORTANT
This enables searching shared libraries in atomics/ when the hardware
supports LSE atomics of armv8.1 so one can provide optimized variants
of libraries in a portable way.

LSE atomics does not affect library abi, the new instructions can
interoperate with old ones.

I considered the earlier comments on the patch

https://sourceware.org/ml/libc-alpha/2018-04/msg00400.html
https://sourceware.org/ml/libc-alpha/2018-04/msg00625.html

It turns out that the way glibc dynamic linker decides on the search
path is not very flexible: it wants to use hwcap bits and associated
strings.  So some targets reuse hwcap bits for glibc internal purposes
to affect the search logic.  But hwcap is an interface with the kernel,
glibc should not allocate bits in it for its internal logic as that
limits future hwcap extensions and confusing to users who expect to see
hwcap bits in ifunc resolvers.  Instead of rewriting the dynamic linker
path logic (which affects all targets) this patch just uses the existing
mechanism, however this means that the path name has to be the hwcap
name "atomics" and cannot be changed to something more meaningful to
users.

It is hard to tell how much performance benefit this can give, in
principle armv8.1 atomics can be better optimized in the hardware, so it
can make a difference for synchronization heavy code.  On some systems
such multilib setup may be the only viable way to get optimized
libraries used.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (HWCAP_IMPORTANT): Add
	HWCAP_ATOMICS.
2018-07-06 15:58:16 +01:00
Szabolcs Nagy d0cd798071 aarch64: Remove HWCAP_CPUID from HWCAP_IMPORTANT
This partially reverts

commit f82e9672ad
Author:     Siddhesh Poyarekar <siddhesh@sourceware.org>

    aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK

The idea was to make it possible to disable cpuid based ifunc resolution
in glibc by changing the hwcap mask which the user could already control.

However the hwcap mask has an orthogonal role: it specifies additional
library search paths for the dynamic linker.  So "cpuid" got added to
the search paths when it was set in the default mask (HWCAP_IMPORTANT),
which is not useful behaviour, the hwcap masking should not be reused
in the cpu features code.

Meanwhile there is a tunable to set the cpu explicitly so it is possible
to disable the cpuid based dispatch without using a hwcap mask:

  GLIBC_TUNABLES=glibc.tune.cpu=generic

	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (init_cpu_features):
	Use dl_hwcap without masking.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (HWCAP_IMPORTANT):
	Remove HWCAP_CPUID.
2018-07-06 15:57:18 +01:00
Florian Weimer ddb3c626b0 conform/conformtest.pl: Escape literal braces in regular expressions
This suppresses Perl warnings like these:

Unescaped left brace in regex is deprecated here (and will be fatal in
Perl 5.32), passed through in regex; marked by <-- HERE in m/^element
*({ <-- HERE ([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*)
*(.*)/ at conformtest.pl line 370.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-06 16:31:55 +02:00
Amit Pawar bce5911b67 Use AVX_Fast_Unaligned_Load from Zen onwards.
From Zen onwards this will be enabled. It was disabled for the
Excavator case and will remain disabled.

Reviewd-by: Carlos O'Donell <carlos@redhat.com>
2018-07-06 09:55:36 -04:00
Florian Weimer 3a885c1f51 Build csu/elf-init.c and csu/static-reloc.c with stack protector
This does not change generated code (with -fstack-protector-strong), but
is important for formal compiler flags compliance.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-05 22:57:45 +02:00
Florian Weimer 38cade0c46 Compile debug/stack_chk_fail_local.c with stack protector
The resulting object file is statically linked into applications, so
it is desirable to have (formal) stack protector coverage there.
2018-07-05 19:28:35 +02:00
Maciej W. Rozycki 9449a295ad libc-abis: Define ABSOLUTE ABI [BZ #19818][BZ #23307]
Define a new ABSOLUTE ABI for static linker's use with EI_ABIVERSION
where correct absolute (SHN_ABS) symbol run-time load semantics is
required.  This way it can be ensured at static link time that a program
or DSO will not suffer from previous semantics where absolute symbols
were relocated by the base address, or symbols whose `st_value' is zero
silently ignored leading to a confusing "undefined symbol" error message
at load time, and instead "ELF file ABI version invalid" is printed with
old dynamic loaders, making it clear that there is an ABI version
incompatibility.

	[BZ #19818]
	[BZ #23307]
	* libc-abis (ABSOLUTE): New ABI.
	* sysdeps/unix/sysv/linux/mips/libc-abis (ABSOLUTE): New ABI.
	* NEWS: Mention the new ABI.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-05 18:06:43 +01:00
Florian Weimer d6da5cb6a8 Add renameat2 function [BZ #17662]
The implementation falls back to renameat if renameat2 is not available
in the kernel (or in the kernel headers) and the flags argument is zero.
Without kernel support, a non-zero argument returns EINVAL, not ENOSYS.
This mirrors what the kernel does for invalid renameat2 flags.
2018-07-05 19:00:10 +02:00
Adhemerval Zanella 1002d70823 posix: Fix bug-regex33 after regex sync
On some platforms the inclusion of regex-internal.h in bug-regex33
testcase show a MAX redefinition if test-skeleton.c is include later.
This patch fixes by removing regex-internal.h inclusion and using
SBC_MAX value directly.

Checked on aarch64-linux-gnu.

	* posix/bug-regex33.c: Fix build after regex sync.
2018-07-04 17:29:49 -03:00
Carlos O'Donell 34fdb893e0 locale: XFAIL newlocale usage in static binary (Bug 23164)
There is a glibc optimization which allows for locale categories
to be removed during static compilation. There have been various
bugs for this support over the years, with bug 16915 being the
most recent. The solution there was to emit a reference to all the
categories to avoid any being removed. This fix, although it's in
the generic __nl_langinfo_l function, doesn't appear to be enough
to fix the case for a statically linked program that uses newlocale
and nl_langinfo_l. This commit doesn't fix the problem, but it does
add a XFAIL'd test case such that a fix can be applied against this
and the XFAIL removed. It's not entirely clear that the problem is
the same as that which was seen in bug 16915.
2018-07-04 15:23:50 -04:00
Florian Weimer f2873d2da0 testrun.sh: Implement --tool=strace, --tool=valgrind
$(file …) appears to be the only convenient way to create files
with newlines and make substitution variables.  This needs make 4.0
(released in 2013), so update the requirement to match.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-04 15:30:45 +02:00
Adhemerval Zanella eb04c21373 posix: Sync gnulib regex implementation
This patch syncs the regex implementation with gnulib (commit 0ee5212).
Only two changes in GLIBC regex testing are required:

  1. posix/bug-regex28.c: as previously discussed [1] the change of
     expected results on the pattern should be safe.

  2. posix/PCRE.tests: the ERE (a)|\1 is malformed (in the sense that
     the \1 doesn't mean anything) and although current GLIBC accepts
     it has undefined behavior.  This patch removes the specific test.

This sync contains some patches from thread 'Regex: Make libc regex
more usable outside GLIBC.' [2] which have been pushed upstream in
gnulib.  This patches also fixes some regex issues (BZ #23233,
BZ #21163, BZ #18986, BZ #13762) and I did not add testcases for
both #23233 and #13762 because I couldn't think a simple way to
trigger the expected failure path to trigger them.

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

	[BZ #23233]
	[BZ #21163]
	[BZ #18986]
	[BZ #13762]
	* posix/Makefile (tests): Add bug-regex37 and bug-regex38.
	* posix/PCRE.tests: Remove invalid test.
	* posix/bug-regex28.c: Fix expected values for used syntax.
	* posix/bug-regex37.c: New file.
	* posix/bug-regex38.c: Likewise.
	* posix/regcomp.c: Sync with gnulib.
	* posix/regex.c: Likewise.
	* posix/regex.h: Likewise.
	* posix/regex_internal.c: Likewise.
	* posix/regex_internal.h: Likewise.
	* posix/regexec.c: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2017-12/msg00807.html
[2] https://sourceware.org/ml/libc-alpha/2017-12/msg00237.html
2018-07-04 09:54:45 -03:00
Mike FABIAN b11643c21c Bug 23308: Update to Unicode 11.0.0
Unicode 11.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 11.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Some info about the number of characters added:

Total added characters in newly generated CHARMAP: 684
Total added characters in newly generated WIDTH: 119
alpha: Added 380 characters in new ctype which were not in old ctype
combining: Added 56 characters in new ctype which were not in old ctype
combining_level3: Added 37 characters in new ctype which were not in old ctype
graph: Added 684 characters in new ctype which were not in old ctype
lower: Added 82 characters in new ctype which were not in old ctype
print: Added 684 characters in new ctype which were not in old ctype
punct: Added 304 characters in new ctype which were not in old ctype
tolower: Added 79 characters in new ctype which were not in old ctype
totitle: Added 33 characters in new ctype which were not in old ctype
toupper: Added 79 characters in new ctype which were not in old ctype
upper: Added 79 characters in new ctype which were not in old ctype

No characters were removed.

	[BZ #23308]
	* unicode-gen/Makefile (UNICODE_VERSION): Set to 11.0.0.
	* localedata/unicode-gen/DerivedCoreProperties.txt: Update to Unicode 11.0.0.
	* localedata/unicode-gen/EastAsianWidth.txt: likewise.
	* localedata/unicode-gen/PropList.txt: likewise.
	* localedata/unicode-gen/UnicodeData.txt: likewise.
	* localedata/charmaps/UTF-8: Regenerate.
	* localedata/locales/i18n_ctype: likewise.
	* localedata/locales/tr_TR: likewise.
	* localedata/locales/translit_circle: likewise.
	* localedata/locales/translit_cjk_compat: likewise.
	* localedata/locales/translit_combining: likewise.
	* localedata/locales/translit_compat: likewise.
	* localedata/locales/translit_font: likewise.
	* localedata/locales/translit_fraction: likewise.
2018-07-04 12:03:33 +02:00
Florian Weimer 5a35750665 stdio-common/tst-printf.c: Remove part under a non-free license [BZ #23363]
The license does not allow modification.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-03 18:29:16 +02:00
Adhemerval Zanella 7279af007c Fix hurd expected fcntl version
Different than Linux, hurd does not need the OFD locks fix from
06ab719d30 (since OFD locks are current Linux specific). This in
turn allows hurd to not provide a fcntl compat symbol.

Checked on a i686-gnu with check-abi.

	* sysdeps/mach/hurd/i386/libc.abilist [GLIBC_2.28] (fcntl): Remove
	symbol.
2018-07-03 10:02:06 -03:00
Gabriel F. T. Gomes b7b88cea41 ldbl-128ibm-compat: Add printf_size
Since the addition of the _Float128 API, strfromf128 and printf_size use
__printf_fp to print _Float128 values.  This is achieved by setting the
'is_binary128' member of the 'printf_info' structure to one.  Now that
the format of long double on powerpc64le is getting a third option, this
mechanism is reused for long double values that have binary128 format
(i.e.: when -mabi=ieeelongdouble).

This patch adds __printf_sizeieee128 as an exported symbol, but doesn't
provide redirections from printf_size, yet.  All redirections will be
installed in a future commit, once all other functions that print or
read long double values with binary128 format are ready.  In
__printf_fp, when 'is_binary128' is one, the floating-point argument is
treated as if it was of _Float128 type, regardless of the value of
'is_long_double', thus __printf_sizeieee128 sets 'is_binary128' to the
same value of 'is_long_double'.  Otherwise, double values would not be
printed correctly.

Tested for powerpc64le.
2018-07-02 10:51:01 -03:00
Szabolcs Nagy 2b445206a1 Use uint32_t sign in single precision math error handling functions
Ideally sign should be bool, but sometimes (e.g. in powf) it's more
efficient to pass a non-zero value than 1 to indicate that the sign
should be set.  The fixed size int is less ambigous than unsigned
long.

	* sysdeps/ieee754/flt-32/e_powf.c (__powf): Use uint32_t.
	(exp2f_inline): Likewise.
	* sysdeps/ieee754/flt-32/math_config.h (__math_oflowf): Likewise.
	(__math_uflowf): Likewise.
	(__math_may_uflowf): Likewise.
	(__math_divzerof): Likewise.
	(__math_invalidf): Likewise.
	* sysdeps/ieee754/flt-32/math_errf.c (xflowf): Likewise.
	(__math_oflowf): Likewise.
	(__math_uflowf): Likewise.
	(__math_may_uflowf): Likewise.
	(__math_divzerof): Likewise.
	(__math_invalidf): Likewise.
2018-07-02 09:29:04 +01:00
Carlos O'Donell 2827ab990a libc: Extend __libc_freeres framework (Bug 23329).
The __libc_freeres framework does not extend to non-libc.so objects.
This causes problems in general for valgrind and mtrace detecting
unfreed objects in both libdl.so and libpthread.so.  This change is
a pre-requisite to properly moving the malloc hooks out of malloc
since such a move now requires precise accounting of all allocated
data before destructors are run.

This commit adds a proper hook in libc.so.6 for both libdl.so and
for libpthread.so, this ensures that shm-directory.c which uses
freeit () to free memory is called properly.  We also remove the
nptl_freeres hook and fall back to using weak-ref-and-check idiom
for a loaded libpthread.so, thus making this process similar for
all DSOs.

Lastly we follow best practice and use explicit free calls for
both libdl.so and libpthread.so instead of the generic hook process
which has undefined order.

Tested on x86_64 with no regressions.

Signed-off-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2018-06-29 22:39:06 -04:00
Rajalakshmi Srinivasaraghavan 37d3d244e1 Add long double input for strfmon test
This patch adds long double type inputs in strfmon_l test
which will help in long double migration.

Tested for powerpc64le.
2018-06-30 06:54:34 +05:30
Michael Wolf a1e0c5fa88 New locale: Lower Sorbian (dsb_DE) [BZ #23208]
[BZ #23208]
	* localedata/SUPPORTED (dsb_DE/UTF-8): New entry.
	* localedata/locales/dsb_DE: New file.
2018-06-29 23:03:06 +02:00
Rafal Luzynski 2e0c5de622 hy_AM: Add alternative month names (bug 23140).
This locale already contained correct data in mon array.  Updated from
CLDR to start the month names with the lowercase letters.

alt_mon is a new import from CLDR.  The change has been consulted
off-list with a native speaker.

	[BZ #23140]
	* localedata/locales/hy_AM (mon): Synchronize with CLDR (lowercase,
	genitive case).
	(alt_mon): New entry, import from CLDR (nominative case).
2018-06-29 22:18:24 +02:00
Sylvain Lesage cdb52c7182 es_BO locale: Change LC_PAPER to en_US (bug 22996).
[BZ #22996]
	* localedata/locales/es_BO (LC_PAPER): Change to “copy "en_US"”.
2018-06-29 21:45:16 +02:00
Siddhesh Poyarekar 0aec4c1d18 aarch64,falkor: Use vector registers for memcpy
Vector registers perform better than scalar register pairs for copying
data so prefer them instead.  This results in a time reduction of over
50% (i.e. 2x speed improvemnet) for some smaller sizes for memcpy-walk.
Larger sizes show improvements of around 1% to 2%.  memcpy-random shows
a very small improvement, in the range of 1-2%.

	* sysdeps/aarch64/multiarch/memcpy_falkor.S (__memcpy_falkor):
	Use vector registers.
2018-06-29 22:45:59 +05:30
Siddhesh Poyarekar ce76a5cb8d aarch64,falkor: Use vector registers for memmove
Vector registers perform much better for moves compared to pairs of
registers on falkor, so use them instead.  This results in a time
reduction of up to 50% (i.e. 2x improvement) for a lot of the smaller
sizes, i.e. up to 1K in memmove-walk.  Improvements for larger sizes are
smaller, at about 1%-2%.

	* sysdeps/aarch64/multiarch/memmove_falkor.S
	(__memcpy_falkor): Use vector registers.
2018-06-29 22:45:07 +05:30
Martin Sebor 7e8989d03b Document interaction with GCC built-ins in the Customizing Printf
section of the manual.
2018-06-29 10:45:19 -06:00
Maciej W. Rozycki bac15a72fc elf: Accept absolute (SHN_ABS) symbols whose value is zero [BZ #23307]
We have this condition in `check_match' (in elf/dl-lookup.c):

  if (__glibc_unlikely ((sym->st_value == 0 /* No value.  */
                         && stt != STT_TLS)
                        || ELF_MACHINE_SYM_NO_MATCH (sym)
                        || (type_class & (sym->st_shndx == SHN_UNDEF))))
    return NULL;

which causes all !STT_TLS symbols whose value is zero to be silently
ignored in lookup.  This may make sense for regular symbols, however not
for absolute (SHN_ABS) ones, where zero is like any value, there's no
special meaning attached to it.

Consequently legitimate programs fail, for example taking the
`elf/tst-absolute-sym' test case, substituting 0 for 0x55aa in
`elf/tst-absolute-sym-lib.lds' and then trying to run the resulting
program we get this:

$ .../elf/tst-absolute-sym
.../elf/tst-absolute-sym: symbol lookup error: .../elf/tst-absolute-sym-lib.so: undefined symbol: absolute
$

even though the symbol clearly is there:

$ readelf --dyn-syms .../elf/tst-absolute-sym-lib.so | grep '\babsolute\b'
     7: 00000000     0 NOTYPE  GLOBAL DEFAULT  ABS absolute
$

The check for the zero value has been there since forever or commit
d66e34cd4234/08162fa88891 ("Implemented runtime dynamic linker to
support ELF shared libraries.") dating back to May 2nd 1995, and the
problem triggers regardless of commit e7feec374c ("elf: Correct
absolute (SHN_ABS) symbol run-time calculation [BZ #19818]") being
present or not.

Fix the issue then, by permitting `sym->st_value' to be 0 for SHN_ABS
symbols in lookup.

	[BZ #23307]
	* elf/dl-lookup.c (check_match): Do not reject a symbol whose
	`st_value' is 0 if `st_shndx' is SHN_ABS.
	* elf/tst-absolute-zero.c: New file.
	* elf/tst-absolute-zero-lib.c: New file.
	* elf/tst-absolute-zero-lib.lds: New file.
	* elf/Makefile (tests): Add `tst-absolute-zero'.
	(modules-names): Add `tst-absolute-zero-lib'.
	(LDLIBS-tst-absolute-zero-lib.so): New variable.
	($(objpfx)tst-absolute-zero-lib.so): New dependency.
	($(objpfx)tst-absolute-zero: New dependency.
2018-06-29 17:10:43 +01:00
Zack Weinberg e69d994a63 New configure option --disable-crypt.
Some Linux distributions are experimenting with a new, separately
maintained and hopefully more agile implementation of the crypt
API.  To facilitate this, add a configure option which disables
glibc's embedded libcrypt.  When this option is given, libcrypt.*
and crypt.h will not be built nor installed.
2018-06-29 16:53:47 +02:00
Zack Weinberg 841785bad1 manual: Revise crypt.texi.
This is a major rewrite of the description of 'crypt', 'getentropy',
and 'getrandom'.

A few highlights of the content changes:

 - Throughout the manual, public headers, and user-visible messages,
   I replaced the term "password" with "passphrase", the term
   "password database" with "user database", and the term
   "encrypt(ion)" with "(one-way) hashing" whenever it was applied to
   passphrases.  I didn't bother making this change in internal code
   or tests.  The use of the term "password" in ruserpass.c survives,
   because that refers to a keyword in netrc files, but it is adjusted
   to make this clearer.

   There is a note in crypt.texi explaining that they were
   traditionally called passwords but single words are not good enough
   anymore, and a note in users.texi explaining that actual passphrase
   hashes are found in a "shadow" database nowadays.

 - There is a new short introduction to the "Cryptographic Functions"
   section, explaining how we do not intend to be a general-purpose
   cryptography library, and cautioning that there _are_, or have
   been, legal restrictions on the use of cryptography in many
   countries, without getting into any kind of detail that we can't
   promise to keep up to date.

 - I added more detail about what a "one-way function" is, and why
   they are used to obscure passphrases for storage.  I removed the
   paragraph saying that systems not connected to a network need no
   user authentication, because that's a pretty rare situation
   nowadays.  (It still says "sometimes it is necessary" to
   authenticate the user, though.)

 - I added documentation for all of the hash functions that glibc
   actually supports, but not for the additional hash functions
   supported by libxcrypt.  If we're going to keep this manual section
   around after the transition is more advanced, it would probably
   make sense to add them then.

 - There is much more detailed discussion of how to generate a salt,
   and the failure behavior for crypt is documented.  (Returning an
   invalid hash on failure is what libxcrypt does; Solar Designer's
   notes say that this was done "for compatibility with old programs
   that assume crypt can never fail".)

 - As far as I can tell, the header 'crypt.h' is entirely a GNU
   invention, and never existed on any other Unix lineage.  The
   function 'crypt', however, was in Issue 1 of the SVID and is now
   in the XSI component of POSIX.  I tried to make all of the
   @standards annotations consistent with this, but I'm not sure I got
   them perfectly right.

 - The genpass.c example has been improved to use getentropy instead
   of the current time to generate the salt, and to use a SHA-256 hash
   instead of MD5. It uses more random bytes than is strictly
   necessary because I didn't want to complicate the code with proper
   base64 encoding.

 - The testpass.c example has three hardwired hashes now, to
   demonstrate that different one-way functions produce different
   hashes for the same input.  It also demonstrates how DES hashing
   only pays attention to the first eight characters of the input.

 - There is new text explaining in more detail how a CSPRNG differs
   from a regular random number generator, and how
   getentropy/getrandom are not exactly a CSPRNG.  I tried not to make
   specific falsifiable claims here.  I also tried to make the
   blocking/cancellation/error behavior of both getentropy and
   getrandom clearer.
2018-06-29 16:53:37 +02:00
Zack Weinberg 6ab902e4de manual: Reorganize crypt.texi.
In preparation for a major revision of the documentation for
crypt(_r), getentropy, and getrandom, reorganize crypt.texi.  This
patch does not change any text; it only deletes and moves text.

The description of 'getpass' moves to terminal.texi, since all it does
is read a password from the controlling terminal with echo disabled.
The "Legal Problems" section of crypt.texi is dropped, and the
introductory text is shifted down to the "Encrypting Passwords"
section; the next patch will add some new introductory text.

Also, it is no longer true that crypt.texi's top @node needs to have
no pointers.  That was a vestige of crypt/ being an add-on.  (makeinfo
itself doesn't need @node pointers anymore, but the scripts that
assemble the libc manual's topmost node rely on each chapter-level
node having them.)
2018-06-29 16:53:29 +02:00
Zack Weinberg b10a0accee Disallow use of DES encryption functions in new programs.
The functions encrypt, setkey, encrypt_r, setkey_r, cbc_crypt,
ecb_crypt, and des_setparity should not be used in new programs,
because they use the DES block cipher, which is unacceptably weak by
modern standards.  Demote all of them to compatibility symbols, and
remove their prototypes from installed headers.  cbc_crypt, ecb_crypt,
and des_setparity were already compat symbols when glibc was
configured with --disable-obsolete-rpc.

POSIX requires encrypt and setkey to be available when _XOPEN_CRYPT
is defined, so this change also removes the definition of X_OPEN_CRYPT
from <unistd.h>.

The entire "DES Encryption" section is dropped from the manual, as is
the mention of AUTH_DES and FIPS 140-2 in the introduction to
crypt.texi.  The documentation of 'memfrob' cross-referenced the DES
Encryption section, which is replaced by a hyperlink to libgcrypt, and
while I was in there I spruced up the actual documentation of
'memfrob' and 'strfry' a little.  It's still fairly jokey, because
those functions _are_ jokes, but they do also have real use cases, so
people trying to use them for real should have all the information
they need.

DES-based authentication for Sun RPC is also insecure and should be
deprecated or even removed, but maybe that can be left as TI-RPC's
problem.
2018-06-29 16:53:18 +02:00
Florian Weimer 524d796d5f malloc: Update heap dumping/undumping comments [BZ #23351]
Also remove a few now-unused declarations and definitions.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-29 14:55:15 +02:00
Rafal Luzynski 339124ab42 ast_ES: Add alternative month names (bug 23140).
[BZ #23140]
	* localedata/locales/ast_ES (mon): Rename to...
	(alt_mon): This.
	(mon): Import from CLDR (genitive case).
2018-06-29 12:36:53 +02:00
Daniel Alvarez c1f86a33ca getifaddrs: Don't return ifa entries with NULL names [BZ #21812]
A lookup operation in map_newlink could turn into an insert because of
holes in the interface part of the map.  This leads to incorrectly set
the name of the interface to NULL when the interface is not present
for the address being processed (most likely because the interface was
added between the RTM_GETLINK and RTM_GETADDR calls to the kernel).
When such changes are detected by the kernel, it'll mark the dump as
"inconsistent" by setting NLM_F_DUMP_INTR flag on the next netlink
message.

This patch checks this condition and retries the whole operation.
Hopes are that next time the interface corresponding to the address
entry is present in the list and correct name is returned.
2018-06-29 09:44:55 +02:00
Szabolcs Nagy 0b11b6491c Fix documentation build with old makeinfo
With old makeinfo '@code {' fails because of the extra space.

	* manual/llio.texi: Remove spurious space.
2018-06-28 13:36:06 +01:00
Florian Weimer c1c2848b57 Use _STRUCT_TIMESPEC as guard in <bits/types/struct_timespec.h> [BZ #23349]
After commit d76d370355 ("Fix missing
timespec definition for sys/stat.h (BZ #21371)") in combination with
kernel UAPI changes, GCC sanitizer builds start to fail due to a
conflicting definition of struct timespec in <linux/time.h>.  Use
_STRUCT_TIMESPEC as the header file inclusion guard, which is already
checked in the kernel header, to support including <linux/time.h> and
<sys/stat.h> in the same translation unit.
2018-06-28 13:12:16 +02:00
Rajalakshmi Srinivasaraghavan 86a0f56158 ldbl-128ibm-compat: Introduce ieee128 symbols
This patch adds __*ieee128 symbols for strfrom, strtold, strtold_l, wcstold
and wcstold_l functions.  Redirection from *l to *ieee128 will be handled
in separate patch once we start building these new files.

2018-06-28  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>

	* sysdeps/ieee754/ldbl-128ibm-compat/Versions: Add __strfromieee128,
	 __strtoieee128, __strtoieee128_l,__wcstoieee128 and __wcstoieee128_l.
	* sysdeps/ieee754/ldbl-128ibm-compat/strfromf128.c: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/strtof128.c: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/strtof128_l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/wcstof128.c: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/wcstof128_l.c: New file.
2018-06-28 13:57:50 +05:30
Maciej W. Rozycki 780684eb04 nisplus: Correct pwent parsing issue and resulting build error [BZ #23266]
Copy and null-terminate NIS+ password file UID and GID entries whose
length is non-zero and are not terminated, in addition to empty ones,
fixing a bug and a compilation issue causing an error with GCC 8:

nss_nisplus/nisplus-parser.c: In function '_nss_nisplus_parse_pwent':
nss_nisplus/nisplus-parser.c:90:7: error: 'strncpy' destination unchanged after copying no bytes [-Werror=stringop-truncation]
       strncpy (first_unused, numstr, len);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nss_nisplus/nisplus-parser.c:106:7: error: 'strncpy' destination unchanged after copying no bytes [-Werror=stringop-truncation]
       strncpy (first_unused, numstr, len);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

introduced with commit ac05397075f6:

commit ac05397075
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sun Apr 30 07:01:26 2006 +0000

	* nis/nss_nisplus/nisplus-parser.c: Minor optimizations and
	cleanups.  Avoid copying data if it can be used in the old place.

(no mailing list reference available).  Obviously regardless of the
recently added compiler diagnostics causing a build error this code has
been long non-functional, so I guess NIS+ servers have been supplying
strings that are non-empty and have already been null-terminated.
Which in turn made it unnecessary to make a null-terminated copy,
masking this bug.

	[BZ #23266]
	* nis/nss_nisplus/nisplus-parser.c (_nss_nisplus_parse_pwent):
	Copy and null-terminate entries that are not terminated, in
	addition to empty ones.
2018-06-27 21:12:16 +01:00
Florian Weimer c49e18222e Remove macros extend_alloca, extend_alloca_account [BZ #18023]
The unused macro definition in posix/glob.c comes from gnulib and will
have to be removed there.
2018-06-27 19:20:37 +02:00
Joseph Myers a833e627c3 Remove nptl/sockperf.c.
This patch removes nptl/sockperf.c, an unused, x86-specific program
with a hardcoded path in /tmp.  If someone finds some of this code in
future for adding a proper benchmark, that does not of course rule out
adding it back in that form, but for now I think it's best to
eliminate this code with the hardcoded /tmp path.

Tested for x86_64.

	* nptl/sockperf.c: Remove file.
2018-06-27 17:01:06 +00:00
Florian Weimer 92d6aa8528 _dl_map_object_deps: Use struct scratch_buffer [BZ #18023]
The function comment suggests that _dl_map_object_deps cannot use
malloc, but it already allocates the l_initfini array on the heap, so
the additional allocation should be acceptable.
2018-06-27 17:55:56 +02:00
Florian Weimer 890c2ced35 gethostid (Linux variant): Switch to struct scratch_buffer [BZ #18023]
Previously, extend_alloca was used without alloca accounting,
which could have been problematic with large NSS results.
2018-06-27 17:55:38 +02:00
Florian Weimer 4272059de2 wordexp: Rewrite parse_tilde to use struct scratch_buffer [BZ #18023] 2018-06-27 17:54:44 +02:00
Joseph Myers 27f10a0963 Fix hardcoded /tmp paths in testing (bug 13888).
As noted in bug 13888, and as I noted previously in
<https://sourceware.org/ml/libc-alpha/2000-10/msg00111.html>, various
tests used hardcoded paths in /tmp, so posing issues for simultaneous
test runs from different build directories.

This patch fixes such uses of hardcoded file names to put them in the
build directory instead (in the case of stdio-common/bug5 the file
names are changed as well, to avoid a conflict with the name bug5.out
also used for the automatic test output redirection).  It also fixes
test-installation.pl likewise (that was using filenames with $$ in
them rather than strictly hardcoded names, but that's still not good
practice for temporary file naming).

Note that my list of files changed is not identical to that in bug
13888.  I added tst-spawn3.c and test-installation.pl, and removed
some tests that seem to me (now) to create temporary files securely
(simply using /tmp is not itself a problem if the temporary files are
handled properly with mkstemp; I haven't checked whether those tests
used to do things insecurely).  conformtest is not changed because the
makefiles always pass a --tmpdir option so the /tmp default is
irrelevant, and for the same reason there is no actual problem with
nptl/tst-umask1.c because again the makefiles always override the
default.

nptl/sockperf.c is ignored because there is no code to run it;
probably that file should actually be removed.

Some tests use the mktemp function, but I think they all use it in a
way that *is* secure (for generating names for directories / sockets /
fifos / symlinks, where the operation using the name will not follow
symlinks and so there is no potential for a symlink attack on the
account running the testsuite).

Some tests use the tmpnam function to generate temporary file names.
This is in principle insecure, but not addressed by this patch (I
consider it a separate issue from the fully hardcoded paths).

Tested for x86_64.

	[BZ #13888]
	* posix/Makefile (CFLAGS-tst-spawn3.c): New variable.
	* posix/tst-spawn3.c (do_test): Put tst-spwan3.pid in OBJPFX, not
	/tmp.
	* scripts/test-installation.pl: Put temporary files in build
	directory, not /tmp.
	* stdio-common/Makefile (CFLAGS-bug3.c): New variable.
	(CFLAGS-bug4.c): Likewise.
	(CFLAGS-bug5.c): Likewise.
	(CFLAGS-test-fseek.c): Likewise.
	(CFLAGS-test-popen.c): Likewise.
	(CFLAGS-test_rdwr.c): Likewise.
	* stdio-common/bug3.c (main): Put temporary file in OBJPFX, not
	/tmp.
	* stdio-common/bug4.c (main): Likewise.
	* stdio-common/bug5.c (main): Likewise.
	* stdio-common/test-fseek.c (TESTFILE): Likewise.
	* stdio-common/test-popen.c (do_test): Likewise.
	* stdio-common/test_rdwr.c (main): Likewise.
2018-06-26 21:48:48 +00:00
Patsy Franklin 05598a0907 In sem_open.c, pad was not initialized when __HAVE_64B_ATOMICS was
true.  On some arches this caused valgrind to warn about uninitialized
bytes when the struct was written to the file system.

This patch moves the initialization of pad outside of the
conditional.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-26 14:26:01 -04:00
Adhemerval Zanella 06ab719d30 Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)
This patch fixes the OFD ("file private") locks for architectures that
support non-LFS flock definition (__USE_FILE_OFFSET64 not defined). The
issue in this case is both F_OFD_{GETLK,SETLK,SETLKW} and
F_{SET,GET}L{W}K64 expects a flock64 argument and when using old
F_OFD_* flags with a non LFS flock argument the kernel might interpret
the underlying data wrongly.  Kernel idea originally was to avoid using
such flags in non-LFS syscall, but since GLIBC uses fcntl with LFS
semantic as default it is possible to provide the functionality and
avoid the bogus struct kernel passing by adjusting the struct manually
for the required flags.

The idea follows other LFS interfaces that provide two symbols:

  1. A new LFS fcntl64 is added on default ABI with the usual macros to
     select it for FILE_OFFSET_BITS=64.

  2. The Linux non-LFS fcntl use a stack allocated struct flock64 for
     F_OFD_{GETLK,SETLK,SETLKW} copy the results on the user provided
     struct.

  3. Keep a compat symbol with old broken semantic for architectures
     that do not define __OFF_T_MATCHES_OFF64_T.

So for architectures which defines __USE_FILE_OFFSET64, fcntl64 will
aliased to fcntl and no adjustment would be required.  So to actually
use F_OFD_* with LFS support the source must be built with LFS support
(_FILE_OFFSET_BITS=64).

Also F_OFD_SETLKW command is handled a cancellation point, as for
F_SETLKW{64}.

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

	[BZ #20251]
	* NEWS: Mention fcntl64 addition.
	* csu/check_fds.c: Replace __fcntl_nocancel by __fcntl64_nocancel.
	* login/utmp_file.c: Likewise.
	* sysdeps/posix/fdopendir.c: Likewise.
	* sysdeps/posix/opendir.c: Likewise.
	* sysdeps/unix/pt-fcntl.c: Likewise.
	* include/fcntl.h (__libc_fcntl64, __fcntl64,
	__fcntl64_nocancel_adjusted): New prototype.
	(__fcntl_nocancel_adjusted): Remove prototype.
	* io/Makefile (routines): Add fcntl64.
	(CFLAGS-fcntl64.c): New rule.
	* io/Versions [GLIBC_2.28] (fcntl64): New symbol.
	[GLIBC_PRIVATE] (__libc_fcntl): Rename to __libc_fcntl64.
	* io/fcntl.h (fcntl64): Add prototype and redirect if
	__USE_FILE_OFFSET64 is defined.
	* io/fcntl64.c: New file.
	* manual/llio.text: Add a note for which commands fcntl acts a
	cancellation point.
	* nptl/Makefile (CFLAGS-fcntl64.c): New rule.
	* sysdeps/mach/hurd/fcntl.c: Alias fcntl to fcntl64 symbols.
	* sysdeps/mach/hurd/i386/libc.abilist [GLIBC_2.28] (fcntl, fcntl64):
	New symbols.
	* sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Fix F_GETLK64,
	F_OFD_GETLK, F_SETLK64, F_SETLKW64, F_OFD_SETLK, and F_OFD_SETLKW for
	non-LFS case.
	* sysdeps/unix/sysv/linux/fcntl64.c: New file.
	* sysdeps/unix/sysv/linux/fcntl_nocancel.c (__fcntl_nocancel): Rename
	to __fcntl64_nocancel.
	(__fcntl_nocancel_adjusted): Rename to __fcntl64_nocancel_adjusted.
	* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Rename
	to __fcntl64_nocancel.
	* sysdeps/unix/sysv/linux/tst-ofdlocks.c: New file.
	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Likewise.
	* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-ofdlocks.
	(tests-internal): Add tst-ofdlocks-compat.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.28]
	(fcntl64): New symbol.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist [GLIBC_2.28] (fcntl,
	fcntl64): Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilis: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
2018-06-26 13:22:53 -03:00
Florian Weimer 124e025864 Run thread shutdown functions in an explicit order
This removes the __libc_thread_subfreeres hook in favor of explict
calls.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-26 15:27:12 +02:00
Florian Weimer 935d920e76 sunrpc: Remove always-defined _RPC_THREAD_SAFE_ macro
Header and C source file changes were generated using:

unifdef -m -D_RPC_THREAD_SAFE_ include/rpc/rpc.h sunrpc/*.c
2018-06-26 15:27:03 +02:00
Florian Weimer 29055464a0 libio: Add tst-vtables, tst-vtables-interposed 2018-06-26 12:31:08 +02:00
Florian Weimer 5c0202af4b support: Add TEST_NO_SETVBUF
This is sometimes needed for testing stdio streams, where the
setvbuf call in the test driver could interfere with the test.
2018-06-26 12:30:50 +02:00
Florian Weimer c402355dfa libio: Disable vtable validation in case of interposition [BZ #23313] 2018-06-26 10:24:52 +02:00
Florian Weimer 43b1048ab9 nss_files: Use struct scratch_buffer instead of extend_alloca [BZ #18023] 2018-06-25 19:48:01 +02:00
Florian Weimer 1599ed4e95 getent: Use dynarray in initgroups_keys [BZ #18023] 2018-06-25 19:47:59 +02:00
Florian Weimer a26fe1638b _nss_nis_initgroups_dyn: Use struct scratch_buffer [BZ #18023]
Remove extend_alloca usage.  Also adjusts the internal function get_uid.
2018-06-25 19:14:09 +02:00
Florian Weimer 90d9d9ce2f getgrent_next_nss (compat-initgroups): Remove alloca fallback [BZ #18023]
If the caller-supplied buffer is not large enough, fall back directly
malloc.

The previous __libc_use_alloca check was incorrect because it did not
take into account that extend_alloca may fail to merge allocations, so
it would underestimate the stack space being used by roughly a factor
of two.
2018-06-25 18:58:49 +02:00
Florian Weimer 6b7b2abac7 nscd: Switch to struct scratch_buffer in adhstaiX [BZ #18023]
The pre-allocation of the three scratch buffers increased the initial
stack size somewhat, but if retries are needed, the previous version
used more stack space if extend_alloca could not merge allocations.
Lack of alloca accounting also means could be problematic with
extremely large NSS responses, too.

	[BZ #18023]
	* nscd/aicache.c (addhstaiX): Use struct scratch_buffer instead
	of extend_alloca.
2018-06-25 18:41:54 +02:00
Florian Weimer 2f9f0d182e nscd: Use struct scratch_buffer, not extend_alloca in most caches [BZ #18023]
This replaces the ERANGE retry loops with loops which have heap
fallback.  Heap allocation might actually be required for extremely
large NSS results.
2018-06-25 18:41:52 +02:00
Florian Weimer 318bad78b0 nscd restart: Use malloc instead of extend_alloca [BZ #18023]
This introduces a separate function, read_cmdline, which reads the
contents of /proc/self/cmdline into a heap-allocated buffer.
2018-06-25 17:10:15 +02:00
Rafal Luzynski 189699ab37 csb_PL: Add alternative month names (bug 23140).
Kashubian language is not supported by CLDR, data copied from Wikipedia
and documents released by RJK (official Kashubian Language Council),
also consulted with a native speaker.

Note that this language also needs ab_alt_mon feature due to the month
May: nominative "môj", genitive "maja"; abbreviated nominative "môj",
abbreviated genitive "maj".

	[BZ #23140]
	* localedata/locales/csb_PL (mon): Rename to...
	(alt_mon): This.
	(abmon): Rename to...
	(ab_alt_mon): This.
	(mon): Add with proper genitive forms, copy from Wikipedia.
	(abmon): Likewise.
2018-06-25 12:34:31 +02:00
Rafal Luzynski 0ea3f13cce csb_PL: Update month translations + add yesstr/nostr (bug 19485).
Thank you Michal Ostrowski for the feedback.

	[BZ #19485]
	* localedata/locales/csb_PL (mon): Fix typos:
	"łżëkwiôt" -> "łżëkwiat" (April); "lëpinc" -> "lëpińc" (July).
	(yesstr): Add, value is "jo".
	(nostr): Add, value is "nié".
2018-06-25 12:32:51 +02:00
Tulio Magno Quites Machado Filho d93f4ff16b m68k: Reorganize log1p and significand implementations
Commit 5e79e0292b broke m68k after
s_significand.c became available in the build directory.  All m68k
implementations of log1p and significand were including s_significand.c
and stopped working after the inclusion of the the auto-generated file.

This patch reorganizes the implementation of log1p and significand for
m680x0 in order to avoid hitting this problem.

	* sysdeps/m68k/m680x0/fpu/s_log1p.c: Set as the generic file for
	all log1p and significand functions on m680x0.
	* sysdeps/m68k/m680x0/fpu/s_log1pf.c: Include s_log1p.c instead
	of s_significand.c..
	* sysdeps/m68k/m680x0/fpu/s_log1pl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_significandf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_significandl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_significand.c: Move all the code to
	s_log1p.c and include it..

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-06-22 21:34:28 -03:00
Vincent Chen f6299d2a10 Add Andes nds32 dynamic relocations to elf.h
* elf/elf.h (R_NDS32_NONE): New define.
	(R_NDS32_32_RELA): Likewise.
	(R_NDS32_COPY): Likewise.
	(R_NDS32_GLOB_DAT): Likewise.
	(R_NDS32_JUMP_SLOT): Likewise.
	(R_NDS32_RELATIVE): Likewise.
	(R_NDS32_TLS_TPOFF): Likewise.
	(R_NDS32_TLS_DESC): Likewise.
2018-06-21 20:44:43 +00:00
Mark Wielaard 61ab61c2fd elf.h: Add BPF relocation types.
The BPF ELF format has new relocation types R_BPF_64_64 and R_BPF_64_32.
The existing R_BPF_MAP_FD was an extension that never got implemented.
Remove it, because the constant conflicts with the official R_BPF_64_64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-21 18:38:06 +02:00
Florian Weimer f496b28e61 math: Set 387 and SSE2 rounding mode for tgamma on i386 [BZ #23253]
Previously, only the SSE2 rounding mode was set, so the assembler
implementations using 387 were not following the expecting rounding
mode.
2018-06-21 08:04:29 +02:00
Joseph Myers 99c7adf99f Fix tst-cmp.c build with GCC mainline.
Building the testsuite with GCC mainline fails with
-Wstringop-overflow= errors in string/tst-cmp.c.  These are for calls
to strncmp and strncasecmp with SIZE_MAX size argument.  The tests are
deliberately using this size that would be dubious in normal code, so
this patch disables the warning for the calls in question.

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

	* string/tst-cmp.c: Include <libc-diag.h>.
	(strncmp_max): Disable -Wstringop-overflow= around call to
	strncmp.
	(strncasecmp_max): Disable -Wstringop-overflow= around call to
	strncasecmp.
2018-06-20 22:19:50 +00:00
Joseph Myers 1760daadda Fix bug-strspn1.c, bug-strpbrk1.c build with GCC mainline.
Building the testsuite with GCC mainline fails with:

bug-strspn1.c: In function 'main':
bug-strspn1.c:14:3: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
   strspn (b++, "");
   ^~~~~~~~~~~~~~~~

and a similar error for bug-strpbrk1.c.  I'm not sure what GCC change
introduced this, and the wording of the message is a bit off (in the
source it's not a comma expression, that must reflect GCC's IR).  But
the warning is correct (strspn is a pure function, the call is
useless, and if there wasn't an argument with a side effect much older
GCC would have warned); the point of the test is to verify that the
side effect in an argument still occurs for this useless call that can
otherwise be optimized to an (unused) constant (testing for a bug
there once was in an old strspn macro).  This patch duly arranges for
the warning to be disabled for this code.

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

	* string/bug-strpbrk1.c: Include <libc-diag.h>.
	(main): Disable -Wunused-value around call to strpbrk.
	* string/bug-strspn1.c: Include <libc-diag.h>.
	(main): Disable -Wunused-value around call to strspn.
2018-06-20 22:18:22 +00:00
Tulio Magno Quites Machado Filho 209ae17c60 ldbl-128ibm-compat: Create libm-alias-float128.h
Add a new libm-alias-float128.h in order to provide the __*ieee128
aliases for the existing *f128 that do not have a globally exported
symbol.

	* sysdeps/ieee754/ldbl-128ibm-compat/Versions: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h: New file.
2018-06-20 19:02:07 -03:00
Tulio Magno Quites Machado Filho 5e79e0292b Add a generic significand implementation
Create a template for significand.

	* math/Makefile (libm-calls): Move s_significandF to...
	(gen-libm-calls): ... here.
	* math/s_significand_template.c: New file.
	* math/s_significand.c: Removed.
	* math/s_significandf.c: Removed.
	* math/s_significandl.c: Removed.
	* sysdeps/ieee754/ldbl-opt/s_significand.c: Removed.
	* sysdeps/ieee754/ldbl-opt/s_significandl.c: Removed.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-06-20 18:15:06 -03:00
Tulio Magno Quites Machado Filho badba23cac Move declare_mgen_finite_alias definition
Move declare_mgen_finite_alias, declare_mgen_finite_alias_s and
declare_mgen_finite_alias_x to a shared place in order to reuse them in
other files that also declare _finite aliases.

	* math/e_exp2_template.c (declare_mgen_finite_alias,
	declare_mgen_finite_alias_s, declare_mgen_finite_alias_x): Move to...
	* sysdeps/generic/math-type-macros.h (declare_mgen_finite_alias,
	declare_mgen_finite_alias_s, declare_mgen_finite_alias_x): ... here.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-06-20 17:42:47 -03:00
Florian Weimer 2d1c89a5d7 libio: Avoid ptrdiff_t overflow in IO_validate_vtable
If the candidate pointer is sufficiently far away from
__start___libc_IO_vtables, the result might not fit into ptrdiff_t.
2018-06-20 09:45:19 +02:00
Joseph Myers 646c2833ee Fix scanf rounding of negative floating-point numbers (bug 23280).
As reported in bug 23280, scanf functions produce incorrectly rounded
result for floating-point formats in FE_UPWARD and FE_DOWNWARD modes,
because they pass the input with sign removed to strtod functions, and
then negate the result if there was a '-' at the start of the input.

This patch fixes this by arranging for the sign to be passed to strtod
rather than scanf doing the negation itself.  In turn, keeping the
sign around in the buffer being built up for strtod requires updating
places that examine char_buffer_size (&charbuf) to allow for the sign
being there as an extra character.

Tested for x86_64.

	[BZ #23280]
	* stdio-common/vfscanf.c (_IO_vfscanf_internal): Pass sign of
	floating-point number to strtod functions rather than possibly
	negating result of those functions.
	* stdio-common/tst-scanf-round.c: New file.
	* stdio-common/Makefile (tests): Add tst-scanf-round.
	($(objpfx)tst-scanf-round): Depend on $(libm).
2018-06-19 11:52:18 +00:00
Samuel Thibault c77e4dc0f5 hurd: Fix "Missing required PLT reference"
* sysdeps/mach/hurd/localplt.data: Move to...
	* sysdeps/mach/hurd/i386/localplt.data: new file. Add + REL
	R_386_GLOB_DAT like on Linux i386.
2018-06-19 02:32:41 +02:00
Joseph Myers f2857da7cd Add SHM_STAT_ANY from Linux 4.17 to bits/shm.h.
Linux 4.17 adds a SHM_STAT_ANY constant (ipcs command).  This patch
adds it to the relevant bits/shm.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/alpha/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): New macro.
	* sysdeps/unix/sysv/linux/arm/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
2018-06-18 13:37:57 +00:00
Joseph Myers 176c7fee51 Add SEM_STAT_ANY from Linux 4.17 to bits/sem.h.
Linux 4.17 adds a SEM_STAT_ANY constant (ipcs command).  This patch
adds it to the relevant bits/sem.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/alpha/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): New macro.
	* sysdeps/unix/sysv/linux/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
2018-06-18 13:36:41 +00:00
Joseph Myers 86bf0019ed Add MSG_STAT_ANY from Linux 4.17 to bits/msq.h.
Linux 4.17 adds a MSG_STAT_ANY constant (ipcs command).  This patch
adds it to the relevant bits/msq.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/alpha/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): New macro.
	* sysdeps/unix/sysv/linux/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
2018-06-18 13:34:52 +00:00
Joseph Myers 91b2f3e5dd Update MAP_TYPE value for hppa from Linux 4.17.
This patch updates the hppa definition of MAP_TYPE to reflect a
corresponding change in the Linux kernel in 4.17 (so the value now has
four bits set, as it does on other architectures, although they are
different from other architectures because of hppa differences in
other MAP_* bits).

Tested with build-many-glibcs.py for hppa.

	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC]
	(MAP_TYPE): Change value to 0x2b.
2018-06-18 13:33:52 +00:00
Florian Weimer 3fe8fc793f Linux: Create Netlink socket with SOCK_CLOEXEC in __check_pf [BZ #15722] 2018-06-18 15:24:55 +02:00
Joseph Myers 809dc95d14 Fix powerpc64le build of nan-sign tests (bug 23303).
My recent nan-sign tests fail to build for powerpc64le with GCC 8
because of the special compile / link options needed there for any
test using _Float128.  This patch arranges for these tests to be
handled on powerpc64le similarly to other such tests.

Tested with build-many-glibcs.py for powerpc64le.

	[BZ #23303]
	* sysdeps/powerpc/powerpc64/le/Makefile
	(CFLAGS-tst-strtod-nan-sign.c): Add -mfloat128.
	(CFLAGS-tst-wcstod-nan-sign.c): Likewise.
	(gnulib-tests): Also add $(f128-loader-link) for
	tst-strtod-nan-sign abd tst-wcstod-nan-sign.
2018-06-18 11:27:51 +00:00
Samuel Thibault 4d0ac0375b hurd: Fix reference to _hurd_self_sigstate
* sysdeps/hurd/include/hurd/signal.h (_hurd_self_sigstate): Add hidden
	prototype and definition.
	* sysdeps/mach/hurd/i386/____longjmp_chk.S (____longjmp_chk): Use
	hidden target for _hurd_self_sigstate.
2018-06-16 14:07:23 +00:00
Samuel Thibault f96a85e0fe hurd: Fix missing __pthread_get_cleanup_stack symbol
Rework 57e1651557 ("hurd: Avoid PLT ref for __pthread_get_cleanup_stack")
to keep the __pthread_get_cleanup_stack symbol.

        * htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to
        ___pthread_get_cleanup_stack.
        (__pthread_get_cleanup_stack): Remove hidden def, add alias.
        * htl/pt-exit.c (__pthread_exit): Use ___pthread_get_cleanup_stack
        instead of __pthread_get_cleanup_stack.
        * sysdeps/htl/pthread-functions.h [libpthread]
        (__pthread_get_cleanup_stack): Remove hidden proto.
        * sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Add
        prototype.
	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Add hidden
	attribute.
	* htl/pt-join.c (__pthread_get_cleanup_stack): Define to
	___pthread_get_cleanup_stack.
2018-06-16 10:52:04 +02:00
Samuel Thibault 8c9d53428e hurd: Whitelist PLT refs which are difficult to avoid
* sysdeps/mach/hurd/localplt.data (siglongjmp, longjmp,
	__libc_lseek64, _IO_funlockfile): Whitelist PLT references.
2018-06-16 02:59:36 +02:00
Samuel Thibault b0344cf5c5 hurd: Avoid PLT references to syscalls
* mach/Makefile ($(mach-syscalls:%=$(objpfx))): Add hidden definition.
	* sysdeps/mach/include/mach/mach_traps.h (__mach_reply_port,
	__mach_thread_self, __mach_task_self, __mach_host_self, __swtch,
	__swtch_pri, __thread_switch, __evc_wait): Add hidden prototypes.
2018-06-16 02:50:36 +02:00
Samuel Thibault 7a646a93fa hurd: Avoid PLT ref to __mach_msg
* sysdeps/mach/include/mach.h (__mach_msg): Add hidden prototype.
	* mach/msg.c: Include <mach.h>.
	(__mach_msg): Add hidden definition.
2018-06-16 02:50:30 +02:00
Samuel Thibault c1b7586c54 hurd: Avoid PLT references to shortcuts
* sysdeps/mach/include/mach-shortcuts-hidden.h: New file.
	* mach/shortcut.awk: Make syscall stubs include
	<mach-shortcuts-hidden.h> and add hidden definition.
	* sysdeps/mach/include/mach.h: Include <mach-shortcuts-hidden.h>.
2018-06-16 02:48:41 +02:00
Samuel Thibault 932d05f0dc hurd: Avoid missing PLT ref from ld.so requirement
* sysdeps/mach/hurd/localplt.data (ld.so): Make ref to __open optional.
2018-06-16 01:49:29 +02:00
Samuel Thibault 57e1651557 hurd: Avoid PLT ref for __pthread_get_cleanup_stack
* htl/pt-cleanup.c (___pthread_get_cleanup_stack): Rename to
	__pthread_get_cleanup_stack.
	(__pthread_get_cleanup_stack): Remove alias, add hidden def.
	* htl/pt-exit.c (__pthread_exit): Use __pthread_get_cleanup_stack
	instead of ___pthread_get_cleanup_stack.
	* sysdeps/htl/pthread-functions.h [libpthread]
	(__pthread_get_cleanup_stack): Add hidden proto.
	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Remove
	prototype.
2018-06-16 01:37:42 +02:00
Samuel Thibault faf7bbc2d0 hurd: Detect 32bit overflow in value returned by lseek
* sysdeps/mach/hurd/lseek.c: Include <errno.h>.
	* sysdeps/mach/hurd/lseek.c (__libc_lseek): Check that the value returned
	by __lseek64 can fit off_t, return EOVERFLOW otherwise.
2018-06-16 01:37:14 +02:00
Samuel Thibault 298a8b59d4 hurd: avoid PLT ref between sendfile and sendfile64
* include/sys/sendfile.h (__sendfile64): Declare hidden prototype.
	* sysdeps/mach/hurd/sendfile.c (sendfile): Call __sendfile64 instead
	of sendfile.
	* sysdeps/mach/hurd/sendfile64.c (sendfile64): Rename to __sendfile64.
	(sendfile64): New strong alias.
2018-06-16 00:44:57 +02:00
Joseph Myers b12c1e7991 Add tests for sign of NaN returned by strtod (bug 23007).
This patch adds tests for bug 23007, strtod ignoring any sign in the
input string in the case of a NaN result.

Tested for x86_64.

	[BZ #23007]
	* stdlib/tst-strtod-nan-sign-main.c: New file.
	* stdlib/tst-strtod-nan-sign.c: Likewise.
	* wcsmbs/tst-wcstod-nan-sign.c: Likewise.
	* stdlib/Makefile (tests): Add tst-strtod-nan-sign.
	($(objpfx)tst-strtod-nan-sign): Depend on $(libm).
	* wcsmbs/Makefile (tests) Add tst-wcstod-nan-sign.
	($(objpfx)tst-wcstod-nan-sign): Depend on $(libm).
2018-06-15 17:36:21 +00:00
Herman ten Brugge b0debe14fc Fix sign of NaN returned by strtod (bug 23007).
As reported in bug 23007, strtod ignores any sign in the input string
in the case of a NaN result.  Thes patch fixes this.

Tested for x86_64 (in conjunction with tests to be added separately).

	[BZ #23007]
	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Return NaN of
	appropriate sign.
2018-06-15 17:35:17 +00:00
Florian Weimer 14beef7575 localedata: Make IBM273 compatible with ISO-8859-1 [BZ #23290]
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-14 22:34:10 +02:00
Samuel Thibault c596630bbd hurd: Fix htl link failure
126b3ec370 ("hurd: Avoid PLTs for __mach_thread_self and
__mach_reply_port") made mach traps hidden, but htl actually uses two of
them. Re-expose them for now. Exposing them properly will be more involved
since their definition is generated.

	* sysdeps/mach/include/mach/mach_traps.h (__mach_thread_self,
	__mach_task_self): Remove attribute_hidden.
2018-06-14 17:09:18 +02:00
Joseph Myers 35ebb6b0c4 Ignore -Wrestrict for one strncat test.
With current GCC mainline, one strncat test involving a size close to
SIZE_MAX results in a -Wrestrict warning that that buffer size would
imply that the two buffers must overlap.  This patch fixes the build
by adding disabling of -Wrestrict (for GCC versions supporting that
option) to the already-present disabling of -Wstringop-overflow= and
-Warray-bounds for this test.

Tested with build-many-glibcs.py that this restores the testsuite
build with GCC mainline for aarch64-linux-gnu.

	* string/tester.c (test_strncat) [__GNUC_PREREQ (7, 0)]: Also
	ignore -Wrestrict for one test.
2018-06-14 14:20:00 +00:00
Steve Ellcey 3c7b9f1fc3 aarch64: Use an ifunc/VDSO to implement gettimeofday in shared glibc.
This patch uses an ifunc to implement gettimeofday in the shared libc.
This is faster compared to the vsyscall mechanism that has to check a
global pointer, demangle it and call it indirectly when the VDSO is
present. Resolving the gettimeofday symbol directly to the VDSO code
is safe because there are no failures that the libc has to handle by
setting errno like in a generic vsyscall (the only failure when the
VDSO code falls back to a syscall is EFAULT, but passing an invalid
pointer is undefined behaviour so returning -EFAULT is fine).

If the kernel supports the VDSO interface we use it for extern calls,
otherwise the old vsyscall method is used which falls back to a syscall.
The static version of gettimeofday continues to use a syscall, libc.so
internal calls use the old vsyscall method.

	* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: New file.
2018-06-14 13:56:57 +01:00
Florian Weimer c59ee916a6 scripts/update-abilist.sh: Accept empty list of files to patch
Commit b289cd9db8 (“Ignore absolute
symbols in ABI tests.”) broke “make update-all-abi” because an empty
list of files is now passed to scripts/update-abilist.sh.
2018-06-14 09:37:31 +02:00
Samuel Thibault 06d1a8263d hurd: Avoid a PLT reference
* sysdeps/mach/hurd/i386/____longjmp_chk.S (____longjmp_chk): Do not
	use PLT to call _hurd_self_sigstate.
2018-06-14 01:43:23 +02:00
Samuel Thibault 126b3ec370 hurd: Avoid PLTs for __mach_thread_self and __mach_reply_port
* mach/mach/mach_traps.h (__mach_reply_port, __mach_thread_self,
	__mach_task_self, __mach_host_self, __swtch, __swtch_pri,
	__thread_switch, __evc_wait): Move declarations to...
	* sysdeps/mach/include/mach/mach_traps.h: ... new file, and add
	attribute_hidden.
2018-06-14 01:01:57 +02:00
Samuel Thibault c8c6e6d6d0 hurd: Avoid PLTs for _hurd_port_locked_get/set
* sysdeps/hurd/include/hurd/port.h: New file.
2018-06-14 00:28:03 +02:00
Samuel Thibault c8c910ed9c hurd: update localplt.data
after 329ea513b4 ("Avoid cancellable I/O primitives in ld.so.")

	* sysdeps/mach/hurd/localplt.data (ld.so): Add __open64, rename
	__libc_read and __libc_write to __read and __write.
2018-06-14 00:22:20 +02:00
Samuel Thibault 43b5ff50b5 hurd: xfail missing abilist for libmachuser and libhurduser
They need more work to implement, see bug 23286.

	* sysdeps/mach/hurd/i386/Makefile (test-xfail-check-abi-libhurduser,
	test-xfail-check-abi-libmachuser): Add.
2018-06-13 21:12:23 +02:00
Joseph Myers fcd6b5ac36 Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).

For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE.  For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.

This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.

Tested for x86_64.  Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.

	[BZ #23279]
	* stdlib/strtod_l.c (round_and_return): Handle an exponent of
	MAX_EXP as overflowing.
	* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
	overflow flag.
	(round_str): Output also whether result overflows in each rounding
	mode.
	* stdlib/tst-strtod-round-data: Add more tests.
	* stdlib/tst-strtod-round-data.h: Regenerated.
	* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
	(TEST): Handle extra arguments for overflow flags.
	(struct test_overflow): New type.
	[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
	(GEN_ONE_TEST): Clear all exceptions.  Test overflow flag.
	(test_in_one_mode): Take argument with overflow information.
	(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
Carlos O'Donell a745c837cb Fix comments in _dl_dst_count and _dl_dst_substitute.
The comments in _dl_dst_count is adjusted to match what the code does
which is count DSTs from the start of the string. With the removal of
DL_DST_COUNT we no longer accept an input that starts at the first $.

In _dl_dst_substitute we adjust the comment to indicate that both
conditions must be true for the SUID/SGID $ORIGIN exception.
2018-06-12 23:35:06 -04:00
Carlos O'Donell 35df5a77f3 Fix fallback path in __pthread_mutex_timedlock ().
Fix the typo in the fallback path in __pthread_mutex_timedlock ()
whic hcalls lll_futex_timed_wait ().  This is only useful for cases
where the patch is being backported to older distributions where
only lll_futex_timed_wait () is available.
2018-06-12 16:17:05 -04:00
Joseph Myers 48b12ed54c Do not use const attribute for nan functions (bug 23277).
As in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86113 for
__builtin_nan, bits/mathcalls.h wrongly declares the nan function with
the __const__ attribute.  Because the function reads memory pointed to
by an argument, it's only pure, not const.  This patch removes the
incorrect attribute and adds a testcase for the bug.  No __pure__
attribute is added to replace the incorrect __const__ one, since that
would introduce problems when using GCC versions that have the
incorrect built-in __const__ attribute and warn for the combination of
those two attributes.

Tested for x86_64.

	[BZ #23277]
	* math/bits/mathcalls.h [__USE_ISOC99] (nan): Do not use __const__
	attribute.
	* math/test-nan-const.c: New file.
	* math/Makefile (tests): Add test-nan-const.
	(CFLAGS-test-nan-const.c): New variable.
2018-06-12 16:57:26 +00:00
H.J. Lu cb8f6affed benchtests: Add -f/--functions argument
On x86-64, there may be multiple IFUNC implementations for a given
function.  But we may be only interested in a subset of them.  This
patch adds -f/--functions argument to compare a subset of IFUNC
implementations.

	* benchtests/scripts/compare_strings.py (process_results): Add
	funcs argument.  Compare only functions which are selected.
	(main): Check if base function is among selected functions.
	Pass selected functions to process_results.
	(__main__): Add -f/--functions argument.
2018-06-12 09:10:42 -07:00
Hongbo Zhang fc2ba8037d aarch64: add HXT Phecda core memory operation ifuncs
Phecda is HXT semiconductor's CPU core, this patch adds memory operation
ifuncs for it: sharing the same optimized implementation with Qualcomm's
Falkor core.

2018-06-07  Minfeng Kang <minfeng.kang@hxt-semitech.com>
	    Hongbo Zhang <hongbo.zhang@linaro.org>

	* sysdeps/aarch64/multiarch/memcpy.c (libc_ifunc): reuse
	__memcpy_falkor for phecda core.
	* sysdeps/aarch64/multiarch/memmove.c (libc_ifunc): reuse
	__memmove_falkor for phecda core.
	* sysdeps/aarch64/multiarch/memset.c (libc_ifunc): reuse
	__memset_falkor for phecda core.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c: add MIDR entry
	for phecda core.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_PHECDA): add
	macro to identify phecda core.
2018-06-12 21:29:11 +05:30
Carlos O'Donell 5aad5f6178 Improve DST handling (Bug 23102, Bug 21942, Bug 18018, Bug 23259).
This commit improves DST handling significantly in the following
ways: firstly is_dst () is overhauled to correctly process DST
sequences that would be accepted given the ELF gABI.  This means that
we actually now accept slightly more sequences than before.  Now we
accept $ORIGIN$ORIGIN, but in the past we accepted only $ORIGIN\0 or
$ORIGIN/..., but this kind of behaviour results in unexpected
and uninterpreted DST sequences being used as literal search paths
leading to security defects.  Therefore the first step in correcting
this defect is making is_dst () properly account for all DSTs
and making the function context free in the sense that it counts
DSTs without knowledge of path, or AT_SECURE.  Next, _dl_dst_count ()
is also simplified to count all DSTs regardless of context.
Then in _dl_dst_substitute () we reintroduce context-dependent
processing for such things as AT_SECURE handling.  At the level of
_dl_dst_substitute we can have access to things like the true start
of the string sequence to validate $ORIGIN-based paths rooted in
trusted directories.  Lastly, we tighten up the accepted sequences
in AT_SECURE, and avoid leaving known unexpanded DSTs, this is
noted in the NEWS entry.

Verified with a sequence of 68 tests on x86_64 that cover
non-AT_SECURE and AT_SECURE testing using a sysroot (requires root
to run).  The tests cover cases for bug 23102, bug 21942, bug 18018,
and bug 23259.  These tests are not yet appropriate for the glibc
regression testsuite, but with the upcoming test-in-container testing
framework it should be possible to include these tests upstream soon.

See the mailing list for the tests:
https://www.sourceware.org/ml/libc-alpha/2018-06/msg00251.html
2018-06-12 11:07:56 -04:00
Zack Weinberg 329ea513b4 Avoid cancellable I/O primitives in ld.so.
Neither the <dlfcn.h> entry points, nor lazy symbol resolution, nor
initial shared library load-up, are cancellation points, so ld.so
should exclusively use I/O primitives that are not cancellable.  We
currently achieve this by having the cancellation hooks compile as
no-ops when IS_IN(rtld); this patch changes to using exclusively
_nocancel primitives in the source code instead, which makes the
intent clearer and significantly reduces the amount of code compiled
under IS_IN(rtld) as well as IS_IN(libc) -- in particular,
elf/Makefile no longer thinks we require a copy of unwind.c in
rtld-libc.a.  (The older mechanism is preserved as a backstop.)

The bulk of the change is splitting up the files that define the
_nocancel I/O functions, so they don't also define the variants that
*are* cancellation points; after which, the existing logic for picking
out the bits of libc that need to be recompiled as part of ld.so Just
Works.  I did this for all of the _nocancel functions, not just the
ones used by ld.so, for consistency.

fcntl was a little tricky because it's only a cancellation point for
certain opcodes (F_SETLKW(64), which can block), and the existing
__fcntl_nocancel wasn't applying the FCNTL_ADJUST_CMD hook, which
strikes me as asking for trouble, especially as the only nontrivial
definition of FCNTL_ADJUST_CMD (for powerpc64) changes F_*LK* opcodes.
To fix this, fcntl_common moves to fcntl_nocancel.c along with
__fcntl_nocancel, and changes its name to the extern (but hidden)
symbol __fcntl_nocancel_adjusted, so that regular fcntl can continue
calling it.  __fcntl_nocancel now applies FCNTL_ADJUST_CMD; so that
both both fcntl.c and fcntl_nocancel.c can see it, the only nontrivial
definition moves from sysdeps/u/s/l/powerpc/powerpc64/fcntl.c to
.../powerpc64/sysdep.h and becomes entirely a macro, instead of a macro
that calls an inline function.

The nptl version of libpthread also changes a little, because its
"compat-routines" formerly included files that defined all the
_nocancel functions it uses; instead of continuing to duplicate them,
I exported the relevant ones from libc.so as GLIBC_PRIVATE.  Since the
Linux fcntl.c calls a function defined by fcntl_nocancel.c, it can no
longer be used from libpthread.so; instead, introduce a custom
forwarder, pt-fcntl.c, and export __libc_fcntl from libc.so as
GLIBC_PRIVATE.  The nios2-linux ABI doesn't include a copy of vfork()
in libpthread, and it was handling that by manipulating
libpthread-routines in .../linux/nios2/Makefile; it is cleaner to do
what other such ports do, and have a pt-vfork.S that defines no symbols.

Right now, it appears that Hurd does not implement _nocancel I/O, so
sysdeps/generic/not-cancel.h will forward everything back to the
regular functions.  This changed the names of some of the functions
that sysdeps/mach/hurd/dl-sysdep.c needs to interpose.

	* elf/dl-load.c, elf/dl-misc.c, elf/dl-profile.c, elf/rtld.c
	* sysdeps/unix/sysv/linux/dl-sysdep.c
	Include not-cancel.h.  Use __close_nocancel instead of __close,
	__open64_nocancel instead of __open, __read_nocancel instead of
	__libc_read, and __write_nocancel instead of __libc_write.

	* csu/check_fds.c (check_one_fd)
	* sysdeps/posix/fdopendir.c (__fdopendir)
	* sysdeps/posix/opendir.c (__alloc_dir): Use __fcntl_nocancel
        instead of __fcntl and/or __libc_fcntl.

	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np)
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np)
        * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system):
	Use __open64_nocancel instead of __open_nocancel.

	* sysdeps/unix/sysv/linux/not-cancel.h: Move all of the
	hidden_proto declarations to the end and issue them if either
	IS_IN(libc) or IS_IN(rtld).
	* sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines):
	Add close_nocancel, fcntl_nocancel, nanosleep_nocancel,
	open_nocancel, open64_nocancel, openat_nocancel, pause_nocancel,
	read_nocancel, waitpid_nocancel, write_nocancel.

        * io/Versions [GLIBC_PRIVATE]: Add __libc_fcntl,
        __fcntl_nocancel, __open64_nocancel, __write_nocancel.
        * posix/Versions: Add __nanosleep_nocancel, __pause_nocancel.

        * nptl/pt-fcntl.c: New file.
        * nptl/Makefile (pthread-compat-wrappers): Remove fcntl.
        (libpthread-routines): Add pt-fcntl.
        * include/fcntl.h (__fcntl_nocancel_adjusted): New function.
        (__libc_fcntl): Remove attribute_hidden.
	* sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Call
	__fcntl_nocancel_adjusted, not fcntl_common.
        (__fcntl_nocancel): Move to new file fcntl_nocancel.c.
	(fcntl_common): Rename to __fcntl_nocancel_adjusted; also move
	to fcntl_nocancel.c.
	* sysdeps/unix/sysv/linux/fcntl_nocancel.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Remove file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
	Define FCNTL_ADJUST_CMD here, as a self-contained macro.

	* sysdeps/unix/sysv/linux/close.c: Move __close_nocancel to...
	* sysdeps/unix/sysv/linux/close_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/nanosleep.c: Move __nanosleep_nocancel to...
	* sysdeps/unix/sysv/linux/nanosleep_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/open.c: Move __open_nocancel to...
	* sysdeps/unix/sysv/linux/open_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/open64.c: Move __open64_nocancel to...
	* sysdeps/unix/sysv/linux/open64_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/openat.c: Move __openat_nocancel to...
	* sysdeps/unix/sysv/linux/openat_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/openat64.c: Move __openat64_nocancel to...
	* sysdeps/unix/sysv/linux/openat64_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/pause.c: Move __pause_nocancel to...
	* sysdeps/unix/sysv/linux/pause_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/read.c: Move __read_nocancel to...
	* sysdeps/unix/sysv/linux/read_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/waitpid.c: Move __waitpid_nocancel to...
	* sysdeps/unix/sysv/linux/waitpid_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/write.c: Move __write_nocancel to...
	* sysdeps/unix/sysv/linux/write_nocancel.c: ...this new file.

        * sysdeps/unix/sysv/linux/nios2/Makefile: Don't override
        libpthread-routines.
        * sysdeps/unix/sysv/linux/nios2/pt-vfork.S: New file which
        defines nothing.

        * sysdeps/mach/hurd/dl-sysdep.c: Define __read instead of
        __libc_read, and __write instead of __libc_write.  Define
        __open64 in addition to __open.
2018-06-12 09:53:04 -04:00
H.J. Lu 0221ce2a90 i386: Change offset of __private_ss to 0x30 [BZ #23250]
sysdeps/i386/nptl/tls.h has

typedef struct
{
  void *tcb;            /* Pointer to the TCB.  Not necessarily the
                           thread descriptor used by libpthread.  */
  dtv_t *dtv;
  void *self;           /* Pointer to the thread descriptor.  */
  int multiple_threads;
  uintptr_t sysinfo;
  uintptr_t stack_guard;
  uintptr_t pointer_guard;
  int gscope_flag;
  int __glibc_reserved1;
  /* Reservation of some values for the TM ABI.  */
  void *__private_tm[4];
  /* GCC split stack support.  */
  void *__private_ss;
} tcbhead_t;

The offset of __private_ss is 0x34.  But GCC defines

/* We steal the last transactional memory word.  */
 #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30

and libgcc/config/i386/morestack.S has

	cmpl	%gs:0x30,%eax		# See if we have enough space.
	movl	%eax,%gs:0x30		# Save the new stack boundary.
	movl	%eax,%gs:0x30		# Save the new stack boundary.
	movl	%ecx,%gs:0x30		# Save new stack boundary.
	movl	%eax,%gs:0x30
	movl	%gs:0x30,%eax
	movl	%eax,%gs:0x30

Since update TARGET_THREAD_SPLIT_STACK_OFFSET changes split stack ABI,
this patch updates tcbhead_t to match GCC.

	[BZ #23250]
	[BZ #10686]
	* sysdeps/i386/nptl/tls.h (tcbhead_t): Change __private_tm[4]
	to _private_tm[3] and add __glibc_reserved2.
	Add _Static_assert of offset of __private_ss == 0x30.
	* sysdeps/x86_64/nptl/tls.h: Add _Static_assert of offset of
	__private_ss == 0x40 for ILP32 and == 0x70 for LP64.
2018-06-12 06:34:48 -07:00
Florian Weimer e826574c98 x86: Make strncmp usable from rtld
Due to the way the conditions were written, the rtld build of strncmp
ended up with no definition of the strncmp symbol at all: The
implementations were renamed for use within an IFUNC resolver, but the
IFUNC resolver itself was missing (because rtld does not use IFUNCs).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-12 15:00:33 +02:00
Rafal Luzynski c4ad5782c4 gd_GB, hsb_DE, wa_BE: Add alternative month names (bug 23140).
As a followup of fixing bug 10871, these three languages now support two
grammatical cases of the month names.

This commit does not resolve the bug because there are more languages
to be committed.

	[BZ #23140]
	* localedata/locales/gd_GB (mon): Rename to...
	(alt_mon): This.
	(mon): Import from CLDR (genitive case).
	* localedata/locales/hsb_DE (mon): Rename to...
	(alt_mon): This.
	(mon): Import from CLDR (genitive case).
	* localedata/locales/wa_BE (mon): Rename to...
	(alt_mon): This.
	(mon): Add, fill with the proper genitive forms, but CLDR data
	is incomplete; completed according to the comments in this file.
	(d_t_fmt): Do not use "di" before the month name, no longer needed.

	* localedata/locales/wa_BE (country_name): Reword
	"Beljike" -> "Beldjike".
2018-06-12 01:33:55 +02:00
Joseph Myers ca121b117f Fix ldbl-96 fma (Inf, Inf, finite) (bug 23272).
As reported in bug 23272, the ldbl-96 implementation of fma (fma for
double, in terms of ldbl-96 as the internal arithmetic type, as used
on 32-bit x86) is missing some of the special-case handling for
non-finite arguments, resulting in incorrect NaN results when the
first two arguments are infinities, the third is finite and so the
infinities go through the logic for finite arguments.  This patch
fixes it by handling all cases of non-finite arguments up front, with
additional fma tests for the problem cases being added to the
testsuite.

Tested for x86_64 and x86.

	[BZ #23272]
	* sysdeps/ieee754/ldbl-96/s_fma.c (__fma): Start by handling all
	cases of non-finite arguments.
	* math/libm-test-fma.inc (fma_test_data): Add more tests.
2018-06-11 16:33:42 +00:00
John David Anglin 2b69fecb9d The hppa-linux target still requires an executable stack for kernel
syscall restarts and signal returns.  Thus, we need to xfail the
check-execstack test.

        [BZ #23174]
        * sysdeps/unix/sysv/linux/hppa/Makefile: xfail check-execstack.
2018-06-10 13:57:32 -04:00
Adhemerval Zanella 283d985122 posix: Fix posix_spawnp to not execute invalid binaries in non compat mode (BZ#23264)
Current posix_spawnp implementation wrongly tries to execute invalid
binaries (for instance script without shebang) as a shell script in
non compat mode.  It was a regression introduced by
9ff72da471 when __spawni started to use
__execvpe instead of __execve (glibc __execvpe try to execute ENOEXEC
as shell script regardless).

This patch fixes it by using an internal symbol (__execvpex) with the
faulty semantic (since compat mode is handled by spawni.c itself).

It was reported by Daniel Drake on libc-help [1].

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

	[BZ #23264]
	* include/unistd.h (__execvpex): New prototype.
	* posix/Makefile (tests): Add tst-spawn4.
	(tests-internal): Add tst-spawn4-compat.
	* posix/execvpe.c (__execvpe_common, __execvpex): New functions.
	* posix/tst-spawn4-compat.c: New file.
	* posix/tst-spawn4.c: Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni): Do not interpret invalid
	binaries as shell scripts.
	* sysdeps/posix/spawni.c (__spawni): Likewise.

[1] https://sourceware.org/ml/libc-help/2018-06/msg00012.html
2018-06-08 17:27:46 -03:00
H.J. Lu 67c0579669 Mark _init and _fini as hidden [BZ #23145]
_init and _fini are special functions provided by glibc for linker to
define DT_INIT and DT_FINI in executable and shared library.  They
should never be put in dynamic symbol table.  This patch marks them as
hidden to remove them from dynamic symbol table.

Tested with build-many-glibcs.py.

	[BZ #23145]
	* elf/Makefile (tests-special): Add $(objpfx)check-initfini.out.
	($(all-built-dso:=.dynsym): New target.
	(common-generated): Add $(all-built-dso:$(common-objpfx)%=%.dynsym).
	($(objpfx)check-initfini.out): New target.
	(generated): Add check-initfini.out.
	* scripts/check-initfini.awk: New file.
	* sysdeps/aarch64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/alpha/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/arm/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/hppa/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/i386/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/ia64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/m68k/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/microblaze/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/mips/mips32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/mips/mips64/n32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/mips/mips64/n64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/nios2/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/powerpc/powerpc32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/powerpc/powerpc64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/s390/s390-32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/s390/s390-64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/sh/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/sparc/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/x86_64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
2018-06-08 10:28:52 -07:00
Tulio Magno Quites Machado Filho 1c09524e4d powerpc64le: Fix TFtype in sqrtf128 when using -mabi=ieeelongdouble
When building with -mlong-double-128 or -mabi=ibmlongdouble, TFtype
represents the IBM 128-bit extended floating point type, while KFtype
represents the IEEE 128-bit floating point type.
The soft float implementation of e_sqrtf128 had to redefine TFtype and
TF in order to workaround this issue.  However, this behavior changes
when -mabi=ieeelongdouble is used and the macros are not necessary.

	* sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c
	[__HAVE_FLOAT128_UNLIKE_LDBL] (TFtype, TF): Restrict TFtype
	and TF redirection to KFtype and KF only when the default
	long double type is not the IEEE 128-bit floating point type.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-06-06 12:27:39 -03:00
Joseph Myers 0c1c33b2f5 Add AArch64 hwcap values from Linux 4.17.
Linux 4.17 adds four new AArch64 hwcap values.  This patch adds them
to glibc's AArch64 bits/hwcap.h, with corresponding dl-procinfo.c
updates.

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

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_DIT): New
	macro.
	(HWCAP_USCAT): Likewise.
	(HWCAP_ILRCPC): Likewise.
	(HWCAP_FLAGM): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
	Increase to 28.
	(_dl_aarch64_cap_flags): Add new flag names.
2018-06-05 15:51:12 +00:00
Joseph Myers bef1cbf4da Add MAP_FIXED_NOREPLACE from Linux 4.17 to bits/mman.h.
Linux 4.17 adds MAP_FIXED_NOREPLACE (value 0x100000 on most
architectures, 0x200000 on alpha).  This patch adds that macro to
glibc's bits/mman.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/aarch64/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): New macro.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/arm/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/riscv/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
2018-06-05 11:04:46 +00:00
Joseph Myers 0e0577c93f Update kernel version in syscall-names.list to 4.17.
As far as I can tell, Linux 4.17 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.17.

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

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 4.17.
2018-06-05 11:03:22 +00:00
Joseph Myers ab3a0da0b5 Use Linux 4.17 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	version to 4.17
2018-06-04 17:11:11 +00:00
Samuel Thibault d2d9dfb663 hurd: Fix shmid_ds's shm_segsz field type
* bits/shm.h (struct shmid_ds): Make shm_segsz field size_t instead of
	int.
	* sysdeps/gnu/bits/shm.h (struct shmid_ds): Likewise.
2018-06-02 21:52:43 +02:00
Leonardo Sandoval a650b05ebe benchtests: Catch exceptions in input arguments
Catch runtime exceptions in case the user provided: wrong base
function, attribute(s) or input file. In any of the latter, quit
immediately with non-zero return code.

	* benchtests/scripts/compare_string.py: (process_results) Catch
	exception in non-existent base_func and catch exception in
	non-existent attribute.
	(parse_file) Catch exception in non-existent input file.
2018-06-01 16:32:43 -05:00
Leonardo Sandoval 195abbf4cd benchtests: Add --no-diff and --no-header options
Having a string comparison report with neither diff numbers nor header
yields a more useful output to be consumed by other tools.

	* benchtests/scripts/compare_string.py: Add --no-diff and --no-header
	options to avoid diff calculation and omit header, respectively.
	(main): process --no-diff and --no-header
2018-06-01 16:32:43 -05:00
Leonardo Sandoval 1457016337 x86-64: Optimize strcmp/wcscmp and strncmp/wcsncmp with AVX2
Optimize x86-64 strcmp/wcscmp and strncmp/wcsncmp with AVX2. It uses vector
comparison as much as possible. Peak performance observed on a SkyLake
machine: 9x, 3x, 2.5x and 5.5x for strcmp, strncmp, wcscmp and wcsncmp,
respectively. The larger the comparison length, the more benefit using
avx2 functions, except on the strcmp, where peak is observed at length
== 32 bytes. Select AVX2 strcmp/wcscmp on AVX2 machines where vzeroupper
is preferred and AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strcmp-avx2, strncmp-avx2, wcscmp-avx2, wcscmp-sse2, wcsncmp-avx2 and
	wcsncmp-sse2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __strcmp_avx2,
	__strncmp_avx2,	__wcscmp_avx2, __wcsncmp_avx2, __wcscmp_sse2
	and __wcsncmp_sse2.
	* sysdeps/x86_64/multiarch/strcmp.c (OPTIMIZE (avx2)):
	(IFUNC_SELECTOR): Return OPTIMIZE (avx2) on AVX 2 machines if
	AVX unaligned load is fast and vzeroupper is preferred.
	* sysdeps/x86_64/multiarch/strncmp.c: Likewise.
	* sysdeps/x86_64/multiarch/strcmp-avx2.S: New file.
	* sysdeps/x86_64/multiarch/strncmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscmp-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscmp.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsncmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsncmp-sse2.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsncmp.c: Likewise.
	* sysdeps/x86_64/wcscmp.S (__wcscmp): Add alias only if __wcscmp
	is undefined.
2018-06-01 16:32:43 -05:00
Florian Weimer e02c026f38 math: Update i686 ulps (--disable-multi-arch configuration)
The results are from configuring with --disable-multi-arch,  building
with “-march=x86-64 -mtune=generic -mfpmath=sse” and running the
testsuite on a Haswell-era CPU.
2018-06-01 22:37:55 +02:00
Florian Weimer d8c1927561 math: Update i686 ulps
The results are from building with “-march=x86-64 -mtune=generic
-mfpmath=sse” and running the testsuite on a Haswell-era CPU.
2018-06-01 19:32:18 +02:00
Joseph Myers 0d2163ebf2 Make powerpc-nofpu __sqrtsf2, __sqrtdf2 compat symbols (bug 18473).
powerpc-nofpu libc exports __sqrtsf2 and __sqrtdf2 symbols.  The
export of these soft-fp symbols is a mistake; they aren't part of the
libgcc interface and GCC will never generate code that calls them.
This patch makes them into compat symbols (no code built for static
libc), moving their sources from the generic soft-fp sources to
sysdeps/powerpc/nofpu (the underlying soft-fp FP_SQRT functionality
remains of use to implement actual sqrt public interfaces, such as
sqrtl / sqrtf128 for which it is used on various platforms, but
__sqrt[sdt]f2 are not such interfaces).

Tested with build-many-glibcs.py for relevant platforms.

	[BZ #18473]
	* soft-fp/sqrttf2.c: Remove file.
	* soft-fp/sqrtdf2.c: Move to ....
	* sysdeps/powerpc/nofpu/sqrtdf2.c: ... here.  Include
	<shlib-compat.h>.
	(__sqrtdf2): Make conditional on
	[SHLIB_COMPAT (libc, GLIBC_2_3_2, GLIBC_2_28)].  Define as compat
	symbol.
	* soft-fp/sqrtsf2.c: Move to ....
	* sysdeps/powerpc/nofpu/sqrtsf2.c: ... here.  Include
	<shlib-compat.h>.
	(__sqrtsf2): Make conditional on
	[SHLIB_COMPAT (libc, GLIBC_2_3_2, GLIBC_2_28)].  Define as compat
	symbol.
	* soft-fp/Makefile (gcc-single-routines): Remove sqrtsf2.
	(gcc-double-routines): Remove sqrtdf2.
	(gcc-quad-routines): Remove sqrttf2.
	* sysdeps/nios2/Makefile [$(subdir) = soft-fp] (sysdep_routines):
	Do not filter out sqrtsf2 and sqrtdf2.
	* sysdeps/powerpc/nofpu/Makefile [$(subdir) = soft-fp]
	(sysdep_routines): Add sqrtsf2 and sqrtdf2.
2018-06-01 17:25:12 +00:00
Florian Weimer 104502102c Remove sysdeps/generic/libcidn.abilist
This file was left behind by the libidn removal in commit
7f9f1ecb71.
2018-06-01 11:25:41 +02:00
Florian Weimer 4e8a6346cd libio: Avoid _allocate_buffer, _free_buffer function pointers [BZ #23236]
These unmangled function pointers reside on the heap and could
be targeted by exploit writers, effectively bypassing libio vtable
validation.  Instead, we ignore these pointers and always call
malloc or free.

In theory, this is a backwards-incompatible change, but using the
global heap instead of the user-supplied callback functions should
have little application impact.  (The old libstdc++ implementation
exposed this functionality via a public, undocumented constructor
in its strstreambuf class.)
2018-06-01 10:41:03 +02:00
Paul Pluzhnikov 50d004c91c Update ulps with "make regen-ulps" on AMD Ryzen 7 1800X.
2018-05-30  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* sysdeps/x86_64/fpu/libm-test-ulps (log_vlen8_avx2): Update for
	AMD Ryzen 7 1800X.
2018-05-30 09:17:47 -07:00
Rajalakshmi Srinivasaraghavan 2c93fce76a powerpc: Add multiarch sqrtf128 for ppc64le
This patch creates ifunc for sqrtf128() to make use of new xssqrtqp
instruction for POWER9 when --enable-multi-arch and --with-cpu=power8
options are used on power9 system.  This is achieved by explicitly
adding -mcpu=power9 flag for sqrtf128-power9.
2018-05-30 21:31:27 +05:30
Florian Weimer 0ce2fa6973 support: Add wrappers for pthread_barrierattr_t 2018-05-29 15:37:00 +02:00
H.J. Lu 7f7b5d8ded static-PIE: Update DT_DEBUG for debugger [BZ #23206]
This is needed to support debugging dlopened shared libraries in static
PIE.

	[BZ #23206]
	* elf/dl-reloc-static-pie.c (_dl_relocate_static_pie): Initialize
	_r_debug and update DT_DEBUG for debugger.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-05-29 06:33:57 -07:00
Florian Weimer e48903000b stdlib: Additional tests need generated locale dependencies
Without these dependencies, the tests fail at high make parallelism
levels if the locale data has not been generated for other reasons.
2018-05-29 10:34:53 +02:00
Joseph Myers b5453d9f7a Remove sysdeps/sparc/sparc64/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.  This patch eliminates the
sysdeps/sparc/sparc64/soft-fp directory accordingly, merging its
contents into sysdeps/sparc/sparc64.  This completes removing the
unnecessary <arch>/soft-fp sysdeps directories.

sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c is removed rather than moved.
It was not in fact used previously - the ldbl-128 version of
e_ilogbl.c was used instead - and moving it into sysdeps/sparc/sparc64
results in it being used, but causing a build failure because of
FP_DECL_EX declaring an unused variable (as I noted in
<https://sourceware.org/ml/libc-alpha/2013-10/msg00457.html> that file
doesn't appear to use FP_DECL_EX).  Given that the file was previously
unused and so presumably not tested recently, removing it is the safe
way to avoid this patch changing what actually gets built into glibc
(if this file should turn out more efficient than the ldbl-128
e_ilogbl.c, it can always be added back in future with the build
failure fixed).

Tested with build-many-glibcs.py that installed stripped shared
libraries for sparc configurations are unchanged by this patch.

	* sysdeps/sparc/sparc64/Implies: Remove sparc/sparc64/soft-fp.
	* sysdeps/sparc/sparc64/Makefile [$(subdir) = soft-fp]
	(sparc64-quad-routines): New variable.  Moved from ....
	[$(subdir) = soft-fp] (sysdep_routines): Add
	$(sparc64-quad-routines).  Moved from ....
	[$(subdir) = math] (CPPFLAGS): Add -I../soft-fp/.  Moved from ....
	* sysdeps/sparc/sparc64/soft-fp/Makefile: ... here.  Remove file.
	* sysdeps/sparc/sparc64/Versions (libc): Add GLIBC_2.2 symbols
	moved from ....
	* sysdeps/sparc/sparc64/soft-fp/Versions: ... here.  Remove file.
	* sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c: Remove file.
	* sysdeps/sparc/sparc64/soft-fp/qp_add.c: Move to ....
	* sysdeps/sparc/sparc64/qp_add.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_cmp.c: Move to ....
	* sysdeps/sparc/sparc64/qp_cmp.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c: Move to ....
	* sysdeps/sparc/sparc64/qp_cmpe.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_div.c: Move to ....
	* sysdeps/sparc/sparc64/qp_div.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_dtoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_feq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_feq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fge.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fge.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fgt.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fgt.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fle.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fle.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_flt.c: Move to ....
	* sysdeps/sparc/sparc64/qp_flt.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fne.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fne.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_itoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_itoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_mul.c: Move to ....
	* sysdeps/sparc/sparc64/qp_mul.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_neg.S: Move to ....
	* sysdeps/sparc/sparc64/qp_neg.S: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtod.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtod.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtoi.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtos.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtos.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtoui.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtoux.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtox.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtox.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c: Move to ....
	* sysdeps/sparc/sparc64/qp_sqrt.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_stoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_stoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_sub.c: Move to ....
	* sysdeps/sparc/sparc64/qp_sub.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_uitoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_util.c: Move to ....
	* sysdeps/sparc/sparc64/qp_util.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_uxtoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_xtoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/sparc/sparc64/sfp-machine.h: ... here.
2018-05-25 20:00:51 +00:00