]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
8 years agoFix malloc threaded tests link on non-Linux
Samuel Thibault [Tue, 22 Mar 2016 08:58:48 +0000 (09:58 +0100)] 
Fix malloc threaded tests link on non-Linux

* malloc/Makefile ($(objpfx)tst-malloc-backtrace,
$(objpfx)tst-malloc-thread-exit, $(objpfx)tst-malloc-thread-fail): Use
$(shared-thread-library) instead of hardcoding the path to libpthread.

(cherry picked from commit b87e41378beca3c98ec3464d64835e66cc788497)
(cherry picked from commit a5c2f42566460fc73755c768e8e1c59dbd5a4bb2)

8 years agomalloc: Remove NO_THREADS
Florian Weimer [Fri, 19 Feb 2016 16:07:45 +0000 (17:07 +0100)] 
malloc: Remove NO_THREADS

No functional change.  It was not possible to build without
threading support before.

(cherry picked from commit 59eda029a8a35e5f4e5cd7be0f84c6629e48ec6e)
(cherry picked from commit f69ae17e843b00d3495b736f4381c1fa64dc02bc)

8 years agohesiod: Avoid heap overflow in get_txt_records [BZ #20031]
Florian Weimer [Mon, 2 May 2016 14:04:32 +0000 (16:04 +0200)] 
hesiod: Avoid heap overflow in get_txt_records [BZ #20031]

(cherry picked from commit 8a03ccbb77f52ec4b55062eeedddb8daec1a33e4)
(cherry picked from commit 4c4b3cbb4638ec19de19c167d498e30fd67501ab)

8 years agohesiod: Always use thread-local resolver state [BZ #19573]
Florian Weimer [Mon, 2 May 2016 13:25:20 +0000 (15:25 +0200)] 
hesiod: Always use thread-local resolver state [BZ #19573]

The Hesiod implementation imported into glibc was enhanced
to support caller-supplied resolver states.  But its only
consumer is nss_hesiod, and it supplies the thread-local
resolver state.  Therefore, this commit changes the Hesiod
implementation to use the thread-local resolver state (_res)
directly.  This fixes bug 19573 because the Hesiod
implementation no longer has to initialize and free any
resolver state.

To avoid any risk of interposition of ABI-incompatible Hesiod
function implementations, this commit marks the Hesiod functions
as hidden.  (They were already hidden using a linker version
script.)

(cherry picked from commit 5018f16c6205404ba3aa7298dc8a3d45fbd46bfc)
(cherry picked from commit 2d1f6790183dabf54c5b05be97d3872dab720c83)

8 years agohesiod: Remove RCS keywords
Florian Weimer [Mon, 2 May 2016 10:07:09 +0000 (12:07 +0200)] 
hesiod: Remove RCS keywords

(cherry picked from commit dbdc657dc0b962ef3ac61585c81e0828d8da42ee)
(cherry picked from commit 8a756c076eee041f7d231334480f96bebb0d8e29)

8 years agogetnameinfo: Return EAI_OVERFLOW in more cases [BZ #19787]
Florian Weimer [Wed, 4 May 2016 12:45:17 +0000 (14:45 +0200)] 
getnameinfo: Return EAI_OVERFLOW in more cases [BZ #19787]

The AF_LOCAL and AF_INET/AF_INET6 non-numerci service conversion
did not return EAI_OVERFLOW if the supplied buffer was too small,
silently returning truncated data.  In the AF_INET/AF_INET6
numeric cases, the snprintf return value checking was incorrect.

(cherry picked from commit 066746783d6c6c0f61b39c741177e24a9b398a20)
(cherry picked from commit f8020794aea5d4feb38683fc8301ee04a4fc4759)

8 years agogetnameinfo: Avoid calling strnlen on uninitialized buffer
Florian Weimer [Wed, 4 May 2016 12:35:23 +0000 (14:35 +0200)] 
getnameinfo: Avoid calling strnlen on uninitialized buffer

In the numeric AF_INET/AF_INET6 case, if inet_ntop fails
as the result of a short host buffer, we used to call strnlen
on the uninitialized host buffer.

(cherry picked from commit 1c3490d4b29fc5b3f30dd6b13082046aee94443d)
(cherry picked from commit 05d2606fa110a8afd85419d969a6d55bf88efb0f)

8 years agogetnameinfo: Reduce line length and add missing comments
Florian Weimer [Wed, 4 May 2016 12:35:12 +0000 (14:35 +0200)] 
getnameinfo: Reduce line length and add missing comments

(cherry picked from commit c9b0e6a432e827b61f12eb52c2aaeadc77b64461)
(cherry picked from commit c5aae1035cac6305a111e3461af23a924914d9f5)

8 years agogetnameinfo: Refactor and fix memory leak [BZ #19642]
Florian Weimer [Fri, 29 Apr 2016 15:08:06 +0000 (17:08 +0200)] 
getnameinfo: Refactor and fix memory leak [BZ #19642]

Split getnameinfo into separate functions for host and service
lookups, and for different address families.

(cherry picked from commit 2dce81a319601e1ee110f7316f705b48c5686e72)
(cherry picked from commit e5bcbfc23b356b62ebfcd1943655eab45a9ca87c)

8 years agogetnameinfo: Do not preserve errno
Florian Weimer [Thu, 28 Apr 2016 15:41:49 +0000 (17:41 +0200)] 
getnameinfo: Do not preserve errno

POSIX does not require it, the companion getaddrinfo implementation
does not do it, and this behavior is not documented in the manual
page, either.

(cherry picked from commit 2b54cbce2c363ab6ae89d10657d7465858116d7a)
(cherry picked from commit 42a496388d00a6eb781e0b1c6754ae1f38790531)

8 years agonss_db: Propagate ERANGE error if parse_line fails [BZ #19837]
Florian Weimer [Tue, 29 Mar 2016 09:27:32 +0000 (11:27 +0200)] 
nss_db: Propagate ERANGE error if parse_line fails [BZ #19837]

Reproducer (needs to run as root):

perl -e \
  'print "large:x:999:" . join(",", map {"user$_"} (1 .. 135))."\n"' \
  >> /etc/group
cd /var/db
make
getent -s db group

After the fix, the last command should list the "large" group.

The magic number 135 has been chosen so that the line is shorter than
1024 bytes, but the pointers required to encode the member array will
cross the threshold, triggering the bug.

(cherry picked from commit a6033052d08027f745867e5e346852da1959226c)
(cherry picked from commit 28a87e027450b66faf1a431fc62779297c760e29)

8 years agoSuppress GCC 6 warning about ambiguous 'else' with -Wparentheses
Yvan Roux [Fri, 15 Apr 2016 11:29:26 +0000 (13:29 +0200)] 
Suppress GCC 6 warning about ambiguous 'else' with -Wparentheses

(cherry picked from commit df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c)
(cherry picked from commit 5769d5d17cdb4770f1e08167b76c1684ad4e1f73)

8 years agomath: don't clobber old libm.so on install [BZ #19822]
Dylan Alex Simon [Tue, 15 Mar 2016 17:20:01 +0000 (13:20 -0400)] 
math: don't clobber old libm.so on install [BZ #19822]

When installing glibc (w/mathvec enabled) in-place on a system with
a glibc w/out mathvec enabled, the install will clobber the existing
libm.so (e.g., /lib64/libm-2.21.so) with a linker script.  This is
because libm.so is a symlink to libm.so.6 which is a symlink to the
final libm-2.21.so file.  When the makefile writes the linker script
directly to libm.so, it gets clobbered.

The simple patch below to math/Makefile fixes this.  It is based on
the nptl Makefile, which does exactly the same thing in a safer way.

(cherry picked from commit f9378ac3773ffe998a2b3406568778ee9f77f759)
(cherry picked from commit 73f158cef52f3968e0b9a7785638cf1737c35306)

8 years agoRevert "sys/types.h: drop sys/sysmacros.h include"
Mike Frysinger [Sat, 12 Nov 2016 05:44:04 +0000 (00:44 -0500)] 
Revert "sys/types.h: drop sys/sysmacros.h include"

This reverts commit 1053a4902ebff0ba30098fdcad614d963de87c3d.

We'll carry this change in the dev version but drop it for stable.

9 years agoconfigure: fix `test ==` usage
Mike Frysinger [Sun, 10 Apr 2016 00:02:48 +0000 (20:02 -0400)] 
configure: fix `test ==` usage

POSIX defines the = operator, but not ==.  Fix the few places where we
incorrectly used ==.

(cherry picked from commit b2d4456b333970ab4cb01ed8045b9a8d2c4832f3)
(cherry picked from commit f1e182acaaa84e844eb96462a92ba532e1c1fff4)

9 years agoCVE-2016-3075: Stack overflow in _nss_dns_getnetbyname_r [BZ #19879]
Florian Weimer [Tue, 29 Mar 2016 10:57:56 +0000 (12:57 +0200)] 
CVE-2016-3075: Stack overflow in _nss_dns_getnetbyname_r [BZ #19879]

The defensive copy is not needed because the name may not alias the
output buffer.

(cherry picked from commit 317b199b4aff8cfa27f2302ab404d2bb5032b9a4)
(cherry picked from commit 883dceebc8f11921a9890211a4e202e5be17562f)
(cherry picked from commit 146b58d11fddbef15b888906e3be4f33900c416f)

9 years agoS390: Extend structs La_s390_regs / La_s390_retval with vector-registers.
Stefan Liebler [Fri, 1 Apr 2016 12:11:10 +0000 (14:11 +0200)] 
S390: Extend structs La_s390_regs / La_s390_retval with vector-registers.

Starting with z13, vector registers can also occur as argument registers.
Thus the passed input/output register structs for
la_s390_[32|64]_gnu_plt[enter|exit] functions should reflect those new
registers. This patch extends these structs La_s390_regs and La_s390_retval
and adjusts _dl_runtime_profile() to handle those fields in case of
running on a z13 machine.

(picked from upstream commit 5cdd1989d1d2f135d02e66250f37ba8e767f9772)

ChangeLog:

* sysdeps/s390/bits/link.h: (La_s390_vr) New typedef.
(La_s390_32_regs): Append vector register lr_v24-lr_v31.
(La_s390_64_regs): Likewise.
(La_s390_32_retval): Append vector register lrv_v24.
(La_s390_64_retval): Likeweise.
* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
Handle extended structs La_s390_32_regs and La_s390_32_retval.
* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
Handle extended structs La_s390_64_regs and La_s390_64_retval.

(cherry picked from commit 0eb234232eaf925fe4dca3bd60a3e1b4a7ab2882)

9 years agoS390: Save and restore fprs/vrs while resolving symbols.
Stefan Liebler [Fri, 1 Apr 2016 12:11:10 +0000 (14:11 +0200)] 
S390: Save and restore fprs/vrs while resolving symbols.

On s390, no fpr/vrs were saved while resolving a symbol
via _dl_runtime_resolve/_dl_runtime_profile.

According to the abi, the fpr-arguments are defined as call clobbered.
In leaf-functions, gcc 4.9 and newer can use fprs for saving/restoring gprs
instead of saving them to the stack.
If gcc do this in one of the resolver-functions, then the floating point
arguments of a library-function are invalid for the first library-function-call.
Thus, this patch saves/restores the fprs around the resolving code.

The same could occur for vector registers. Furthermore an ifunc-resolver
could also clobber the vector/floating point argument registers.
Thus this patch provides the further variants _dl_runtime_resolve_vx/
_dl_runtime_profile_vx, which are used if the kernel claims, that
we run on a machine with vector registers.

Furthermore, if _dl_runtime_profile calls _dl_call_pltexit,
the pointers to inregs-/outregs-structs were setup invalid.
Now they point to the correct location in the stack-frame.
Before branching back to the caller, the return values are now
restored instead of containing the return values of the
_dl_call_pltexit() call.
On s390-32, an endless loop occurs if _dl_call_pltexit() should be called.
Now, this code-path branches to this function instead of just after the
preceding basr-instruction.

(Picked from upstream commits 4603c51ef7989d7eb800cdd6f42aab206f891077
and d8a012c5c9e4bfc1b8db2bc6deacb85b44a2e1eb)

ChangeLog:

* sysdeps/s390/s390-32/dl-trampoline.S: Include dl-trampoline.h twice
to create a non-vector/vector version for _dl_runtime_resolve and
_dl_runtime_profile. Move implementation to ...
* sysdeps/s390/s390-32/dl-trampoline.h: ... here.
(_dl_runtime_resolve) Save and restore fpr/vrs.
(_dl_runtime_profile) Save and restore vrs and fix some issues
if _dl_call_pltexit is called.
* sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup):
Choose the correct resolver function if running on a machine with vx.
* sysdeps/s390/s390-64/dl-trampoline.S: Include dl-trampoline.h twice
to create a non-vector/vector version for _dl_runtime_resolve and
_dl_runtime_profile. Move implementation to ...
* sysdeps/s390/s390-64/dl-trampoline.h: ... here.
(_dl_runtime_resolve) Save and restore fpr/vrs.
(_dl_runtime_profile) Save and restore vrs and fix some issues
* sysdeps/s390/s390-64/dl-machine.h: (elf_machine_runtime_setup):
Choose the correct resolver function if running on a machine with vx.

(cherry picked from commit d93f04543c68c461bd90294751f5fa532a24680c)

9 years agoresolv: Always set *resplen2 out parameter in send_dg [BZ #19791]
Florian Weimer [Fri, 25 Mar 2016 10:49:51 +0000 (11:49 +0100)] 
resolv: Always set *resplen2 out parameter in send_dg [BZ #19791]

Since commit 44d20bca52ace85850012b0ead37b360e3ecd96e (Implement
second fallback mode for DNS requests), there is a code path which
returns early, before *resplen2 is initialized.  This happens if the
name server address is immediately recognized as invalid (because of
lack of protocol support, or if it is a broadcast address such
255.255.255.255, or another invalid address).

If this happens and *resplen2 was non-zero (which is the case if a
previous query resulted in a failure), __libc_res_nquery would reuse
an existing second answer buffer.  This answer has been previously
identified as unusable (for example, it could be an NXDOMAIN
response).  Due to the presence of a second answer, no name server
switching will occur.  The result is a name resolution failure,
although a successful resolution would have been possible if name
servers have been switched and queries had proceeded along the search
path.

The above paragraph still simplifies the situation.  Before glibc
2.23, if the second answer needed malloc, the stub resolver would
still attempt to reuse the second answer, but this is not possible
because __libc_res_nsearch has freed it, after the unsuccessful call
to __libc_res_nquerydomain, and set the buffer pointer to NULL.  This
eventually leads to an assertion failure in __libc_res_nquery:

/* Make sure both hp and hp2 are defined */
assert((hp != NULL) && (hp2 != NULL));

If assertions are disabled, the consequence is a NULL pointer
dereference on the next line.

Starting with glibc 2.23, as a result of commit
e9db92d3acfe1822d56d11abcea5bfc4c41cf6ca (CVE-2015-7547: getaddrinfo()
stack-based buffer overflow (Bug 18665)), the second answer is always
allocated with malloc.  This means that the assertion failure happens
with small responses as well because there is no buffer to reuse, as
soon as there is a name resolution failure which triggers a search for
an answer along the search path.

This commit addresses the issue by ensuring that *resplen2 is
initialized before the send_dg function returns.

This commit also addresses a bug where an invalid second reply is
incorrectly returned as a valid to the caller.

(cherry picked from commit b66d837bb5398795c6b0f651bd5a5d66091d8577)
(cherry picked from commit 3a188eb4e641d2df0cfd352fd09232347f28fbe1)

9 years agoFix resource leak in resolver (bug 19257)
Andreas Schwab [Wed, 18 Nov 2015 14:45:59 +0000 (15:45 +0100)] 
Fix resource leak in resolver (bug 19257)

The number of currently defined nameservers is stored in ->nscount,
whereas ->_u._ext.nscount is set by __libc_res_nsend only after local
initializations.

(cherry picked from commit 5e7fdabd7df1fc6c56d104e61390bf5a6b526c38)
(cherry picked from commit 317da342ba4417c30d985f5593d78bb1364a62c3)

9 years agoOr bit_Prefer_MAP_32BIT_EXEC in EXTRA_LD_ENVVARS
H.J. Lu [Thu, 3 Mar 2016 22:51:40 +0000 (14:51 -0800)] 
Or bit_Prefer_MAP_32BIT_EXEC in EXTRA_LD_ENVVARS

We should turn on bit_Prefer_MAP_32BIT_EXEC in EXTRA_LD_ENVVARS without
overriding other bits.

[BZ #19758]
* sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
(EXTRA_LD_ENVVARS): Or bit_Prefer_MAP_32BIT_EXEC.

(cherry picked from commit 33ab2ad58eba55de05a05f4adb795e1c172024bb)

9 years agoDefine _HAVE_STRING_ARCH_mempcpy to 1 for x86
H.J. Lu [Tue, 8 Mar 2016 18:57:31 +0000 (10:57 -0800)] 
Define _HAVE_STRING_ARCH_mempcpy to 1 for x86

Since x86 has an optimized mempcpy and GCC can inline mempcpy on x86,
define _HAVE_STRING_ARCH_mempcpy to 1 for x86.

[BZ #19759]
* sysdeps/x86/bits/string.h (_HAVE_STRING_ARCH_mempcpy): New.

(cherry picked from commit 2b35e48c0c547b3f6f81996ce7ad7d67e24c7329)
(cherry picked from commit b4456470a64a1e4e466a98dca3b51bf63fb5a13c)

9 years agoUse HAS_ARCH_FEATURE with Fast_Rep_String
H.J. Lu [Sun, 6 Mar 2016 16:23:24 +0000 (08:23 -0800)] 
Use HAS_ARCH_FEATURE with Fast_Rep_String

HAS_ARCH_FEATURE, not HAS_CPU_FEATURE, should be used with
Fast_Rep_String.

[BZ #19762]
* sysdeps/i386/i686/multiarch/bcopy.S (bcopy): Use
HAS_ARCH_FEATURE with Fast_Rep_String.
* sysdeps/i386/i686/multiarch/bzero.S (__bzero): Likewise.
* sysdeps/i386/i686/multiarch/memcpy.S (memcpy): Likewise.
* sysdeps/i386/i686/multiarch/memcpy_chk.S (__memcpy_chk):
Likewise.
* sysdeps/i386/i686/multiarch/memmove_chk.S (__memmove_chk):
Likewise.
* sysdeps/i386/i686/multiarch/mempcpy.S (__mempcpy): Likewise.
* sysdeps/i386/i686/multiarch/mempcpy_chk.S (__mempcpy_chk):
Likewise.
* sysdeps/i386/i686/multiarch/memset.S (memset): Likewise.
* sysdeps/i386/i686/multiarch/memset_chk.S (__memset_chk):
Likewise.

(cherry picked from commit 4e940b2f4b577f3a530e0580373f7c2d569f4d63)
(cherry picked from commit 0594fd054623b0ac4c481582ab3664a74aadbf69)

9 years agomips: terminate the FDE before the return trampoline in makecontext
Aurelien Jarno [Tue, 8 Mar 2016 23:25:00 +0000 (00:25 +0100)] 
mips: terminate the FDE before the return trampoline in makecontext

In makecontext the FDE needs to be terminated before the return
trampoline otherwise backtrace called within a context created by
makecontext yields infinite backtrace.

This bug has been present for a long time, stdlib/tst-makecontext did
not fail until recent commit e535ce25. Tested on mips-linux-gnu and
mips64el-linux-gnuabi64 and mips-linux-gnu, no regression.

This fixes stdlib/tst-makecontext on MIPS.

Changelog:
[BZ #19792]
* sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
Terminate FDE before return label.

(cherry picked from commit f8e9c4d30c28b8815e65a391416e8b15d2e7cbb8)
(cherry picked from commit 63ed4db4b45cab21cf6f68aac7b9fce2f770fe74)

9 years agoAdd sys/auxv.h wrapper to include/sys/
Aurelien Jarno [Tue, 8 Mar 2016 14:16:40 +0000 (15:16 +0100)] 
Add sys/auxv.h wrapper to include/sys/

The GNU libc testsuite fails to build on powerpc/ppc64/ppc64le with the
following error:

    ../sysdeps/powerpc/test-get_hwcap.c:26:22: fatal error: sys/auxv.h: No such file or director

This is because test-get_hwcap.c includes <sys/auxv.h>, but we don't
provide a wrapper in include/sys. This patch adds one.

Changelog:
* include/sys/auxv.h: New file.

(cherry picked from commit 0b8dedd38f304d796b6b9b349428bea7f1f7065f)
(cherry picked from commit 9d1399e89d431b34a5a6e5e48ee40721c22815b8)

9 years agosln: use stat64
Hongjiu Zhang [Mon, 7 Mar 2016 01:18:21 +0000 (20:18 -0500)] 
sln: use stat64

When using sln on some filesystems which return 64-bit inodes,
the stat call might fail during install like so:
.../elf/sln .../elf/symlink.list
/lib32/libc.so.6: invalid destination: Value too large for defined data type
/lib32/ld-linux.so.2: invalid destination: Value too large for defined data type
Makefile:104: recipe for target 'install-symbolic-link' failed

Switch to using stat64 all the time to avoid this.

URL: https://bugs.gentoo.org/576396
(cherry picked from commit f5e753c8c3a18a1e3c715dd11bf4dc341b5c481f)
(cherry picked from commit f23d7d2a8420a5ba2e28fc9c1d9c2b2996498d46)

9 years agoDon't use long double math functions if NO_LONG_DOUBLE
Andreas Schwab [Tue, 23 Feb 2016 15:27:56 +0000 (16:27 +0100)] 
Don't use long double math functions if NO_LONG_DOUBLE

(cherry picked from commit 591b7e37e6be2a2d6672b683ba1191095b10d6d5)

9 years ago[x86_64] Set DL_RUNTIME_UNALIGNED_VEC_SIZE to 8
H.J. Lu [Mon, 22 Feb 2016 17:32:57 +0000 (09:32 -0800)] 
[x86_64] Set DL_RUNTIME_UNALIGNED_VEC_SIZE to 8

Due to GCC bug:

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

__tls_get_addr may be called with 8-byte stack alignment.  Although
this bug has been fixed in GCC 4.9.4, 5.3 and 6, we can't assume
that stack will be always aligned at 16 bytes.  Since SSE optimized
memory/string functions with aligned SSE register load and store are
used in the dynamic linker, we must set DL_RUNTIME_UNALIGNED_VEC_SIZE
to 8 so that _dl_runtime_resolve_sse will align the stack before
calling _dl_fixup:

Dump of assembler code for function _dl_runtime_resolve_sse:
   0x00007ffff7deea90 <+0>: push   %rbx
   0x00007ffff7deea91 <+1>: mov    %rsp,%rbx
   0x00007ffff7deea94 <+4>: and    $0xfffffffffffffff0,%rsp
                                ^^^^^^^^^^^ Align stack to 16 bytes
   0x00007ffff7deea98 <+8>: sub    $0x100,%rsp
   0x00007ffff7deea9f <+15>: mov    %rax,0xc0(%rsp)
   0x00007ffff7deeaa7 <+23>: mov    %rcx,0xc8(%rsp)
   0x00007ffff7deeaaf <+31>: mov    %rdx,0xd0(%rsp)
   0x00007ffff7deeab7 <+39>: mov    %rsi,0xd8(%rsp)
   0x00007ffff7deeabf <+47>: mov    %rdi,0xe0(%rsp)
   0x00007ffff7deeac7 <+55>: mov    %r8,0xe8(%rsp)
   0x00007ffff7deeacf <+63>: mov    %r9,0xf0(%rsp)
   0x00007ffff7deead7 <+71>: movaps %xmm0,(%rsp)
   0x00007ffff7deeadb <+75>: movaps %xmm1,0x10(%rsp)
   0x00007ffff7deeae0 <+80>: movaps %xmm2,0x20(%rsp)
   0x00007ffff7deeae5 <+85>: movaps %xmm3,0x30(%rsp)
   0x00007ffff7deeaea <+90>: movaps %xmm4,0x40(%rsp)
   0x00007ffff7deeaef <+95>: movaps %xmm5,0x50(%rsp)
   0x00007ffff7deeaf4 <+100>: movaps %xmm6,0x60(%rsp)
   0x00007ffff7deeaf9 <+105>: movaps %xmm7,0x70(%rsp)

[BZ #19679]
* sysdeps/x86_64/dl-trampoline.S (DL_RUNIME_UNALIGNED_VEC_SIZE):
Renamed to ...
(DL_RUNTIME_UNALIGNED_VEC_SIZE): This.  Set to 8.
(DL_RUNIME_RESOLVE_REALIGN_STACK): Renamed to ...
(DL_RUNTIME_RESOLVE_REALIGN_STACK): This.  Updated.
(DL_RUNIME_RESOLVE_REALIGN_STACK): Renamed to ...
(DL_RUNTIME_RESOLVE_REALIGN_STACK): This.
* sysdeps/x86_64/dl-trampoline.h
(DL_RUNIME_RESOLVE_REALIGN_STACK): Renamed to ...
(DL_RUNTIME_RESOLVE_REALIGN_STACK): This.

(cherry picked from commit 6094fc2cf7eab30889df0416a5c051a5e7171895)

9 years agosys/types.h: drop sys/sysmacros.h include
Mike Frysinger [Tue, 29 Dec 2015 22:54:31 +0000 (17:54 -0500)] 
sys/types.h: drop sys/sysmacros.h include

We want to break apart this include path due to namespace pollution.
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html

9 years agogentoo: support running tests under sandbox
Stephanie J. Lockwood-Childs [Tue, 13 Mar 2007 05:57:21 +0000 (01:57 -0400)] 
gentoo: support running tests under sandbox

when glibc runs its tests, it does so by invoking the local library loader.
in Gentoo, we build/run inside of our "sandbox" which itself is linked against
libdl (so that it can load libraries and pull out symbols).  the trouble
is that when you upgrade from an older glibc to the new one, often times
internal symbols change name or abi.  this is normally OK as you cannot use
libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
we always say "keep all of the glibc libraries from the same build".  but
when glibc runs its tests, it uses dynamic paths to point to its new local
copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
its path, and when sandbox triggers the loading of libdl, glibc does so
from the host system system.  this gets us into the case of all libraries
are from the locally compiled version of glibc except for libdl.so.

http://bugs.gentoo.org/56898

9 years agortld: do not ignore arch-specific CFLAGS
Carlos O'Donell [Tue, 8 Jan 2013 16:47:12 +0000 (11:47 -0500)] 
rtld: do not ignore arch-specific CFLAGS

https://bugs.gentoo.org/452184
http://sourceware.org/bugzilla/show_bug.cgi?id=15005
http://sourceware.org/ml/libc-alpha/2013-01/msg00247.html

9 years agonptl: support thread stacks that grow up
Carlos O'Donell [Fri, 16 Aug 2013 18:57:59 +0000 (14:57 -0400)] 
nptl: support thread stacks that grow up

http://bugs.gentoo.org/301642

9 years agoreload /etc/resolv.conf when it has changed
Thorsten Kukuk [Sun, 27 May 2007 18:44:22 +0000 (14:44 -0400)] 
reload /etc/resolv.conf when it has changed

if /etc/resolv.conf is updated, then make sure applications
already running get the updated information.

ripped from SuSE

http://bugs.gentoo.org/177416

9 years agodisable ldconfig during install
Mike Frysinger [Wed, 1 Apr 2009 06:15:48 +0000 (02:15 -0400)] 
disable ldconfig during install

Do not bother running ldconfig on DESTDIR.  It's a waste of time as we
won't use the result (portage will rebuild the cache after install).
Also, the Gentoo sandbox does not currently catch chroot() behavior so
we end up (incorrectly) flagging it as a violation as a write to /etc.

http://sourceware.org/ml/libc-alpha/2012-08/msg00118.html
https://bugs.gentoo.org/431038

9 years agoRegenerated configure scripts.
Adhemerval Zanella [Thu, 18 Feb 2016 20:31:04 +0000 (18:31 -0200)] 
Regenerated configure scripts.

9 years agoRegenerate libc.pot for 2.23.
Adhemerval Zanella [Thu, 18 Feb 2016 19:27:26 +0000 (17:27 -0200)] 
Regenerate libc.pot for 2.23.

9 years agoUpdated translations for 2.23.
Adhemerval Zanella [Thu, 18 Feb 2016 19:23:47 +0000 (17:23 -0200)] 
Updated translations for 2.23.

Cherry-pick from 31ef23afe2fc94ff2a3ec61f2e76ca973ae09cbd.

9 years agoUpdate version.h and include/features.h for 2.23 release glibc-2.23
Adhemerval Zanella [Thu, 18 Feb 2016 17:54:00 +0000 (15:54 -0200)] 
Update version.h and include/features.h for 2.23 release

9 years agoUpdate NEWS with fixed bugs for 2.23 release
Adhemerval Zanella [Thu, 18 Feb 2016 17:51:45 +0000 (15:51 -0200)] 
Update NEWS with fixed bugs for 2.23 release

9 years agoAdd _STRING_INLINE_unaligned and string_private.h
H.J. Lu [Thu, 18 Feb 2016 13:00:33 +0000 (11:00 -0200)] 
Add _STRING_INLINE_unaligned and string_private.h

As discussed in

https://sourceware.org/ml/libc-alpha/2015-10/msg00403.html

the setting of _STRING_ARCH_unaligned currently controls the external
GLIBC ABI as well as selecting the use of unaligned accesses withing
GLIBC.

Since _STRING_ARCH_unaligned was recently changed for AArch64, this
would potentially break the ABI in GLIBC 2.23, so split the uses and add
_STRING_INLINE_unaligned to select the string ABI. This setting must be
fixed for each target, while _STRING_ARCH_unaligned may be changed from
release to release.  _STRING_ARCH_unaligned is used unconditionally in
glibc.  But <bits/string.h>, which defines _STRING_ARCH_unaligned, isn't
included with -Os.  Since _STRING_ARCH_unaligned is internal to glibc and
may change between glibc releases, it should be made private to glibc.
_STRING_ARCH_unaligned should defined in the new string_private.h heade
file which is included unconditionally from internal <string.h> for glibc
build.

[BZ #19462]
* bits/string.h (_STRING_ARCH_unaligned): Renamed to ...
(_STRING_INLINE_unaligned): This.
* include/string.h: Include <string_private.h>.
* string/bits/string2.h: Replace _STRING_ARCH_unaligned with
_STRING_INLINE_unaligned.
* sysdeps/aarch64/bits/string.h (_STRING_ARCH_unaligned): Removed.
(_STRING_INLINE_unaligned): New.
* sysdeps/aarch64/string_private.h: New file.
* sysdeps/generic/string_private.h: Likewise.
* sysdeps/m68k/m680x0/m68020/string_private.h: Likewise.
* sysdeps/s390/string_private.h: Likewise.
* sysdeps/x86/string_private.h: Likewise.
* sysdeps/m68k/m680x0/m68020/bits/string.h
(_STRING_ARCH_unaligned): Renamed to ...
(_STRING_INLINE_unaligned): This.
* sysdeps/s390/bits/string.h (_STRING_ARCH_unaligned): Renamed
to ...
(_STRING_INLINE_unaligned): This.
* sysdeps/sparc/bits/string.h (_STRING_ARCH_unaligned): Renamed
to ...
(_STRING_INLINE_unaligned): This.
* sysdeps/x86/bits/string.h (_STRING_ARCH_unaligned): Renamed
to ...
(_STRING_INLINE_unaligned): This.

9 years agoNEWS: List additional fixed security bugs
Florian Weimer [Thu, 18 Feb 2016 14:10:11 +0000 (15:10 +0100)] 
NEWS: List additional fixed security bugs

9 years agoUse PIC relocation in ALIAS_IMPL
Andrew Senkevich [Wed, 17 Feb 2016 22:23:32 +0000 (14:23 -0800)] 
Use PIC relocation in ALIAS_IMPL

Since libmvec_nonshared.a may be linked into shared objects, ALIAS_IMPL
should use PIC relocation.

[BZ #19590]
* sysdeps/x86_64/fpu/svml_finite_alias.S (ALIAS_IMPL): Use PIC
relocation.

9 years agoCVE-2015-7547: getaddrinfo() stack-based buffer overflow (Bug 18665).
Carlos O'Donell [Wed, 17 Feb 2016 02:26:37 +0000 (21:26 -0500)] 
CVE-2015-7547: getaddrinfo() stack-based buffer overflow (Bug 18665).

* A stack-based buffer overflow was found in libresolv when invoked from
  libnss_dns, allowing specially crafted DNS responses to seize control
  of execution flow in the DNS client.  The buffer overflow occurs in
  the functions send_dg (send datagram) and send_vc (send TCP) for the
  NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
  family.  The use of AF_UNSPEC triggers the low-level resolver code to
  send out two parallel queries for A and AAAA.  A mismanagement of the
  buffers used for those queries could result in the response of a query
  writing beyond the alloca allocated buffer created by
  _nss_dns_gethostbyname4_r.  Buffer management is simplified to remove
  the overflow.  Thanks to the Google Security Team and Red Hat for
  reporting the security impact of this issue, and Robert Holiday of
  Ciena for reporting the related bug 18665. (CVE-2015-7547)

See also:
https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html
https://sourceware.org/ml/libc-alpha/2016-02/msg00418.html

9 years agoUpdate INSTALL with latest versions tested to work.
Carlos O'Donell [Mon, 15 Feb 2016 01:54:29 +0000 (20:54 -0500)] 
Update INSTALL with latest versions tested to work.

9 years agoEnsure isinff, isinfl, isnanf, and isnanl are defined (Bug 19439)
Carlos O'Donell [Mon, 15 Feb 2016 00:27:06 +0000 (19:27 -0500)] 
Ensure isinff, isinfl, isnanf, and isnanl are defined (Bug 19439)

In ICO C++11 mode ensure that isinff, isinfl, isnanf, and isnanl
are defined.  These functions were accidentally removed from the
header as part of commit d9b965fa56350d6eea9f7f438a0714c7ffbb183f,
but being GNU extensions, they should have been left in place.

9 years agoRevert "ChangeLogs: convert to utf-8"
Mike Frysinger [Fri, 12 Feb 2016 21:34:16 +0000 (16:34 -0500)] 
Revert "ChangeLogs: convert to utf-8"

This reverts commit d2bb040b2a2f58b1ef80f01292bd722fce01d36a.

It seems some files (like tst-regex) directly parse these and rely on
some of its content *not* being UTF-8.  Until we can fix thoses tests
(and isolate them from ChangeLog updates), back out this change.

It also shouldn't really have landed during the freeze.

9 years agohsearch_r: Apply VM size limit in test case
Florian Weimer [Fri, 12 Feb 2016 11:57:40 +0000 (12:57 +0100)] 
hsearch_r: Apply VM size limit in test case

9 years ago[ARM] add missing -funwind-tables to test case (bug 19529)
Szabolcs Nagy [Thu, 11 Feb 2016 17:17:38 +0000 (17:17 +0000)] 
[ARM] add missing -funwind-tables to test case (bug 19529)

stdlib/tst-makecontext test failed on arm because it used backtrace
without -funwind-tables.

9 years agoChangeLogs: convert to utf-8
Paul Eggert [Fri, 22 May 2015 21:42:12 +0000 (14:42 -0700)] 
ChangeLogs: convert to utf-8

9 years agolocaledata: convert all files to utf-8
Mike Frysinger [Mon, 8 Feb 2016 22:17:23 +0000 (17:17 -0500)] 
localedata: convert all files to utf-8

The comments were using various encodings like ISO-8859-1.
Convert them all over to UTF-8.

9 years agopowerpc: Regenerate libm-test-ulps
Rajalakshmi Srinivasaraghavan [Thu, 28 Jan 2016 07:26:59 +0000 (01:26 -0600)] 
powerpc: Regenerate libm-test-ulps

9 years agoFix MIPS mmap negative offset handling for consistency (bug 19550).
Joseph Myers [Mon, 1 Feb 2016 18:20:21 +0000 (18:20 +0000)] 
Fix MIPS mmap negative offset handling for consistency (bug 19550).

The handling of negative offsets in MIPS mmap is inconsistent with
other architectures, as shown by failure of the test
posix/tst-mmap-offset for o32 and n32.  The MIPS mmap syscall uses a
signed argument and does a signed arithmetic shift on it, whereas the
glibc semantics expected by that test are for the offset to be
considered as a large positive offset.  This patch makes MIPS
consistent with other architectures as far as possible by using the
mmap2 syscall on o32 (#including the generic implementation), and
making mmap not an alias for mmap64 for n32, with a custom
implementation for n32 that zero-extends the offset argument to 64-bit
before calling the mmap syscall.

Tested for MIPS64 (o32, n32, n64).

[BZ #19550]
* sysdeps/unix/sysv/linux/mips/mips32/mmap.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/mmap64.c: Move to ....
* sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c: ... here.
* sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (mmap64):
New syscall entry.
* sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list (mmap):
New syscall entry.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (mmap): Remove
syscall entry.

9 years agoRevert "elf/elf.h: Add new 386 and X86_64 relocations from binutils."
Mark Wielaard [Sun, 31 Jan 2016 17:34:27 +0000 (18:34 +0100)] 
Revert "elf/elf.h: Add new 386 and X86_64 relocations from binutils."

This reverts commit 3da75f08818fa3d217e5d566477c7001cb774792.

glibc 2.23 hard freeze doesn't allow this change at this time.

9 years agoelf/elf.h: Add new 386 and X86_64 relocations from binutils.
Mark Wielaard [Fri, 29 Jan 2016 08:49:01 +0000 (09:49 +0100)] 
elf/elf.h: Add new 386 and X86_64 relocations from binutils.

The following new 386 and X86_64 were added to binutils. They are
non-dynamic relocations, so don't need direct handling in glibc.
But other programs, like elfutils, use the glibc elf.h definitions
for the names and numbers when inspecting ET_REL files.

R_386_GOT32X was proposed in
https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I

X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX were proposed in
https://groups.google.com/forum/#!topic/x86-64-abi/n9AWHogmVY0

There also used to be R_X86_64_PC32_BND and R_X86_64_PLT32_BND
but those already got deprecated in
https://groups.google.com/d/msg/x86-64-abi/-hdQyMixt8Y/XFDOvioG85cJ

* elf/elf.h (R_386_GOT32X): New.
(R_386_NUM): Update.
(R_X86_64_GOTPCRELX: New.
(R_X86_64_REX_GOTPCRELX): New.
(R_X86_64_NUM): Update.

9 years agoImprove check against integer wraparound in hcreate_r [BZ #18240]
Florian Weimer [Thu, 28 Jan 2016 12:59:11 +0000 (13:59 +0100)] 
Improve check against integer wraparound in hcreate_r [BZ #18240]

9 years agoFix MIPS64 memcpy regression.
Steve Ellcey [Thu, 28 Jan 2016 01:52:05 +0000 (01:52 +0000)] 
Fix MIPS64 memcpy regression.

The MIPS memcpy optimizations at
<https://sourceware.org/ml/libc-alpha/2015-10/msg00597.html>
introduced a bug causing many string function tests to fail with
segfaults for n32 and n64:

FAIL: string/stratcliff
FAIL: string/test-bcopy
FAIL: string/test-memccpy
FAIL: string/test-memcmp
FAIL: string/test-memcpy
FAIL: string/test-memmove
FAIL: string/test-mempcpy
FAIL: string/test-stpncpy
FAIL: string/test-strncmp
FAIL: string/test-strncpy

(Some failures in other directories could also be caused by this bug.)

The problem is that after the check for whether a word of input is
left that can be copied as a word before moving to byte copies, a load
can occur in the branch delay slot, resulting in a segfault if we are
at the end of a page and the following page is unmapped.  I don't see
how this would have passed the tests as reported in the original patch
posting (different kernel configurations affecting the code setting up
unmapped pages, maybe?), since the tests in question don't appear to
have changed recently.

This patch moves a later instruction into the delay slot, as suggested
at <https://sourceware.org/ml/libc-alpha/2016-01/msg00584.html>.

Tested for n32 and n64.

2016-01-28  Steve Ellcey  <sellcey@imgtec.com>
            Joseph Myers  <joseph@codesourcery.com>

* sysdeps/mips/memcpy.S (MEMCPY_NAME) [USE_DOUBLE]: Avoid word
load in branch delay slot when less than a word of input left.

9 years agoRemove unused variables
Andreas Schwab [Mon, 25 Jan 2016 16:07:07 +0000 (17:07 +0100)] 
Remove unused variables

They are flagged by -Wunused-const-variable.

9 years agoUpdate localplt.data for 32-bit sparc.
David S. Miller [Wed, 27 Jan 2016 00:16:38 +0000 (16:16 -0800)] 
Update localplt.data for 32-bit sparc.

* sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data: Add _Q_cmp.

9 years agoDefine __sqrtl_finite on sparc 32-bit with correct symbol version.
David S. Miller [Tue, 26 Jan 2016 00:07:15 +0000 (16:07 -0800)] 
Define __sqrtl_finite on sparc 32-bit with correct symbol version.

* sysdeps/sparc/sparc32/Versions (GLIBC_2.23): Add entry for __sqrtl_finite.
* sysdeps/sparc/sparc32/fpu/e_sqrtl.c (__sqrtl_finite): Define instead using
versioned_symbol.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Fix ordering of entries.

9 years agoAdjust sparc 32-bit __sqrtl_finite version tag.
David S. Miller [Mon, 25 Jan 2016 18:41:05 +0000 (10:41 -0800)] 
Adjust sparc 32-bit __sqrtl_finite version tag.

* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Move
__sqrtl_finite to GLIBC_2.23

9 years agoUpdate Alpha libm-test-ulps
Richard Henderson [Mon, 25 Jan 2016 18:43:41 +0000 (10:43 -0800)] 
Update Alpha libm-test-ulps

9 years agoDon't do lock elision on an error checking mutex (bug 17514)
Andreas Schwab [Wed, 13 Jan 2016 15:04:42 +0000 (16:04 +0100)] 
Don't do lock elision on an error checking mutex (bug 17514)

Error checking mutexes are not supposed to be subject to lock elision.
That would defeat the error checking nature of the mutex because lock
elision doesn't record ownership.

9 years agoCleanup ppc bits/ipc.h
Paul E. Murphy [Tue, 19 Jan 2016 17:05:41 +0000 (11:05 -0600)] 
Cleanup ppc bits/ipc.h

Ages ago (commit e9dcb08) the ipc syscalls were inlined and
eventually abstracted away any need for direct __ipc calls.

9 years agoS390: Fix build failure in test string/tst-endian.c with gcc 6.
Stefan Liebler [Mon, 25 Jan 2016 11:44:46 +0000 (12:44 +0100)] 
S390: Fix build failure in test string/tst-endian.c with gcc 6.

Building string/tst-endian.c with gcc 6 produces an build warning/error on s390 (big endian machine):
gcc tst-endian.c -c -std=gnu11 -fgnu89-inline  -O2 or -O3 ...
tst-endian.c: In function ‘do_test’:
tst-endian.c:16:30: error: self-comparison always evaluates to false [-Werror=tautological-compare]
    if (htobe16 (be16toh (i)) != i)
                              ^~
...

See definitions of htobexx, bexxtoh in string/endian.h:
...

This patch silences these warnings with DIAG_* macros if build with gcc 6
and newer.

The same warnings occur on little endian machines with the
"htoleXX (leXXtoh (i)) != i" if-statements.

ChangeLog:

* string/tst-endian.c: Include <libc-internal.h>.
(do_test): Ignore tautological-compare warnings around
"htobeXX (beXXtoh (i)) != i" and
"htoleXX (leXXtoh (i)) != i" if-statements.

9 years agoFix missing __sqrtl_finite symbol in libm on sparc 32-bit.
David S. Miller [Mon, 25 Jan 2016 05:14:12 +0000 (21:14 -0800)] 
Fix missing __sqrtl_finite symbol in libm on sparc 32-bit.

* sysdeps/sparc/sparc32/fpu/e_sqrtl.c: New file.
* sysdeps/sparc/sparc32/soft-fp/q_sqrt.c (__ieee754_sqrtl): Remove alias.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add __sqrtl_finite.

9 years agoUpdate sparc ULPS.
David S. Miller [Mon, 25 Jan 2016 05:12:58 +0000 (21:12 -0800)] 
Update sparc ULPS.

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

9 years agoMIPS: Set the required Linux kernel version to 4.5.0 for 2008 NaN
Maciej W. Rozycki [Mon, 25 Jan 2016 00:19:27 +0000 (00:19 +0000)] 
MIPS: Set the required Linux kernel version to 4.5.0 for 2008 NaN

Complement the addition of the required kernel support, present upstream
as from commit 2b5e869ecfcb3112f7e1267cb0328f3ff6d49b18 ("MIPS: ELF:
Interpret the NAN2008 file header flag") and released with Linux 4.5-rc1
on Jan 24th, 2016.

* sysdeps/unix/sysv/linux/mips/configure.ac: Set
`arch_minimum_kernel' to 4.5.0 if 2008 NaN encoding is used.
* sysdeps/unix/sysv/linux/mips/configure: Regenerate.

9 years agoFix nptl/tst-setuid3.c
Paul E. Murphy [Tue, 19 Jan 2016 19:42:44 +0000 (13:42 -0600)] 
Fix nptl/tst-setuid3.c

pthread_barrier_wait can return either PTHREAD_BARRIER_SERIAL_THREAD
or 0.  Posix makes no guarantees about which thread return the unique
value.

Additionally, pthread_join was not called despite seemingly checking
for the error.

9 years agopowerpc: Fix macro usage of htm builtins
Paul E. Murphy [Wed, 20 Jan 2016 16:33:19 +0000 (10:33 -0600)] 
powerpc: Fix macro usage of htm builtins

Some extraneous semicolons were included in a
recent patch which causes a build failure with
newer compilers.

9 years agoMaintainence patch for nios2: update ULPS file and localplt.data changes.
Chung-Lin Tang [Fri, 22 Jan 2016 06:58:03 +0000 (22:58 -0800)] 
Maintainence patch for nios2: update ULPS file and localplt.data changes.

9 years agoSilence some false positive warnings for gcc 4.7
Chris Metcalf [Wed, 20 Jan 2016 22:07:51 +0000 (17:07 -0500)] 
Silence some false positive warnings for gcc 4.7

9 years agoNaCl: Fix unused variable errors in lowlevellock-futex.h macros.
Roland McGrath [Wed, 20 Jan 2016 21:57:14 +0000 (13:57 -0800)] 
NaCl: Fix unused variable errors in lowlevellock-futex.h macros.

9 years ago2016-01-20 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul Pluzhnikov [Wed, 20 Jan 2016 21:39:20 +0000 (13:39 -0800)] 
2016-01-20  Paul Pluzhnikov  <ppluzhnikov@google.com>

[BZ #19490]
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S (pthread_cond_broadcast): Use ENTRY/END
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S (pthread_cond_signal): Likewise
* sysdeps/x86_64/nptl/pthread_spin_lock.S (pthread_spin_lock): Likewise
* sysdeps/x86_64/nptl/pthread_spin_trylock.S (pthread_spin_trylock): Likewise
* sysdeps/x86_64/nptl/pthread_spin_unlock.S (pthread_spin_unlock): Likewise

9 years agoFix __finitel libm compat symbol version.
Joseph Myers [Wed, 20 Jan 2016 19:04:43 +0000 (19:04 +0000)] 
Fix __finitel libm compat symbol version.

The changes to restrict implementation-namespace symbol aliases such
as __finitel to compat symbols used code for __finitel in libm
analogous to that for __finitel in libc.  However, the versions for
the two symbols are actually different, GLIBC_2.0 in libc and
GLIBC_2.1 in libm.  This patch fixes the handling of the libm compat
symbol.

Tested for mips (o32), where it fixes an ABI test failure.

* sysdeps/ieee754/dbl-64/s_finite.c
[NO_LONG_DOUBLE && LDBL_CLASSIFY_COMPAT] (__finitel): Define
compat symbol at version GLIBC_2_1 and use GLIBC_2_1 in
SHLIB_COMPAT condition for libm, not GLIBC_2_0.
* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
[NO_LONG_DOUBLE && LDBL_CLASSIFY_COMPAT] (__finitel): Likewise.

9 years agoUpdate localplt.data for powerpc-nofpu.
Joseph Myers [Wed, 20 Jan 2016 18:19:10 +0000 (18:19 +0000)] 
Update localplt.data for powerpc-nofpu.

Testing for powerpc-nofpu showed that localplt.data was out of date.
Two new soft-fp functions showed up in the list: __gtsf2 and
__unordsf2; this patch adds these as optional.  __signbit and
__signbitl no longer appear as local PLT entries; given the move to
__builtin_signbit* for all GCC versions supported for building glibc
(and given the use of the type-generic signbit macro within glibc),
those can safely be removed from the list, which this patch does.

Tested for powerpc-nofpu.

* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data
(__gtsf2): Add as optional for libc.so.
(__unordsf2): Likewise.
(__signbit): Remove for libc.so.
(__signbitl): Likewise.

9 years agoS390: Fix build error in iconvdata/bug-iconv11.c.
Stefan Liebler [Wed, 20 Jan 2016 07:32:37 +0000 (08:32 +0100)] 
S390: Fix build error in iconvdata/bug-iconv11.c.

This fixes the following build error on S390 31bit while building the test
iconvdata/bug-iconv11.c with gcc 5.3:
bug-iconv11.c: In function ‘test_ibm93x’:
bug-iconv11.c:59:11: error: format ‘%td’ expects argument of type ‘ptrdiff_t’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Werror=format=]
   printf ("  ==> %td: %s\n"
           ^
cc1: all warnings being treated as errors

This patch uses %zu format specifier for argument size_t ret instead of %td.

ChangeLog:

* iconvdata/bug-iconv11.c (test_ibm93x):
Use %zu printf format specifier for size_t argument.

9 years agoFix ulps regeneration for *-finite tests.
Joseph Myers [Tue, 19 Jan 2016 21:42:58 +0000 (21:42 +0000)] 
Fix ulps regeneration for *-finite tests.

On running tests after from-scratch ulps regeneration, I found that
some libm tests failed with ulps in excess of those recorded in the
from-scratch regeneration, which should never happen unless those ulps
exceed the limit on ulps that can go in libm-test-ulps files.

Failure: Test: atan2_upward (inf, -inf)
Result:
 is:          2.35619498e+00   0x1.2d97ccp+1
 should be:   2.35619450e+00   0x1.2d97c8p+1
 difference:  4.76837159e-07   0x1.000000p-21
 ulp       :  2.0000
 max.ulp   :  1.0000
Maximal error of `atan2_upward'
 is      : 2 ulp
 accepted: 1 ulp
Failure: Test: carg_upward (-inf + inf i)
Result:
 is:          2.35619498e+00   0x1.2d97ccp+1
 should be:   2.35619450e+00   0x1.2d97c8p+1
 difference:  4.76837159e-07   0x1.000000p-21
 ulp       :  2.0000
 max.ulp   :  1.0000
Maximal error of `carg_upward'
 is      : 2 ulp
 accepted: 1 ulp

The problem comes from the addition of tests for the finite-math-only
versions of libm functions.  Those tests share ulps with the default
function variants.  make regen-ulps runs the default tests before the
finite-math-only tests, concatenating the resulting ulps before
feeding them to gen-libm-test.pl to generate a new libm-test-ulps
file.  But gen-libm-test.pl always takes the last ulps value given for
any (function, type) pair.  So, if the largest ulps for a function
come from non-finite inputs, a from-scratch regeneration loses those
ulps.

This patch fixes gen-libm-test.pl, in the case where there are
multiple ulps values for a (function, type) pair - which can only
happen as part of a regeneration - to take the largest ulps value
rather than the last one.

Tested for ARM / MIPS / powerpc-nofpu.

* math/gen-libm-test.pl (parse_ulps): Do not reduce
already-recorded ulps.
* sysdeps/arm/libm-test-ulps: Regenerated.
* sysdeps/mips/mips32/libm-test-ulps: Likewise.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.
* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.

9 years agoFixed build with assembler w/o AVX-512 support.
Andrew Senkevich [Tue, 19 Jan 2016 11:34:53 +0000 (14:34 +0300)] 
Fixed build with assembler w/o AVX-512 support.

    * sysdeps/x86_64/multiarch/ifunc-impl-list.c: Fixed build with
    assembler not supporting AVX-512.

9 years agoS390: Regenerate ULPs
Stefan Liebler [Tue, 19 Jan 2016 09:00:52 +0000 (10:00 +0100)] 
S390: Regenerate ULPs

I've regenerated ulps from scratch for s390/s390x.
All math testcases are passing afterwards.

ChangeLog:

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

9 years agoRegenerate MIPS libm-test-ulps.
Joseph Myers [Mon, 18 Jan 2016 23:32:40 +0000 (23:32 +0000)] 
Regenerate MIPS libm-test-ulps.

* sysdeps/mips/mips32/libm-test-ulps: Regenerated.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.

9 years agoRegenerate powerpc-nofpu libm-test-ulps.
Joseph Myers [Mon, 18 Jan 2016 23:02:03 +0000 (23:02 +0000)] 
Regenerate powerpc-nofpu libm-test-ulps.

* sysdeps/powerpc/nofpu/libm-test-ulps: Regenerated.

9 years agoRegenerate ARM libm-test-ulps.
Joseph Myers [Mon, 18 Jan 2016 22:55:47 +0000 (22:55 +0000)] 
Regenerate ARM libm-test-ulps.

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

9 years ago[BZ #19451]
Paul Pluzhnikov [Mon, 18 Jan 2016 22:36:28 +0000 (14:36 -0800)] 
[BZ #19451]
* math/Makefile (libm-vec-tests): Move libraries after wrappers.o to fix
"make check" link failure on Ubuntu.

9 years agoS/390: Do not raise inexact exception in lrint/lround. [BZ #19486]
Stefan Liebler [Mon, 18 Jan 2016 11:48:06 +0000 (12:48 +0100)] 
S/390: Do not raise inexact exception in lrint/lround. [BZ #19486]

I get some math test-failures on s390 for float/double/ldouble for
various lrint/lround functions like:
lrint (0x1p64): Exception "Inexact" set
lrint (-0x1p64): Exception "Inexact" set
lround (0x1p64): Exception "Inexact" set
lround (-0x1p64): Exception "Inexact" set
...

GCC emits "convert to fixed" instructions for casting floating point
values to integer values. These instructions raise invalid and inexact
exceptions if the floating point value exceeds the integer type ranges.

This patch enables the various FIX_DBL_LONG_CONVERT_OVERFLOW macros in
order to avoid a cast from floating point to integer type and raise the
invalid exception with feraiseexcept.
The ldbl-128 rint/round functions are now using the same logic.

ChangeLog:

[BZ #19486]
* sysdeps/s390/fix-fp-int-convert-overflow.h: New File.
* sysdeps/generic/fix-fp-int-convert-overflow.h
(FIX_LDBL_LONG_CONVERT_OVERFLOW,
FIX_LDBL_LLONG_CONVERT_OVERFLOW): New define.
* sysdeps/arm/fix-fp-int-convert-overflow.h: Likewise.
* sysdeps/mips/mips32/fpu/fix-fp-int-convert-overflow.h:
Likewise.
* sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl):
Avoid conversions to long int where inexact exceptions
could be raised.
* sysdeps/ieee754/ldbl-128/s_lroundl.c (__lroundl):
Likewise.
* sysdeps/ieee754/ldbl-128/s_llrintl.c (__llrintl):
Avoid conversions to long long int where inexact exceptions
could be raised.
* sysdeps/ieee754/ldbl-128/s_llroundl.c (__llroundl):
Likewise.

9 years agoconfigure: make the unsupported error message less hostile
Mike Frysinger [Sat, 16 Jan 2016 00:57:36 +0000 (19:57 -0500)] 
configure: make the unsupported error message less hostile

9 years agoFixed typos in __memcpy_chk.
Andrew Senkevich [Sat, 16 Jan 2016 11:42:26 +0000 (14:42 +0300)] 
Fixed typos in __memcpy_chk.

    * sysdeps/x86_64/multiarch/memcpy_chk.S: Fixed typos.

9 years agosparc: mman.h: fix bad comment insertion
Mike Frysinger [Sat, 16 Jan 2016 07:31:25 +0000 (02:31 -0500)] 
sparc: mman.h: fix bad comment insertion

The MCL_ONFAULT define was inserted into the middle of a comment which
breaks the build.

9 years agonptl: Add first-line description for barrier tests.
Torvald Riegel [Fri, 15 Jan 2016 22:16:49 +0000 (23:16 +0100)] 
nptl: Add first-line description for barrier tests.

9 years agoFix pthread_barrier_init typo.
Torvald Riegel [Fri, 15 Jan 2016 21:40:50 +0000 (22:40 +0100)] 
Fix pthread_barrier_init typo.

Applies Paul Eggert's fix for BZ 18868.

9 years agoAdded memcpy/memmove family optimized with AVX512 for KNL hardware.
Andrew Senkevich [Fri, 15 Jan 2016 21:49:45 +0000 (00:49 +0300)] 
Added memcpy/memmove family optimized with AVX512 for KNL hardware.

Added AVX512 implementations of memcpy, mempcpy, memmove, memcpy_chk,
mempcpy_chk, memmove_chk.
It shows average improvement more than 30% over AVX versions on KNL
hardware (performance results in the thread
<https://sourceware.org/ml/libc-alpha/2016-01/msg00258.html>).

    * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Added new files.
    * sysdeps/x86_64/multiarch/ifunc-impl-list.c: Added new tests.
    * sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S: New file.
    * sysdeps/x86_64/multiarch/mempcpy-avx512-no-vzeroupper.S: Likewise.
    * sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S: Likewise.
    * sysdeps/x86_64/multiarch/memcpy.S: Added new IFUNC branch.
    * sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
    * sysdeps/x86_64/multiarch/memmove.c: Likewise.
    * sysdeps/x86_64/multiarch/memmove_chk.c: Likewise.
    * sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
    * sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.

9 years agoNew pthread_barrier algorithm to fulfill barrier destruction requirements.
Torvald Riegel [Wed, 24 Jun 2015 12:37:32 +0000 (14:37 +0200)] 
New pthread_barrier algorithm to fulfill barrier destruction requirements.

The previous barrier implementation did not fulfill the POSIX requirements
for when a barrier can be destroyed.  Specifically, it was possible that
threads that haven't noticed yet that their round is complete still access
the barrier's memory, and that those accesses can happen after the barrier
has been legally destroyed.
The new algorithm does not have this issue, and it avoids using a lock
internally.

9 years agoFix race in tst-mqueue5
Paul E. Murphy [Mon, 11 Jan 2016 22:24:04 +0000 (17:24 -0500)] 
Fix race in tst-mqueue5

The check is done on line 117 by a thread spawned
from do_child(), forked from do_test().  This test
generates a signal in the forked process.

Either thread may handle the signal, and on ppc,
it happens to be done on do_child, on the thread
which is not doing the check on line 117.

This exposes a race condition whereby the test
incorrectly fails as the signal is caught during
or after the check.

This is mitigated by ensuring the signal is blocked
in the child thread while thread is running.

9 years agoHave iconv accept redundant escape sequences in IBM900, IBM903, IBM905,
Martin Sebor [Fri, 15 Jan 2016 18:25:13 +0000 (11:25 -0700)] 
Have iconv accept redundant escape sequences in IBM900, IBM903, IBM905,
IBM907, and IBM909.

Patch for bug #17197 changes the encoder to avoid generating redundant
shift sequences.  However, those sequences may already be present in
data encododed by prior versions of the encoder.  This change modifies
the decoder to also avoid rejecting redundant shift sequences.

        [BZ #19432]
        * iconvdata/Makefile: Add bug-iconv11.
        * iconvdata/bug-iconv11.c: New test.
        * iconvdata/ibm930.c: Do not reject redundant shift sequences.
        * iconvdata/ibm933.c: Same.
        * iconvdata/ibm935.c: Same.
        * iconvdata/ibm937.c: Same.
        * iconvdata/ibm939.c: Same.

9 years agoFix build failures with -DDEBUG.
Martin Sebor [Fri, 15 Jan 2016 18:07:41 +0000 (11:07 -0700)] 
Fix build failures with -DDEBUG.

        [BZ #19443]
        * crypt/crypt_util.c [DEBUG] (_ufc_prbits): Correct format string.
        [DEBUG] (_ufc_set_bits): Declare used.
        * iconv/gconv_dl.c [DEBUG]: Add a missing include directive.
        [DEBUG] (print_all): Declare used.
        * resolv/res_send.c [DEBUG] (__libc_res_nsend): Explicitly convert
        operands of the ternary ?: expression to target type.
        * stdlib/rshift.c [DEBUG] (mpn_rshift): Use assert() instead of
        calling the undeclared abort.
        * time/mktime.c [DEBUG] (DEBUG): Rename to DEBUG_MKTIME.

9 years agoFix build errors with -DNDEBUG.
Martin Sebor [Fri, 15 Jan 2016 17:44:07 +0000 (10:44 -0700)] 
Fix build errors with -DNDEBUG.

        [BZ #18755]
        * iconv/skeleton.c (FUNCTION_NAME): Suppress -Wunused-but-set-variable
        warnings.
        * sysdeps/nptl/gai_misc.h (__gai_start_notify_thread): Same.
        (__gai_create_helper_thread): Same.
        * nscd/nscd.c (do_exit): Suppress -Wunused-variable.
        * iconvdata/iso-2022-cn-ext.c (BODY): Initialize local variable
        to suppress -Wmaybe-uninitialized warnings.

9 years agoCall math_opt_barrier inside if
H.J. Lu [Fri, 15 Jan 2016 13:22:59 +0000 (05:22 -0800)] 
Call math_opt_barrier inside if

Since floating-point operation may trigger floating-point exceptions,
we call math_opt_barrier inside if to prevent code motion.

[BZ #19465]
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Call math_opt_barrier
inside if.
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Likewise.
* sysdeps/ieee754/ldbl-96/s_fma.c (__fma): Likewise.
* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Likewise.

9 years agoUse TIME_T_MAX and TIME_T_MIN in tst-mktime2.c
H.J. Lu [Fri, 15 Jan 2016 00:35:24 +0000 (16:35 -0800)] 
Use TIME_T_MAX and TIME_T_MIN in tst-mktime2.c

GCC 5.3 compiles

for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
    continue;

into an infinite loop with -Os.  We can copy TIME_T_MAX and TIME_T_MIN
from time/mktime.c.

[BZ #19466]
* time/tst-mktime2.c (time_t_max): Removed.
(time_t_min): Likewise.
(TYPE_SIGNED): New.
(TYPE_MINIMUM): Likewise.
(TYPE_MAXIMUM): Likewise.
(TIME_T_MIN): Likewise.
(TIME_T_MAX): Likewise.
(mktime_test): Replace time_t_max and time_t_min with TIME_T_MAX
and TIME_T_MIN.
(do_test): Likewise.

9 years agoSet index_Fast_Unaligned_Load for Excavator family CPUs
Amit Pawar [Thu, 14 Jan 2016 14:36:02 +0000 (20:06 +0530)] 
Set index_Fast_Unaligned_Load for Excavator family CPUs

GLIBC benchtest testcases shows SSE2_Unaligned based implementations
are performing faster compare to SSE2 based implementations for
routines: strcmp, strcat, strncat, stpcpy, stpncpy, strcpy, strncpy
and strstr. Flag index_Fast_Unaligned_Load is set for Excavator family
0x15h CPU's. This makes SSE2_Unaligned based implementations as
default for these routines.

[BZ #19467]
* sysdeps/x86/cpu-features.c (init_cpu_features): Set
index_Fast_Unaligned_Load flag for Excavator family CPUs.

9 years agoAdd __private_ss to s390 struct tcbhead.
Marcin Kościelnicki [Thu, 14 Jan 2016 15:48:55 +0000 (16:48 +0100)] 
Add __private_ss to s390 struct tcbhead.

Preparation for gcc -fsplit-stack support (gcc bug #68191).  The new
field is basically identical to the one on x86.  Its TCB offset needs
to be constant, as it'll be hardcoded in gcc.

ChangeLog:

* sysdeps/s390/nptl/tls.h (struct tcbhead_t): Add __private_ss field.

9 years agoUse $(PYTHON) to run benchtests python files.
Carlos O'Donell [Wed, 13 Jan 2016 16:00:57 +0000 (11:00 -0500)] 
Use $(PYTHON) to run benchtests python files.