platform/upstream/glibc.git
6 years agosupport: Add TEST_NO_SETVBUF
Florian Weimer [Tue, 26 Jun 2018 10:05:21 +0000 (12:05 +0200)]
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.

6 years agolibio: Disable vtable validation in case of interposition [BZ #23313]
Florian Weimer [Tue, 26 Jun 2018 08:24:52 +0000 (10:24 +0200)]
libio: Disable vtable validation in case of interposition [BZ #23313]

6 years agonss_files: Use struct scratch_buffer instead of extend_alloca [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 17:29:11 +0000 (19:29 +0200)]
nss_files: Use struct scratch_buffer instead of extend_alloca [BZ #18023]

6 years agogetent: Use dynarray in initgroups_keys [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 17:22:46 +0000 (19:22 +0200)]
getent: Use dynarray in initgroups_keys [BZ #18023]

6 years ago_nss_nis_initgroups_dyn: Use struct scratch_buffer [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 17:14:09 +0000 (19:14 +0200)]
_nss_nis_initgroups_dyn: Use struct scratch_buffer [BZ #18023]

Remove extend_alloca usage.  Also adjusts the internal function get_uid.

6 years agogetgrent_next_nss (compat-initgroups): Remove alloca fallback [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 16:56:42 +0000 (18:56 +0200)]
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.

6 years agonscd: Switch to struct scratch_buffer in adhstaiX [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 14:05:46 +0000 (16:05 +0200)]
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.

6 years agonscd: Use struct scratch_buffer, not extend_alloca in most caches [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 14:04:29 +0000 (16:04 +0200)]
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.

6 years agonscd restart: Use malloc instead of extend_alloca [BZ #18023]
Florian Weimer [Mon, 25 Jun 2018 15:10:15 +0000 (17:10 +0200)]
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.

6 years agocsb_PL: Add alternative month names (bug 23140).
Rafal Luzynski [Tue, 30 Jan 2018 11:31:12 +0000 (12:31 +0100)]
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.

6 years agocsb_PL: Update month translations + add yesstr/nostr (bug 19485).
Rafal Luzynski [Thu, 21 Jun 2018 10:29:13 +0000 (12:29 +0200)]
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é".

6 years agom68k: Reorganize log1p and significand implementations
Tulio Magno Quites Machado Filho [Fri, 22 Jun 2018 21:18:21 +0000 (18:18 -0300)]
m68k: Reorganize log1p and significand implementations

Commit 5e79e0292bfb03f40e43379fd92581ad8eae9cb8 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>
6 years agoAdd Andes nds32 dynamic relocations to elf.h
Vincent Chen [Thu, 21 Jun 2018 20:44:43 +0000 (20:44 +0000)]
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.

6 years agoelf.h: Add BPF relocation types.
Mark Wielaard [Sat, 16 Jun 2018 21:34:13 +0000 (23:34 +0200)]
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>
6 years agomath: Set 387 and SSE2 rounding mode for tgamma on i386 [BZ #23253]
Florian Weimer [Thu, 21 Jun 2018 06:04:29 +0000 (08:04 +0200)]
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.

6 years agoFix tst-cmp.c build with GCC mainline.
Joseph Myers [Wed, 20 Jun 2018 22:19:50 +0000 (22:19 +0000)]
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.

6 years agoFix bug-strspn1.c, bug-strpbrk1.c build with GCC mainline.
Joseph Myers [Wed, 20 Jun 2018 22:18:22 +0000 (22:18 +0000)]
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.

6 years agoldbl-128ibm-compat: Create libm-alias-float128.h
Tulio Magno Quites Machado Filho [Wed, 20 Jun 2018 21:35:35 +0000 (18:35 -0300)]
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.

6 years agoAdd a generic significand implementation
Tulio Magno Quites Machado Filho [Wed, 20 Jun 2018 21:15:06 +0000 (18:15 -0300)]
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>
6 years agoMove declare_mgen_finite_alias definition
Tulio Magno Quites Machado Filho [Wed, 20 Jun 2018 20:42:47 +0000 (17:42 -0300)]
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>
6 years agolibio: Avoid ptrdiff_t overflow in IO_validate_vtable
Florian Weimer [Wed, 20 Jun 2018 07:45:19 +0000 (09:45 +0200)]
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.

6 years agoFix scanf rounding of negative floating-point numbers (bug 23280).
Joseph Myers [Tue, 19 Jun 2018 11:52:18 +0000 (11:52 +0000)]
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).

6 years agohurd: fix localplt.data format
Samuel Thibault [Tue, 19 Jun 2018 00:37:23 +0000 (02:37 +0200)]
hurd: fix localplt.data format

* sysdeps/mach/hurd/i386/localplt.data: Drop empty line.

6 years agohurd: Fix "Missing required PLT reference"
Samuel Thibault [Tue, 19 Jun 2018 00:32:41 +0000 (02:32 +0200)]
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.

6 years agoAdd SHM_STAT_ANY from Linux 4.17 to bits/shm.h.
Joseph Myers [Mon, 18 Jun 2018 13:37:57 +0000 (13:37 +0000)]
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.

6 years agoAdd SEM_STAT_ANY from Linux 4.17 to bits/sem.h.
Joseph Myers [Mon, 18 Jun 2018 13:36:41 +0000 (13:36 +0000)]
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.

6 years agoAdd MSG_STAT_ANY from Linux 4.17 to bits/msq.h.
Joseph Myers [Mon, 18 Jun 2018 13:34:52 +0000 (13:34 +0000)]
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.

6 years agoUpdate MAP_TYPE value for hppa from Linux 4.17.
Joseph Myers [Mon, 18 Jun 2018 13:33:52 +0000 (13:33 +0000)]
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.

6 years agoLinux: Create Netlink socket with SOCK_CLOEXEC in __check_pf [BZ #15722]
Florian Weimer [Mon, 18 Jun 2018 11:08:08 +0000 (13:08 +0200)]
Linux: Create Netlink socket with SOCK_CLOEXEC in __check_pf [BZ #15722]

6 years agoFix powerpc64le build of nan-sign tests (bug 23303).
Joseph Myers [Mon, 18 Jun 2018 11:27:51 +0000 (11:27 +0000)]
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.

6 years agohurd: Fix reference to _hurd_self_sigstate
Samuel Thibault [Sat, 16 Jun 2018 14:07:23 +0000 (14:07 +0000)]
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.

6 years agohurd: Fix missing __pthread_get_cleanup_stack symbol
Samuel Thibault [Sat, 16 Jun 2018 08:52:04 +0000 (10:52 +0200)]
hurd: Fix missing __pthread_get_cleanup_stack symbol

Rework 57e1651557e8 ("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.

6 years agohurd: Whitelist PLT refs which are difficult to avoid
Samuel Thibault [Sat, 16 Jun 2018 00:59:14 +0000 (02:59 +0200)]
hurd: Whitelist PLT refs which are difficult to avoid

* sysdeps/mach/hurd/localplt.data (siglongjmp, longjmp,
__libc_lseek64, _IO_funlockfile): Whitelist PLT references.

6 years agohurd: Avoid PLT references to syscalls
Samuel Thibault [Sat, 16 Jun 2018 00:47:51 +0000 (02:47 +0200)]
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.

6 years agohurd: Avoid PLT ref to __mach_msg
Samuel Thibault [Sat, 16 Jun 2018 00:35:17 +0000 (02:35 +0200)]
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.

6 years agohurd: Avoid PLT references to shortcuts
Samuel Thibault [Sat, 16 Jun 2018 00:19:47 +0000 (02:19 +0200)]
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>.

6 years agohurd: Avoid missing PLT ref from ld.so requirement
Samuel Thibault [Fri, 15 Jun 2018 23:49:29 +0000 (01:49 +0200)]
hurd: Avoid missing PLT ref from ld.so requirement

* sysdeps/mach/hurd/localplt.data (ld.so): Make ref to __open optional.

6 years agohurd: Avoid PLT ref for __pthread_get_cleanup_stack
Samuel Thibault [Fri, 15 Jun 2018 23:22:43 +0000 (01:22 +0200)]
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.

6 years agohurd: Detect 32bit overflow in value returned by lseek
Samuel Thibault [Fri, 15 Jun 2018 23:00:00 +0000 (01:00 +0200)]
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.

6 years agohurd: avoid PLT ref between sendfile and sendfile64
Samuel Thibault [Fri, 15 Jun 2018 22:44:17 +0000 (00:44 +0200)]
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.

6 years agoAdd tests for sign of NaN returned by strtod (bug 23007).
Joseph Myers [Fri, 15 Jun 2018 17:36:21 +0000 (17:36 +0000)]
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).

6 years agoFix sign of NaN returned by strtod (bug 23007).
Herman ten Brugge [Fri, 15 Jun 2018 17:35:17 +0000 (17:35 +0000)]
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.

6 years agolocaledata: Make IBM273 compatible with ISO-8859-1 [BZ #23290]
Florian Weimer [Thu, 14 Jun 2018 20:34:09 +0000 (22:34 +0200)]
localedata: Make IBM273 compatible with ISO-8859-1 [BZ #23290]

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agohurd: Fix htl link failure
Samuel Thibault [Thu, 14 Jun 2018 15:09:18 +0000 (17:09 +0200)]
hurd: Fix htl link failure

126b3ec370f0 ("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.

6 years agoIgnore -Wrestrict for one strncat test.
Joseph Myers [Thu, 14 Jun 2018 14:20:00 +0000 (14:20 +0000)]
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.

6 years agoaarch64: Use an ifunc/VDSO to implement gettimeofday in shared glibc.
Steve Ellcey [Thu, 14 Jun 2018 07:18:42 +0000 (08:18 +0100)]
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.

6 years agoscripts/update-abilist.sh: Accept empty list of files to patch
Florian Weimer [Thu, 14 Jun 2018 07:37:31 +0000 (09:37 +0200)]
scripts/update-abilist.sh: Accept empty list of files to patch

Commit b289cd9db8286fa6c670104dd5dfcfc68d5d00d6 (“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.

6 years agohurd: Avoid a PLT reference
Samuel Thibault [Wed, 13 Jun 2018 23:43:04 +0000 (01:43 +0200)]
hurd: Avoid a PLT reference

* sysdeps/mach/hurd/i386/____longjmp_chk.S (____longjmp_chk): Do not
use PLT to call _hurd_self_sigstate.

6 years agohurd: Avoid PLTs for __mach_thread_self and __mach_reply_port
Samuel Thibault [Wed, 13 Jun 2018 23:01:57 +0000 (01:01 +0200)]
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.

6 years agohurd: Avoid PLTs for _hurd_port_locked_get/set
Samuel Thibault [Wed, 13 Jun 2018 22:28:03 +0000 (00:28 +0200)]
hurd: Avoid PLTs for _hurd_port_locked_get/set

* sysdeps/hurd/include/hurd/port.h: New file.

6 years agohurd: update localplt.data
Samuel Thibault [Wed, 13 Jun 2018 22:22:20 +0000 (00:22 +0200)]
hurd: update localplt.data

after 329ea513b451 ("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.

6 years agohurd: xfail missing abilist for libmachuser and libhurduser
Samuel Thibault [Wed, 13 Jun 2018 19:12:23 +0000 (21:12 +0200)]
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.

6 years agoFix strtod overflow detection (bug 23279).
Joseph Myers [Wed, 13 Jun 2018 16:06:14 +0000 (16:06 +0000)]
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.

6 years agoFix comments in _dl_dst_count and _dl_dst_substitute.
Carlos O'Donell [Wed, 13 Jun 2018 03:31:02 +0000 (23:31 -0400)]
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.

6 years agoFix fallback path in __pthread_mutex_timedlock ().
Carlos O'Donell [Tue, 12 Jun 2018 20:17:05 +0000 (16:17 -0400)]
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.

6 years agoDo not use const attribute for nan functions (bug 23277).
Joseph Myers [Tue, 12 Jun 2018 16:57:26 +0000 (16:57 +0000)]
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.

6 years agobenchtests: Add -f/--functions argument
H.J. Lu [Tue, 12 Jun 2018 16:10:28 +0000 (09:10 -0700)]
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.

6 years agoaarch64: add HXT Phecda core memory operation ifuncs
Hongbo Zhang [Tue, 12 Jun 2018 15:59:11 +0000 (21:29 +0530)]
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.

6 years agoImprove DST handling (Bug 23102, Bug 21942, Bug 18018, Bug 23259).
Carlos O'Donell [Wed, 6 Jun 2018 03:55:17 +0000 (23:55 -0400)]
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

6 years agoAvoid cancellable I/O primitives in ld.so.
Zack Weinberg [Tue, 3 Apr 2018 22:26:44 +0000 (18:26 -0400)]
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.

6 years agoi386: Change offset of __private_ss to 0x30 [BZ #23250]
H.J. Lu [Tue, 12 Jun 2018 13:23:28 +0000 (06:23 -0700)]
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.

6 years agox86: Make strncmp usable from rtld
Florian Weimer [Tue, 12 Jun 2018 13:00:33 +0000 (15:00 +0200)]
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>
6 years agogd_GB, hsb_DE, wa_BE: Add alternative month names (bug 23140).
Rafal Luzynski [Tue, 30 Jan 2018 11:31:12 +0000 (12:31 +0100)]
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".

6 years agoFix ldbl-96 fma (Inf, Inf, finite) (bug 23272).
Joseph Myers [Mon, 11 Jun 2018 16:33:42 +0000 (16:33 +0000)]
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.

6 years agoThe hppa-linux target still requires an executable stack for kernel
John David Anglin [Sun, 10 Jun 2018 17:57:32 +0000 (13:57 -0400)]
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.

6 years agoposix: Fix posix_spawnp to not execute invalid binaries in non compat mode (BZ#23264)
Adhemerval Zanella [Wed, 6 Jun 2018 17:07:34 +0000 (14:07 -0300)]
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
9ff72da471a509a8c19791efe469f47fa6977410 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

6 years agoMark _init and _fini as hidden [BZ #23145]
H.J. Lu [Fri, 8 Jun 2018 17:28:38 +0000 (10:28 -0700)]
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.

6 years agopowerpc64le: Fix TFtype in sqrtf128 when using -mabi=ieeelongdouble
Tulio Magno Quites Machado Filho [Wed, 6 Jun 2018 15:27:39 +0000 (12:27 -0300)]
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>
6 years agoAdd AArch64 hwcap values from Linux 4.17.
Joseph Myers [Tue, 5 Jun 2018 15:51:12 +0000 (15:51 +0000)]
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.

6 years agoAdd MAP_FIXED_NOREPLACE from Linux 4.17 to bits/mman.h.
Joseph Myers [Tue, 5 Jun 2018 11:04:46 +0000 (11:04 +0000)]
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.

6 years agoUpdate kernel version in syscall-names.list to 4.17.
Joseph Myers [Tue, 5 Jun 2018 11:03:22 +0000 (11:03 +0000)]
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.

6 years agoUse Linux 4.17 in build-many-glibcs.py.
Joseph Myers [Mon, 4 Jun 2018 17:11:11 +0000 (17:11 +0000)]
Use Linux 4.17 in build-many-glibcs.py.

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

6 years agohurd: Fix shmid_ds's shm_segsz field type
Samuel Thibault [Sat, 2 Jun 2018 19:52:43 +0000 (21:52 +0200)]
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.

6 years agobenchtests: Catch exceptions in input arguments
Leonardo Sandoval [Tue, 29 May 2018 17:13:11 +0000 (12:13 -0500)]
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.

6 years agobenchtests: Add --no-diff and --no-header options
Leonardo Sandoval [Wed, 23 May 2018 16:23:14 +0000 (11:23 -0500)]
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

6 years agox86-64: Optimize strcmp/wcscmp and strncmp/wcsncmp with AVX2
Leonardo Sandoval [Thu, 3 May 2018 16:09:30 +0000 (11:09 -0500)]
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.

6 years agomath: Update i686 ulps (--disable-multi-arch configuration)
Florian Weimer [Fri, 1 Jun 2018 20:37:55 +0000 (22:37 +0200)]
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.

6 years agomath: Update i686 ulps
Florian Weimer [Fri, 1 Jun 2018 17:31:45 +0000 (19:31 +0200)]
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.

6 years agoMake powerpc-nofpu __sqrtsf2, __sqrtdf2 compat symbols (bug 18473).
Joseph Myers [Fri, 1 Jun 2018 17:25:12 +0000 (17:25 +0000)]
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.

6 years agoRemove sysdeps/generic/libcidn.abilist
Florian Weimer [Fri, 1 Jun 2018 09:25:41 +0000 (11:25 +0200)]
Remove sysdeps/generic/libcidn.abilist

This file was left behind by the libidn removal in commit
7f9f1ecb710eac4d65bb02785ddf288cac098323.

6 years agolibio: Avoid _allocate_buffer, _free_buffer function pointers [BZ #23236]
Florian Weimer [Fri, 1 Jun 2018 08:41:03 +0000 (10:41 +0200)]
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.)

6 years agoUpdate ulps with "make regen-ulps" on AMD Ryzen 7 1800X.
Paul Pluzhnikov [Wed, 30 May 2018 16:17:47 +0000 (09:17 -0700)]
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.

6 years agopowerpc: Add multiarch sqrtf128 for ppc64le
Rajalakshmi Srinivasaraghavan [Wed, 30 May 2018 16:01:27 +0000 (21:31 +0530)]
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.

6 years agosupport: Add wrappers for pthread_barrierattr_t
Florian Weimer [Tue, 29 May 2018 08:48:46 +0000 (10:48 +0200)]
support: Add wrappers for pthread_barrierattr_t

6 years agostatic-PIE: Update DT_DEBUG for debugger [BZ #23206]
H.J. Lu [Tue, 29 May 2018 13:33:42 +0000 (06:33 -0700)]
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>
6 years agostdlib: Additional tests need generated locale dependencies
Florian Weimer [Tue, 29 May 2018 08:34:52 +0000 (10:34 +0200)]
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.

6 years agoRemove sysdeps/sparc/sparc64/soft-fp directory.
Joseph Myers [Fri, 25 May 2018 20:00:51 +0000 (20:00 +0000)]
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.

6 years agoRemove sysdeps/sparc/sparc32/soft-fp directory.
Joseph Myers [Fri, 25 May 2018 16:51:15 +0000 (16:51 +0000)]
Remove sysdeps/sparc/sparc32/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/sparc32/soft-fp directory accordingly, merging its
contents into sysdeps/sparc/sparc32.

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

* sysdeps/sparc/sparc32/Implies: Remove sparc/sparc32/soft-fp.
* sysdeps/sparc/sparc32/Makefile [$(subdir) = soft-fp]
(sparc32-quad-routines): New variable.  Moved from ....
[$(subdir) = soft-fp] (sysdep_routines): Add
$(sparc32-quad-routines).  Moved from ....
* sysdeps/sparc/sparc32/soft-fp/Makefile: ... here.  Remove file.
* sysdeps/sparc/sparc32/Versions (libc): Add GLIBC_2.4 symbols
moved from ....
* sysdeps/sparc/sparc32/soft-fp/Versions: ... here.  Remove file.
* sysdeps/sparc/sparc32/soft-fp/q_add.c: Move to ....
* sysdeps/sparc/sparc32/q_add.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_cmp.c: Move to ....
* sysdeps/sparc/sparc32/q_cmp.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_cmpe.c: Move to ....
* sysdeps/sparc/sparc32/q_cmpe.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_div.c: Move to ....
* sysdeps/sparc/sparc32/q_div.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_dtoq.c: Move to ....
* sysdeps/sparc/sparc32/q_dtoq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_feq.c: Move to ....
* sysdeps/sparc/sparc32/q_feq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_fge.c: Move to ....
* sysdeps/sparc/sparc32/q_fge.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_fgt.c: Move to ....
* sysdeps/sparc/sparc32/q_fgt.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_fle.c: Move to ....
* sysdeps/sparc/sparc32/q_fle.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_flt.c: Move to ....
* sysdeps/sparc/sparc32/q_flt.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_fne.c: Move to ....
* sysdeps/sparc/sparc32/q_fne.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_itoq.c: Move to ....
* sysdeps/sparc/sparc32/q_itoq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: Move to ....
* sysdeps/sparc/sparc32/q_lltoq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_mul.c: Move to ....
* sysdeps/sparc/sparc32/q_mul.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_neg.c: Move to ....
* sysdeps/sparc/sparc32/q_neg.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_qtod.c: Move to ....
* sysdeps/sparc/sparc32/q_qtod.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_qtoi.c: Move to ....
* sysdeps/sparc/sparc32/q_qtoi.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_qtoll.c: Move to ....
* sysdeps/sparc/sparc32/q_qtoll.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_qtos.c: Move to ....
* sysdeps/sparc/sparc32/q_qtos.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_qtou.c: Move to ....
* sysdeps/sparc/sparc32/q_qtou.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_qtoull.c: Move to ....
* sysdeps/sparc/sparc32/q_qtoull.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_sqrt.c: Move to ....
* sysdeps/sparc/sparc32/q_sqrt.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_stoq.c: Move to ....
* sysdeps/sparc/sparc32/q_stoq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_sub.c: Move to ....
* sysdeps/sparc/sparc32/q_sub.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: Move to ....
* sysdeps/sparc/sparc32/q_ulltoq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_util.c: Move to ....
* sysdeps/sparc/sparc32/q_util.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/q_utoq.c: Move to ....
* sysdeps/sparc/sparc32/q_utoq.c: ... here.
* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h: Move to ....
* sysdeps/sparc/sparc32/sfp-machine.h: ... here.

6 years agopowerpc: Move around math-related Implies
Tulio Magno Quites Machado Filho [Thu, 24 May 2018 21:20:40 +0000 (18:20 -0300)]
powerpc: Move around math-related Implies

Currently, powerpc, powerpc64, and powerpc64le imply the same set of
subdirectories from sysdeps/ieee754: flt-32, dbl-64, ldbl-128ibm, and
ldbl-opt.  In preparation for the transition of the long double format -
from IBM Extended Precision to IEEE 754 128-bits floating-point - on
powerpc64le, this patch splits the shared Implies file into three
separate files (one for each of the powerpc architectures), without
changing their contents.  Future patches will modify powerpc64le.

* sysdeps/powerpc/Implies: Removed.  Previous contents copied to...
* sysdeps/powerpc/powerpc32/Implies-after: ... here.
* sysdeps/powerpc/powerpc64/be/Implies-after: ... here.
* sysdeps/powerpc/powerpc64/le/Implies-before: ... and here.

6 years agoRemove sysdeps/powerpc/soft-fp directory.
Joseph Myers [Thu, 24 May 2018 22:02:32 +0000 (22:02 +0000)]
Remove sysdeps/powerpc/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.

sysdeps/powerpc/soft-fp isn't quite such a case, as the Implies files
pointing to it are
sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies and
sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies (and
indeed there is a different sfp-machine.h used for powerpc64le).
However, the same principle applies: there is no need for this
directory because sfp-machine.h, the only file in it, can most
naturally go in sysdeps/powerpc/nofpu, which is used by exactly the
same configurations (and there is a close dependence between the files
there and the sfp-machine.h implementation).  This patch eliminates
the sysdeps/powerpc/soft-fp directory accordingly.

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

* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies: Remove
powerpc/soft-fp.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies:
Likewise.
* sysdeps/powerpc/soft-fp/sfp-machine.h: Move to ....
* sysdeps/powerpc/nofpu/sfp-machine.h: ... here.

6 years agoFix parameter type in C++ version of iseqsig (bug 23171)
Gabriel F. T. Gomes [Mon, 14 May 2018 12:04:28 +0000 (09:04 -0300)]
Fix parameter type in C++ version of iseqsig (bug 23171)

The commit

  commit c85e54ac6cef0faed7b7ffc722f52523dec59bf5
  Author: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
  Date:   Fri Nov 3 10:44:36 2017 -0200

      Provide a C++ version of iseqsig (bug 22377)

mistakenly used double parameters in the long double version of iseqsig,
thus causing spurious conversions to double, as reported on bug 23171.

Tested for powerpc64le and x86_64.

6 years agoAdd references to CVE-2017-18269, CVE-2018-11236, CVE-2018-11237
Florian Weimer [Thu, 24 May 2018 10:19:11 +0000 (12:19 +0200)]
Add references to CVE-2017-18269, CVE-2018-11236, CVE-2018-11237

6 years agoRemove sysdeps/sh/soft-fp directory.
Joseph Myers [Wed, 23 May 2018 20:05:31 +0000 (20:05 +0000)]
Remove sysdeps/sh/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/sh/soft-fp
directory accordingly, merging its contents into sysdeps/sh.

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

* sysdeps/sh/Implies: Remove sh/soft-fp.
* sysdeps/sh/soft-fp/sfp-machine.h: Move to ....
* sysdeps/sh/sfp-machine.h: ... here.

6 years agox86-64: Skip zero length in __mem[pcpy|move|set]_erms
H.J. Lu [Wed, 23 May 2018 18:25:20 +0000 (11:25 -0700)]
x86-64: Skip zero length in __mem[pcpy|move|set]_erms

This patch skips zero length in __mempcpy_erms, __memmove_erms and
__memset_erms.

Tested on x86-64.

* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
(__mempcpy_erms): Skip zero length.
(__memmove_erms): Likewise.
* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
(__memset_erms): Likewise.

6 years agoRemove sysdeps/alpha/soft-fp directory.
Joseph Myers [Wed, 23 May 2018 17:29:20 +0000 (17:29 +0000)]
Remove sysdeps/alpha/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/alpha/soft-fp directory accordingly, merging its contents
into sysdeps/alpha.

Tested with build-many-glibcs.py that installed stripped shared
libraries for alpha-linux-gnu are unchanged by this patch.

* sysdeps/alpha/Implies: Remove alpha/soft-fp.
* sysdeps/alpha/Makefile [$(subdir) = soft-fp] (sysdep_routines):
Add functions moved from ....
[$(subdir) = math] (CPPFLAGS): Add -I../soft-fp.  Moved from ....
* sysdeps/alpha/soft-fp/Makefile: ... here.  Remove file.
* sysdeps/alpha/Versions (libc): Add GLIBC_2.3.4 symbols moved
from ....
* sysdeps/alpha/soft-fp/Versions: ... here.  Remove file.
* sysdeps/alpha/soft-fp/e_sqrtl.c: Move to ....
* sysdeps/alpha/e_sqrtl.c: ... here.
* sysdeps/alpha/soft-fp/local-soft-fp.h: Move to ....
* sysdeps/alpha/local-soft-fp.h: ... here.
* sysdeps/alpha/soft-fp/ots_add.c: Move to ....
* sysdeps/alpha/ots_add.c: ... here.
* sysdeps/alpha/soft-fp/ots_cmp.c: Move to ....
* sysdeps/alpha/ots_cmp.c: ... here.
* sysdeps/alpha/soft-fp/ots_cmpe.c: Move to ....
* sysdeps/alpha/ots_cmpe.c: ... here.
* sysdeps/alpha/soft-fp/ots_cvtqux.c: Move to ....
* sysdeps/alpha/ots_cvtqux.c: ... here.
* sysdeps/alpha/soft-fp/ots_cvtqx.c: Move to ....
* sysdeps/alpha/ots_cvtqx.c: ... here.
* sysdeps/alpha/soft-fp/ots_cvttx.c: Move to ....
* sysdeps/alpha/ots_cvttx.c: ... here.
* sysdeps/alpha/soft-fp/ots_cvtxq.c: Move to ....
* sysdeps/alpha/ots_cvtxq.c: ... here.
* sysdeps/alpha/soft-fp/ots_cvtxt.c: Move to ....
* sysdeps/alpha/ots_cvtxt.c: ... here.
* sysdeps/alpha/soft-fp/ots_div.c: Move to ....
* sysdeps/alpha/ots_div.c: ... here.
* sysdeps/alpha/soft-fp/ots_mul.c: Move to ....
* sysdeps/alpha/ots_mul.c: ... here.
* sysdeps/alpha/soft-fp/ots_nintxq.c: Move to ....
* sysdeps/alpha/ots_nintxq.c: ... here.
* sysdeps/alpha/soft-fp/ots_sub.c: Move to ....
* sysdeps/alpha/ots_sub.c: ... here.
* sysdeps/alpha/soft-fp/sfp-machine.h: Move to ....
* sysdeps/alpha/sfp-machine.h: ... here.

6 years agoSwitch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247]
Florian Weimer [Wed, 23 May 2018 13:26:19 +0000 (15:26 +0200)]
Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247]

This provides an implementation of the IDNA2008 standard and fixes
CVE-2016-6261, CVE-2016-6263, CVE-2017-14062.

6 years agoImplement allocate_once for atomic initialization with allocation
Florian Weimer [Wed, 23 May 2018 12:16:18 +0000 (14:16 +0200)]
Implement allocate_once for atomic initialization with allocation

6 years agoAdd a test case for [BZ #23196]
H.J. Lu [Wed, 23 May 2018 10:59:56 +0000 (03:59 -0700)]
Add a test case for [BZ #23196]

[BZ #23196]
* string/test-memcpy.c (do_test1): New function.
(test_main): Call it.

6 years agoDon't write beyond destination in __mempcpy_avx512_no_vzeroupper (bug 23196)
Andreas Schwab [Tue, 22 May 2018 08:37:59 +0000 (10:37 +0200)]
Don't write beyond destination in __mempcpy_avx512_no_vzeroupper (bug 23196)

When compiled as mempcpy, the return value is the end of the destination
buffer, thus it cannot be used to refer to the start of it.

6 years agoRemove sysdeps/aarch64/soft-fp directory.
Joseph Myers [Tue, 22 May 2018 17:23:34 +0000 (17:23 +0000)]
Remove sysdeps/aarch64/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/aarch64/soft-fp directory accordingly, merging its contents
into sysdeps/aarch64.

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

* sysdeps/aarch64/Implies: Remove aarch64/soft-fp.
* sysdeps/aarch64/Makefile [$(subdir) = math] (CPPFLAGS): Add
-I../soft-fp.  Moved from ....
* sysdeps/aarch64/soft-fp/Makefile: ... here.  Remove file.
* sysdeps/aarch64/soft-fp/e_sqrtl.c: Move to ....
* sysdeps/aarch64/e_sqrtl.c: ... here.
* sysdeps/aarch64/soft-fp/sfp-machine.h: Move to ....
* sysdeps/aarch64/sfp-machine.h: ... here.