]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
9 years agoFix i386 build for lll_unlock_elision change.
Joseph Myers [Tue, 12 Apr 2016 22:03:00 +0000 (17:03 -0500)] 
Fix i386 build for lll_unlock_elision change.

Tested for i386.

* sysdeps/unix/sysv/linux/i386/lowlevellock.h
(lll_unlock_elision): Add adapt_count parameter.

(cherry picked from commit 5ef193391bb0916ec03f0f06a9b1fe0b00591ad8)

9 years agopowerpc: Optimize lock elision for pthread_mutex_t
Paul Murphy [Tue, 12 Apr 2016 21:58:54 +0000 (16:58 -0500)] 
powerpc: Optimize lock elision for pthread_mutex_t

With TLE enabled, the adapt count variable update incurs
an 8% overhead before entering the critical section of an
elided mutex.

Instead, if it is done right after leaving the critical
section, this serialization can be avoided.

This alters the existing behavior of __lll_trylock_elision
as it will only decrement the adapt_count if it successfully
acquires the lock.

* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__lll_lock_elision): Remove adapt_count decrement...
* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
(__lll_trylock_elision): Likewise.
* sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
(__lll_unlock_elision): ... to here. And utilize
new adapt_count parameter.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
(__lll_unlock_elision): Update to include adapt_count
parameter.
(lll_unlock_elision): Pass pointer to adapt_count
variable.

(cherry picked from commit fadd2ad9cc36115440d50b0eae9299e65988917d)

9 years agonptl: Add adapt_count parameter to lll_unlock_elision
Paul Murphy [Tue, 12 Apr 2016 21:59:03 +0000 (16:59 -0500)] 
nptl: Add adapt_count parameter to lll_unlock_elision

Adding this parameter will give architectures more freedom in
how they choose to update this variable.  This change has no
effect on architectures which choose not to use it.

* nptl/pthread_mutex_unlock.c(lll_unlock_elision):
Add elision adapt_count parameter to list of arguments.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
(lll_unlock_elision): Update with new parameter list
* sysdeps/unix/sysv/linux/s390/lowlevellock.h
(lll_unlock_elision): Likewise
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
(lll_unlock_elision): Likewise

(cherry picked from commit e5e6bea22a2939fe7c415a375992f3ca19f9ff2e)

9 years agoMerge branch 'release/2.22/master' into ibm/2.22/master
Paul E. Murphy [Tue, 12 Apr 2016 18:51:00 +0000 (13:51 -0500)] 
Merge branch 'release/2.22/master' into ibm/2.22/master

9 years agoIncrease internal precision of ldbl-128ibm decimal printf [BZ #19853]
Paul E. Murphy [Tue, 12 Apr 2016 18:29:53 +0000 (13:29 -0500)] 
Increase internal precision of ldbl-128ibm decimal printf [BZ #19853]

When the signs differ, the precision of the conversion sometimes
drops below 106 bits.  This strategy is identical to the
hexadecimal variant.

I've refactored tst-sprintf3 to enable testing a value with more
than 30 significant digits in order to demonstrate this failure
and its solution.

Additionally, this implicitly fixes a typo in the shift
quantities when subtracting from the high mantissa to compute
the difference.

(cherry picked from commit 37a4c70bd4c5c74ac562072e450dc02e8cb4c150)

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)

9 years agopowerpc: Fix tabort usage in syscalls
Paul E. Murphy [Fri, 21 Aug 2015 19:39:01 +0000 (14:39 -0500)] 
powerpc: Fix tabort usage in syscalls

Fix usage of tabort in generated syscalls.  r0 has special meaning
when used with this instruction, thus it will not generate
persistent errors, nor return an error code.  This mitigates poor
CPU usage when performing elided critical sections.

Additionally, transactions should be aborted when entering a user
invoked syscall.  Otherwise the results of the transaction may be
undefined.

2015-08-25  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use
register other than r0 for tabort, it has special meaning.
* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise
* sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort
transaction before starting syscall.

(cherry picked from commit 18173559a23e28055640b152e623d9f0d40ecca8)

9 years agoS390: Extend structs La_s390_regs / La_s390_retval with vector-registers.
Stefan Liebler [Mon, 4 Apr 2016 10:54:23 +0000 (12:54 +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.

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 5cdd1989d1d2f135d02e66250f37ba8e767f9772)

9 years agoS390: Save and restore fprs/vrs while resolving symbols.
Stefan Liebler [Mon, 4 Apr 2016 10:54:23 +0000 (12:54 +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.

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 4603c51ef7989d7eb800cdd6f42aab206f891077
and commit d8a012c5c9e4bfc1b8db2bc6deacb85b44a2e1eb)

9 years agoS390: configure check for vector instruction support in assembler.
Stefan Liebler [Mon, 4 Apr 2016 10:54:22 +0000 (12:54 +0200)] 
S390: configure check for vector instruction support in assembler.

The S390 specific test checks if the assembler has support for the new z13
vector instructions by compiling a vector instruction. The .machine and
.machinemode directives are needed to compile the vector instruction without
-march=z13 option on 31/64 bit.
On success the macro HAVE_S390_VX_ASM_SUPPORT is defined. This macro is used
to determine if the optimized functions can be build without compile errors.
If the used assembler lacks vector support, then a warning is dumped while
configuring and only the common code functions are build.

The z13 instruction support was introduced in
"[Committed] S/390: Add support for IBM z13."
(https://sourceware.org/ml/binutils/2015-01/msg00197.html)

ChangeLog:

* config.h.in (HAVE_S390_VX_ASM_SUPPORT): New macro undefine.
* sysdeps/s390/configure.ac: Add test for S390 vector instruction
assembler support.
* sysdeps/s390/configure: Regenerated.

(cherry picked from commit 4f0a1cea34c05fb2acc16f1a2d291f53230eb4fb)

9 years agoS390: Add new s390 platform.
Stefan Liebler [Mon, 4 Apr 2016 10:54:22 +0000 (12:54 +0200)] 
S390: Add new s390 platform.

The new IBM z13 is added to platform string array.
The macro _DL_PLATFORMS_COUNT is incremented to 8,
because it was not incremented by commit
"S/390: Sync AUXV capabilities and archs with kernel".

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): Add z13.
* sysdeps/s390/dl-procinfo.h (_DL_PLATFORMS_COUNT): Increased.

(cherry picked from commit a1b0488fc9df3d895a2e5eefbcd348d3f7fe0e52)

9 years agoS390: Add hwcaps value for vector facility.
Stefan Liebler [Mon, 4 Apr 2016 10:54:22 +0000 (12:54 +0200)] 
S390: Add hwcaps value for vector facility.

The HWCAP_S390_VX flag in hwcap field of auxiliary vector indicates
if the vector facility is available and the kernel is aware of it.
This can be tested with LD_SHOW_AUXV=1 <prog>.
Currently it does not show te, because it was not incremented
by commit "S/390: Add hwcap value for transactional execution.".
Thus _DL_HWCAP_COUNT is incremented by two.

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_platforms): Add vector flag.
* sysdeps/s390/dl-procinfo.h: Add vector capability.
* sysdeps/unix/sysv/linux/s390/bits/hwcap.h (HWCAP_S390_VX): Define.

(cherry picked from commit 4e28fa80886c71e6aaf85016b82ce981c0f12e6d)

9 years agoMerge branch 'release/2.22/master' into ibm/2.22/master
Tulio Magno Quites Machado Filho [Fri, 1 Apr 2016 19:15:39 +0000 (16:15 -0300)] 
Merge branch 'release/2.22/master' into ibm/2.22/master

9 years agoNEWS: update from previous commit
Tulio Magno Quites Machado Filho [Fri, 1 Apr 2016 18:58:16 +0000 (15:58 -0300)] 
NEWS: update from previous commit

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)

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)

9 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)

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)

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.

(cherry picked from commit a5df3210a641c175138052037fcdad34298bfa4d)

9 years agoFix x86_64 fma4 pow inappropriate contraction (bug 19003).
Joseph Myers [Thu, 24 Sep 2015 16:48:32 +0000 (16:48 +0000)] 
Fix x86_64 fma4 pow inappropriate contraction (bug 19003).

The x86_64 fma4 version of pow fails to disable contraction of
operations other than those explicitly intended to use fma
instructions, so resulting in large ulps errors on processors with
fma4 instructions, as in bug 18104 (165ulp for the test added for that
bug; error originally reported by "blaaa" on #glibc).  This patch adds
$(config-cflags-nofma) for e_pow-fma4.c, corresponding to the use for
e_pow.c in sysdeps/ieee754/dbl-64/Makefile.

Tested for x86_64 on a processor with fma4.

[BZ #19003]
* sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-e_pow-fma4.c): Add
$(config-cflags-nofma).

(cherry picked from commit 51df2605064a2bfd44fa0655ef9815812347de80)

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)

9 years agoS390: Do not use direct socket syscalls if build on kernels >= 4.3. [BZ #19682]
Stefan Liebler [Thu, 3 Mar 2016 07:17:09 +0000 (08:17 +0100)] 
S390: Do not use direct socket syscalls if build on kernels >= 4.3. [BZ #19682]

Beginning with Linux 4.3, the kernel headers contain direct
system call numbers __NR_socket etc. on s390x. On older kernels,
the socket-multiplexer syscall __NR_socketcall was used.

To enable these new syscalls, the patch
"S390: Call direct system calls for socket operations."
(https://sourceware.org/git/?p=glibc.git;a=commit;h=016495b818cb61df7d0d10e6db54074271b3e3a5)
was applied upstream.

If glibc 2.23 is configured with --enable-kernel=4.3 and newer,
the direct socket syscalls are used.
For older kernels, the socket-multiplexer syscall is used instead.

In glibc 2.22 and earlier, this patch is not applied.
If you build glibc on a kernel < 4.3, the socket-multiplexer
syscall is used. But if you build glibc on kernel >= 4.3, the
direct socket-syscalls are used. If you install this glibc on a
kernel < 4.3, all socket operations will fail.
See "Bug 19682 - s390x: Incorrect syscall definitions cause
breakage with Linux 4.3 headers"
(https://sourceware.org/bugzilla/show_bug.cgi?id=19682)
The configure switch --enable-kernel does not influence this
behaviour on older glibc-releases.

The solution is to remove the direct socket-syscalls in
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
(this patch) on older glibc-releases as it was done by the
upstream patch, too. These entries were never used on s390x,
but the c-files in sysdeps/unix/sysv/linux/.
After this removal, the behaviour of the socket functions are
not changed compared to the original glibc release version
and the socket-multiplexer-syscall is always used.

9 years agoRegenerate Alpha ULPs
Aurelien Jarno [Tue, 1 Mar 2016 08:22:26 +0000 (09:22 +0100)] 
Regenerate Alpha ULPs

* sysdeps/alpha/fpu/libm-test-ulps: Update ULPs.

9 years agopowerpc: More elision improvements
Paul Murphy [Wed, 28 Oct 2015 22:34:31 +0000 (17:34 -0500)] 
powerpc: More elision improvements

__lll_trylock_elision sets the adapt_count variable too
aggressively, and incorrectly on persistent aborts.  Taking
a cue from s390, adapt_count is only updated if the lock
is locked, or a persistent failure occurs.

In addition, the abort codes have been renumbered and
refactored for clarity.  As it stands, glibc only cares
if the abort is persistent or not.

All aborts are now persistent, excepting a busy lock.  This
includes changing _ABORT_NESTED_TRYLOCK into a persistent
abort.

* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
(__lll_trylock_elision): Fix setting of adapt_count.
* sysdeps/unix/sysv/linux/powerpc/htm.h
(_ABORT_PERSISTENT): Define to clarify persistent aborts.
(_ABORT_NESTED_TRYLOCK): Renumber, and make persistent.
(_ABORT_SYSCALL): Renumber, and clarify definition.
(_ABORT_LOCK_BUSY): Renumber, make non-persistent.

(cherry picked from commit 86b4939846caf2bb072bba6057e1dc3ad187c2c2)

Conflicts:
sysdeps/unix/sysv/linux/powerpc/elision-trylock.c

9 years agoMerge branch 'release/2.22/master' into ibm/2.22/master
Tulio Magno Quites Machado Filho [Mon, 22 Feb 2016 19:20:34 +0000 (16:20 -0300)] 
Merge branch 'release/2.22/master' into ibm/2.22/master

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.

(cherry picked from commit af8ea0f449af7d3847351a4a5bafcd435a22ac31)

9 years agopowerpc: Enforce compiler barriers on hardware transactions
Tulio Magno Quites Machado Filho [Mon, 28 Dec 2015 14:24:43 +0000 (12:24 -0200)] 
powerpc: Enforce compiler barriers on hardware transactions

Work around a GCC behavior with hardware transactional memory built-ins.
GCC doesn't treat the PowerPC transactional built-ins as compiler
barriers, moving instructions past the transaction boundaries and
altering their atomicity.

(cherry picked from commit 42bf1c897170ff951c7fd0ee9da25f97ff787396)

Conflicts:
sysdeps/unix/sysv/linux/powerpc/elision-trylock.c

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

(cherry picked from commit e9db92d3acfe1822d56d11abcea5bfc4c41cf6ca)

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

(cherry picked from commit f34f146e682d8d529dcf64b3c2781bf3f2f05f6c)

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]

(cherry picked from commit bae7c7c764413b23e61cb099ce33be4c4ee259bb)

9 years agoHandle overflow in __hcreate_r
OndÅ™ej Bílka [Sat, 11 Jul 2015 15:44:10 +0000 (17:44 +0200)] 
Handle overflow in __hcreate_r

Hi,

As in bugzilla entry there is overflow in hsearch when looking for prime
number as SIZE_MAX - 1 is divisible by 5. We fix that by rejecting large
inputs before looking for prime.

* misc/hsearch_r.c (__hcreate_r): Handle overflow.

(cherry picked from commit 2f5c1750558fe64bac361f52d6827ab1bcfe52bc)

9 years agoGracefully handle incompatible locale data
Ludovic Courtès [Tue, 27 Oct 2015 12:33:26 +0000 (13:33 +0100)] 
Gracefully handle incompatible locale data

* locale/loadlocale.c (_nl_intern_locale_data): Change assertion
on CNT to a conditional jump to 'puntdata'.

(cherry picked from commit 0062ace2292effc4135c15ea99b1931fea5e0203)

9 years agohppa: start.S: rework references to fix PIE TEXTRELs [BZ #18421]
Alan Modra [Sat, 15 Aug 2015 02:15:49 +0000 (22:15 -0400)] 
hppa: start.S: rework references to fix PIE TEXTRELs [BZ #18421]

The startup code was not using PIC friendly references leading to TEXTRELs
in every PIE ELF.

(cherry picked from commit cf4253777412e9c8d5bfbc1c8b975f472e1e7d43)

9 years agohppa: Fix miscompilation of sched_setaffinity() [BZ #18480]
John David Anglin [Fri, 7 Aug 2015 15:54:19 +0000 (11:54 -0400)] 
hppa: Fix miscompilation of sched_setaffinity() [BZ #18480]

The attached change fixes the miscompilation of sched_setaffinity() on
hppa.  This is an old problem that was fixed on other architectures using
a similar approach to the attached change.  See:
https://sourceware.org/ml/libc-hacker/2004-04/msg00016.html

Build tested on trunk.  Patch has been applied to debian glibc for some time.

(cherry picked from commit 04ece7d2dec91fe870c5f1a38032875915f44633)

9 years agoFix BZ #18985 -- out of range data to strftime() causes a segfault
Paul Pluzhnikov [Sat, 26 Sep 2015 20:27:48 +0000 (13:27 -0700)] 
Fix BZ #18985 -- out of range data to strftime() causes a segfault

(cherry picked from commit d36c75fc0d44deec29635dd239b0fbd206ca49b7)

9 years agoFix trailing space.
Paul Pluzhnikov [Sat, 8 Aug 2015 22:54:40 +0000 (15:54 -0700)] 
Fix trailing space.

(cherry picked from commit 7565d2a862683a3c26ffb1f32351b8c5ab9f7b31)

9 years agoFix BZ #17905
Paul Pluzhnikov [Sat, 8 Aug 2015 22:53:03 +0000 (15:53 -0700)] 
Fix BZ #17905

(cherry picked from commit 0f58539030e436449f79189b6edab17d7479796e)

9 years agoalpha/hppa: fix libc.abilist sorting wrt fmemopen
Aurelien Jarno [Mon, 7 Dec 2015 14:40:01 +0000 (15:40 +0100)] 
alpha/hppa: fix libc.abilist sorting wrt fmemopen

Commit fdb7d390 introduced the fmemopen symbol at the wrong location
in alpha/libc.abilist and hppa/libc.abilist. The file needs to keep
sorted, fix that.

Note: this is for 2.22 only, for master the format has been changed in
commit 8c77b6ad.

* sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Move
to keep the file sorted.
* sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.

9 years agoMerge branch 'release/2.22/master' into ibm/2.22/master
Tulio Magno Quites Machado Filho [Thu, 17 Dec 2015 19:31:21 +0000 (17:31 -0200)] 
Merge branch 'release/2.22/master' into ibm/2.22/master

9 years agopowerpc: Fix usage of elision transient failure adapt param
Paul Murphy [Thu, 27 Aug 2015 14:48:04 +0000 (09:48 -0500)] 
powerpc: Fix usage of elision transient failure adapt param

The skip_lock_out_of_tbegin_retries adaptive parameter was
not being used correctly, nor as described.  This prevents
a fallback for all users of the lock if a transient abort
occurs within the accepted number of retries.

[BZ #19174]
* sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of
.skip_lock_out_of_tbegin_retries.
* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__lll_lock_elision): Likewise, and respect a value of
try_tbegin <= 0.

(cherry picked from commit 72f1463df85a522bfd1568e47bd81371522ee358)

Conflicts:
NEWS

9 years agoCorrected path to installed libmvec_nonshared.a
Andrew Senkevich [Thu, 3 Dec 2015 17:54:52 +0000 (20:54 +0300)] 
Corrected path to installed libmvec_nonshared.a

    * math/Makefile ($(inst_libdir)/libm.so): Corrected path to
    libmvec_nonshared.a

9 years agoBetter workaround for aliases of *_finite symbols in vector math library.
Andrew Senkevich [Fri, 27 Nov 2015 14:30:04 +0000 (17:30 +0300)] 
Better workaround for aliases of *_finite symbols in vector math library.

Old workaround based on assembly aliases can lead to link fail (bug 19058).
This patch makes workaround in another way to avoid it.

    [BZ #19058]
    * math/Makefile ($(inst_libdir)/libm.so): Added libmvec_nonshared.a
    to AS_NEEDED.
    * sysdeps/x86/fpu/bits/math-vector.h: Removed code with old workaround.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support,
    libmvec-static-only-routines): Added new file.
    * sysdeps/x86_64/fpu/svml_finite_alias.S: New file.
    * NEWS: Mention this fix.

9 years agoNaCl: Use allocate_code_data after dyncode_create
Roland McGrath [Sat, 21 Nov 2015 00:16:35 +0000 (16:16 -0800)] 
NaCl: Use allocate_code_data after dyncode_create

(cherry picked from commit f549f0bcba7196a2afc51657c536bbc131a7c544)

9 years agoRun tst-prelink test for GLOB_DAT reloc
H.J. Lu [Sat, 14 Nov 2015 20:00:16 +0000 (12:00 -0800)] 
Run tst-prelink test for GLOB_DAT reloc

Run tst-prelink test on targets with GLOB_DAT relocaton.

* config.make.in (have-glob-dat-reloc): New.
* configure.ac (libc_cv_has_glob_dat): New.  Set to yes if
target supports GLOB_DAT relocaton. AC_SUBST.
* configure: Regenerated.
* elf/Makefile (tests): Add tst-prelink.
(tests-special): Add $(objpfx)tst-prelink-cmp.out.
(tst-prelink-ENV): New.
($(objpfx)tst-prelink-conflict.out): Likewise.
($(objpfx)tst-prelink-cmp.out): Likewise.
* sysdeps/x86/tst-prelink.c: Moved to ...
* elf/tst-prelink.c: Here.
* sysdeps/x86/tst-prelink.exp: Moved to ...
* elf/tst-prelink.exp: Here.
* sysdeps/x86/Makefile (tests): Don't add tst-prelink.
(tst-prelink-ENV): Removed.
($(objpfx)tst-prelink-conflict.out): Likewise.
($(objpfx)tst-prelink-cmp.out): Likewise.
(tests-special): Don't add $(objpfx)tst-prelink-cmp.out.

(cherry picked from commit 89569c8bb6b386db4881af0e96514d2ec5c35478)

9 years agoNaCl: Use open_resource API for shared objects
Roland McGrath [Wed, 11 Nov 2015 03:44:48 +0000 (19:44 -0800)] 
NaCl: Use open_resource API for shared objects

(cherry picked from commit c0d6f2a33e1229a96d5d5064b9b04d7d3cd41d9d)

9 years agoAdd a test for prelink output
H.J. Lu [Tue, 10 Nov 2015 20:27:24 +0000 (12:27 -0800)] 
Add a test for prelink output

This test applies to i386 and x86_64 which set R_386_GLOB_DAT and
R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.

[BZ #19178]
* sysdeps/x86/Makefile (tests): Add tst-prelink.
(tst-prelink-ENV): New.
($(objpfx)tst-prelink-conflict.out): Likewise.
($(objpfx)tst-prelink-cmp.out): Likewise.
(tests-special): Add $(objpfx)tst-prelink-cmp.out.
* sysdeps/x86/tst-prelink.c: New file.
* sysdeps/x86/tst-prelink.exp: Likewise.

(cherry picked from commit fe534fe8980fa214c410e3661a4216e781073353)

9 years agoKeep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink
H.J. Lu [Sat, 7 Nov 2015 14:32:30 +0000 (06:32 -0800)] 
Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink

prelink runs ld.so with the environment variable LD_TRACE_PRELINKING
set to dump the relocation type class from _dl_debug_bindings.  prelink
has the following relocation type classes:

 #define RTYPE_CLASS_VALID       8
 #define RTYPE_CLASS_PLT         (8|1)
 #define RTYPE_CLASS_COPY        (8|2)
 #define RTYPE_CLASS_TLS         (8|4)

where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with
RTYPE_CLASS_TLS.

Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is
set.

[BZ #19178]
* elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
(RTYPE_CLASS_PLT): Likewise.
(RTYPE_CLASS_COPY): Likewise.
(RTYPE_CLASS_TLS): Likewise.
(_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
to set relocation type class for DL_DEBUG_PRELINK.  Keep only
ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
DL_DEBUG_PRELINK.

(cherry picked from commit f3d18efb8a720121066dc3401e822043beb98cde)

9 years agoMerge branch 'release/2.22/master' into ibm/2.22/master
Tulio Magno Quites Machado Filho [Tue, 20 Oct 2015 15:49:34 +0000 (13:49 -0200)] 
Merge branch 'release/2.22/master' into ibm/2.22/master

9 years agoPowerPC: Fix a race condition when eliding a lock
Tulio Magno Quites Machado Filho [Wed, 22 Jul 2015 12:26:02 +0000 (09:26 -0300)] 
PowerPC: Fix a race condition when eliding a lock

The previous code used to evaluate the preprocessor token is_lock_free to
a variable before starting a transaction.  This behavior can cause an
error if another thread got the lock (without using a transaction)
between the evaluation of the token and the beginning of the transaction.

This bug can be triggered with the following order of events:
1. The lock accessed by is_lock_free is free.
2. Thread T1 evaluates is_lock_free and stores into register R1 that the
   lock is free.
3. Thread T2 acquires the same lock used in is_lock_free.
4. T1 begins the transaction, creating a memory barrier where is_lock_free
   is false, but R1 is true.
5. T1 reads R1 and doesn't abort the transaction.
6. T1 calls ELIDE_UNLOCK, which reads false from is_lock_free and decides
   to unlock a lock acquired by T2, leading to undefined behavior.

This patch delays the evaluation of is_lock_free to inside a transaction
by moving this part of the code to the macro ELIDE_LOCK.

[BZ #18743]
* sysdeps/powerpc/nptl/elide.h (__elide_lock): Move most of this
code to...
(ELIDE_LOCK): ...here.
(__get_new_count): New function with part of the code from
__elide_lock that updates the value of adapt_count after a
transaction abort.
(__elided_trylock): Moved this code to...
(ELIDE_TRYLOCK): ...here.

(cherry picked from commit 6ec52bf634b7650b57ff67b5f5053bce8992d549)

9 years agoHarden tls_dtor_list with pointer mangling [BZ #19018]
Florian Weimer [Tue, 6 Oct 2015 11:12:36 +0000 (13:12 +0200)] 
Harden tls_dtor_list with pointer mangling [BZ #19018]

(cherry picked from commit f586e1328681b400078c995a0bb6ad301ef73549)

9 years agoAlways enable pointer guard [BZ #18928]
Florian Weimer [Thu, 15 Oct 2015 07:23:07 +0000 (09:23 +0200)] 
Always enable pointer guard [BZ #18928]

Honoring the LD_POINTER_GUARD environment variable in AT_SECURE mode
has security implications.  This commit enables pointer guard
unconditionally, and the environment variable is now ignored.

        [BZ #18928]
        * sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
        _dl_pointer_guard member.
        * elf/rtld.c (_rtld_global_ro): Remove _dl_pointer_guard
        initializer.
        (security_init): Always set up pointer guard.
        (process_envvars): Do not process LD_POINTER_GUARD.

(cherry picked from commit a014cecd82b71b70a6a843e250e06b541ad524f7)

9 years agoFix typo in bug-strcoll2 (Bug 18589)
Carlos O'Donell [Fri, 9 Oct 2015 20:35:53 +0000 (16:35 -0400)] 
Fix typo in bug-strcoll2 (Bug 18589)

Fix the copyright year and remove contributed by in the
bug-strcoll2 test. In addition add the correct dependency
on $(gen-locales) to ensure all the test locales are generated.

(cherry picked from commit facdd9ea29ab94aac2b188ec3cc41f8733d769e0)

9 years agostrcoll: Add bug-strcoll2 to testsuite (Bug 18589).
Carlos O'Donell [Thu, 8 Oct 2015 20:54:30 +0000 (16:54 -0400)] 
strcoll: Add bug-strcoll2 to testsuite (Bug 18589).

Adds bug-strcoll2 to the string tests, along with the
generation of required locales.

(cherry picked from commit 02018629a1397d03eccceacaf2ee1c50e3c4001c)

9 years agoLet 'make check subdirs=string' succeed even when it's invoked
Martin Sebor [Mon, 28 Sep 2015 20:55:57 +0000 (16:55 -0400)] 
Let 'make check subdirs=string' succeed even when it's invoked
immediately after glibc has been built and before 'make check'
(or after 'make clean').

(cherry picked from commit 60cf80f09d029257caedc0c8abe7e3e09c64e6c7)

9 years agostrcoll: Remove incorrect STRDIFF-based optimization (Bug 18589).
Carlos O'Donell [Thu, 8 Oct 2015 20:34:53 +0000 (16:34 -0400)] 
strcoll: Remove incorrect STRDIFF-based optimization (Bug 18589).

The optimization introduced in commit
f13c2a8dff2329c6692a80176262ceaaf8a6f74e, causes regressions in
sorting for languages that have digraphs that change sort order, like
cs_CZ which sorts ch between h and i.

My analysis shows the fast-forwarding optimization in STRCOLL advances
through a digraph while possibly stopping in the middle which results
in a subsequent skipping of the digraph and incorrect sorting. The
optimization is incorrect as implemented and because of that I'm
removing it for 2.23, and I will also commit this fix for 2.22 where
it was originally introduced.

This patch reverts the optimization, introduces a new bug-strcoll2.c
regression test that tests both cs_CZ.UTF-8 and da_DK.ISO-8859-1 and
ensures they sort one digraph each correctly. The optimization can't be
applied without regressing this test.

Checked on x86_64, bug-strcoll2.c fails without this patch and passes
after. This will also get a fix on 2.22 which has the same bug.

(cherry picked from commit 87701a58e291bd7ac3b407d10a829dac52c9c16e)

9 years agoUse HOST_NAME_MAX for MAXHOSTNAMELEN in <sys/param.h>.
Roland McGrath [Tue, 15 Sep 2015 22:27:58 +0000 (15:27 -0700)] 
Use HOST_NAME_MAX for MAXHOSTNAMELEN in <sys/param.h>.

(cherry picked from commit 51f24be7ba5d15313ae94f8fb4500ce07cb98c84)

9 years agoNaCl: Do not install <sys/mtio.h>.
Roland McGrath [Fri, 11 Sep 2015 21:16:18 +0000 (14:16 -0700)] 
NaCl: Do not install <sys/mtio.h>.

(cherry picked from commit d57248f0351b307e17476aa1ef812023025c8fd7)

9 years agoBZ#18921: Mark fixed in NEWS.
Roland McGrath [Tue, 8 Sep 2015 21:03:48 +0000 (14:03 -0700)] 
BZ#18921: Mark fixed in NEWS.

9 years agoBZ#18921: Fix opendir inverted o_directory_works test.
Roland McGrath [Fri, 4 Sep 2015 21:37:56 +0000 (14:37 -0700)] 
BZ#18921: Fix opendir inverted o_directory_works test.

(cherry picked from commit bd9e69abb887d78d0d6708fc089cc9f3eabf106d)

9 years agoFix non-v9 32-bit sparc build.
Brett Neumeier [Mon, 31 Aug 2015 22:27:21 +0000 (15:27 -0700)] 
Fix non-v9 32-bit sparc build.

[BZ #18870]
* sysdeps/sparc/sparc32/sem_open.c: Add missing #include

9 years agogetmntent: fix memory corruption w/blank lines [BZ #18887]
Mike Frysinger [Fri, 28 Aug 2015 21:08:49 +0000 (17:08 -0400)] 
getmntent: fix memory corruption w/blank lines [BZ #18887]

The fix for BZ #17273 introduced a single byte of memory corruption when
the line is entirely blank.  It would walk back past the start of the
buffer if the heap happened to be 0x20 or 0x09 and then write a NUL byte.
buffer = '\n';
end_ptr = buffer;
while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
end_ptr--;
*end_ptr = '\0';

Fix that and rework the tests.  Adding the testcase for BZ #17273 to the
existing \040 parser does not really make sense as it's unrelated, and
leads to confusing behavior: it implicitly relies on the new entry being
longer than the previous entry (since it just rewinds the FILE*).  Split
it out into its own dedicated testcase instead.

(cherry picked from commit b0e805fa0d6fea33745952df7b7f5442ca4c374f)

9 years agoMerge branch 'release/2.22/master' into ibm/2.22/master
Tulio Magno Quites Machado Filho [Thu, 27 Aug 2015 13:55:46 +0000 (10:55 -0300)] 
Merge branch 'release/2.22/master' into ibm/2.22/master

9 years agopowerpc: Revert to default atomic ops in elision code
Paul E. Murphy [Wed, 26 Aug 2015 17:21:18 +0000 (12:21 -0500)] 
powerpc: Revert to default atomic ops in elision code

Power ISA 2.07B section B.5.5 relaxed the barrier requirement around a
TLE enabled lock.  It is now identical to a traditional lock.

2015-08-26  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__arch_compare_and_exchange_val_32_acq): Remove and use common
definition.  ISA 2.07B no longer requires full sync.

9 years agopowerpc: Fix tabort usage in syscalls
Paul E. Murphy [Fri, 21 Aug 2015 19:39:01 +0000 (14:39 -0500)] 
powerpc: Fix tabort usage in syscalls

Fix usage of tabort in generated syscalls.  r0 has special meaning
when used with this instruction, thus it will not generate
persistent errors, nor return an error code.  This mitigates poor
CPU usage when performing elided critical sections.

Additionally, transactions should be aborted when entering a user
invoked syscall.  Otherwise the results of the transaction may be
undefined.

2015-08-25  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use
register other than r0 for tabort, it has special meaning.
* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise
* sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort
transaction before starting syscall.

9 years agoNaCl: Call __nacl_main in preference to main. fedora/2.22/master
Roland McGrath [Tue, 25 Aug 2015 20:37:07 +0000 (13:37 -0700)] 
NaCl: Call __nacl_main in preference to main.

(cherry picked from commit f97194930886838796546646e26a49bb5899075b)

9 years ago [BZ #18796]
Andrew Senkevich [Wed, 19 Aug 2015 16:02:32 +0000 (19:02 +0300)] 
[BZ #18796]
    * scripts/test-installation.pl: Don't add -lmvec to build options
    if libmvec wasn't built.
    * NEWS: Mention this fix.

9 years agoClear DF_1_NODELETE flag only for failed to load library.
Maxim Ostapenko [Mon, 10 Aug 2015 07:47:54 +0000 (10:47 +0300)] 
Clear DF_1_NODELETE flag only for failed to load library.

https://sourceware.org/bugzilla/show_bug.cgi?id=18778

If dlopen fails to load an object that has triggered loading libpthread it
causes ld.so to unload libpthread because its DF_1_NODELETE flags has been
forcefully cleared. The next call to __rtdl_unlock_lock_recursive will crash
since pthread_mutex_unlock no longer exists.

This patch moves l->l_flags_1 &= ~DF_1_NODELETE out of loop through all loaded
libraries and performs the action only on inconsistent one.

[BZ #18778]
* elf/Makefile (tests): Add Add tst-nodelete2.
(modules-names): Add tst-nodelete2mod.
(tst-nodelete2mod.so-no-z-defs): New.
($(objpfx)tst-nodelete2): Likewise.
($(objpfx)tst-nodelete2.out): Likewise.
(LDFLAGS-tst-nodelete2): Likewise.
* elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
out of loop through all loaded libraries.
* elf/tst-nodelete2.c: New file.
* elf/tst-nodelete2mod.c: Likewise.

(cherry picked from commit f25238ffe0455013174438376b3ee88df496f9d1)

9 years agoReadd O_LARGEFILE flag for openat64 (bug 18781)
Andreas Schwab [Mon, 10 Aug 2015 12:12:47 +0000 (14:12 +0200)] 
Readd O_LARGEFILE flag for openat64 (bug 18781)

(cherry picked from commit eb32b0d40308166c4d8f6330cc2958cb1e545075)

10 years agohppa: Fix reload error with atomic code [BZ #18787]
John David Anglin [Fri, 7 Aug 2015 17:37:35 +0000 (13:37 -0400)] 
hppa: Fix reload error with atomic code [BZ #18787]

As noted in the bug, the asm operands need to be copied to register
variables to avoid operand reloads in the principal asm of the macro.
See the arm implementation for reference.  Otherwise we get:
../sysdeps/unix/sysv/linux/hppa/bits/atomic.h:68:6: error:
can't find a register in class 'R1_REGS' while reloading 'asm'

Build tested on trunk with gcc-4.8.  Similar patch has been tested
with 2.19 on Debian hppa-unknown-linux-gnu.

(cherry picked from commit 74bc0c3a16e3c8f138e29a284e84d16474b65a8e)

10 years agomicroblaze: include unix/sysdep.h
Mike Frysinger [Thu, 6 Aug 2015 06:10:46 +0000 (02:10 -0400)] 
microblaze: include unix/sysdep.h

The semi-recent SYSCALL_CANCEL inclusion broke microblaze due to the
sysdep.h header not including the unix/sysdep.h header.  Include it
here like all other ports.

(cherry picked from commit 5d5de49c3ccd69f65b801f1ca490a0112d1cbd7d)

10 years agoRemove assert if DT_RUNPATH and DT_RPATH flags are found in ld.so
Tulio Magno Quites Machado Filho [Thu, 6 Aug 2015 19:13:56 +0000 (16:13 -0300)] 
Remove assert if DT_RUNPATH and DT_RPATH flags are found in ld.so

10 years agohppa: _dl_symbol_address: add missing hidden def
Mike Frysinger [Fri, 7 Aug 2015 05:43:08 +0000 (01:43 -0400)] 
hppa: _dl_symbol_address: add missing hidden def

Commit 2a6ad8142d14c998e6c5eb51418aac1f598b621e updated the headers and
the common dl-symaddr.c, but missed that hppa has its own dedicated source
file for this func.  Update that too to fix build errors due to missing
exports of the symbol.

(cherry picked from commit be144ba68c918a5d7bc964be06fbeb51a0df84fc)

10 years agoCorrect comments about the history of <regexp.h>
Zack Weinberg [Thu, 6 Aug 2015 02:35:28 +0000 (22:35 -0400)] 
Correct comments about the history of <regexp.h>

In the "Kill regexp.h" thread, Joseph dug up more accurate information
about exactly which editions of the Single Unix Standard included and
deprecated this header.

10 years agoUpdate version.h and include/features.h for 2.22 release glibc-2.22
Carlos O'Donell [Wed, 5 Aug 2015 06:42:21 +0000 (02:42 -0400)] 
Update version.h and include/features.h for 2.22 release

10 years agotilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
Chris Metcalf [Tue, 4 Aug 2015 16:02:10 +0000 (12:02 -0400)] 
tilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h

Using a ({ }) structure avoids the "value computed is not used"
that a simple () structure causes.

10 years agoProperly terminate FDE in makecontext for ix86 (bug 18635)
Andreas Schwab [Tue, 4 Aug 2015 10:35:50 +0000 (12:35 +0200)] 
Properly terminate FDE in makecontext for ix86 (bug 18635)

10 years agoUpdated translations for 2.22.
Carlos O'Donell [Sat, 1 Aug 2015 18:48:31 +0000 (14:48 -0400)] 
Updated translations for 2.22.

10 years agoDeprecate the use of regexp.h
Zack Weinberg [Sat, 1 Aug 2015 18:38:05 +0000 (14:38 -0400)] 
Deprecate the use of regexp.h

<regexp.h> (not to be confused with <regex.h>) is an obsolete and
frankly horrible regular expression-matching API.  It was part of SVID
but was withdrawn in Issue 5 (for reference, we're on Issue 7 now).
It doesn't do anything you can't do with <regex.h>, and using it
involves defining a bunch of macros before including the header.
Moreover, the code in regexp.h that uses those macros has been buggy
since its creation (in 1996) and no one has noticed, which indicates
to me that there are no users.  (Specifically, RETURN() is used in a
whole bunch of cases where it should have been ERROR().)

The header is given a warning and marked deprecated for 2.22.

See:
https://sourceware.org/ml/libc-alpha/2015-07/msg00862.html and
https://sourceware.org/ml/libc-alpha/2015-07/msg00871.html.

10 years agoRegenerate libc.pot for 2.22 release.
Carlos O'Donell [Fri, 31 Jul 2015 04:13:33 +0000 (00:13 -0400)] 
Regenerate libc.pot for 2.22 release.

10 years agoPrevent runtime fail of SSE vector math tests on non SSE4.1 machine.
Andrew Senkevich [Thu, 30 Jul 2015 15:00:24 +0000 (18:00 +0300)] 
Prevent runtime fail of SSE vector math tests on non SSE4.1 machine.

    [BZ #18740]
    * sysdeps/x86_64/fpu/Makefile (double-vlen2-arch-ext-cflags,
    float-vlen4-arch-ext-cflags): Removed.
    * math/Makefile (CFLAGS-test-double-vlen2-wrappers.c,
    CFLAGS-test-float-vlen4-wrappers.c): Likewise.

10 years agohppa: add bz entry for pthreadtypes.h fix
Mike Frysinger [Thu, 30 Jul 2015 14:08:35 +0000 (10:08 -0400)] 
hppa: add bz entry for pthreadtypes.h fix

10 years agohppa: fix pthreadtypes.h namespace failures
Mike Frysinger [Thu, 30 Jul 2015 09:02:15 +0000 (05:02 -0400)] 
hppa: fix pthreadtypes.h namespace failures

The conform tests flag the "aligned" symbol used inside the attributes,
so rename it to __aligned__ like other headers.

10 years agohppa: Remove custom lowlevellock.h.
Torvald Riegel [Wed, 17 Dec 2014 22:52:06 +0000 (23:52 +0100)] 
hppa: Remove custom lowlevellock.h.

This untested patch removes the custom lowlevellock.h on hppa.  It seems
to contain an implementation equivalent to the generic lowlevellock.h.

10 years agohppa: sigaction.h: change sa_flags to an int
Mike Frysinger [Wed, 22 Jul 2015 02:49:22 +0000 (22:49 -0400)] 
hppa: sigaction.h: change sa_flags to an int

This fixes the conform test for the sigaction.h header and makes it match
all the other arches.

10 years agohppa: fix sysdep.h header setup
Mike Frysinger [Thu, 30 Jul 2015 02:55:43 +0000 (22:55 -0400)] 
hppa: fix sysdep.h header setup

The semi-recent SYSCALL_CANCEL inclusion broke hppa due to the sysdep.h
headers not including the unix/sysdep.h headers.  Rework the includes so
we match the other ports:
* hppa/sysdep.h:
- Do not include sys/syscall.h as the unix sysdep.h headers do it.
- Do not include config.h as libc-symbols.h does it, and it has no
#ifdef multiple-include protection, and it breaks when some files
do things like #undef __OPTIMIZE__.
* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h:
- Drop the generic/sysdep.h as the unix sysdep.h headers include it.
* sysdeps/unix/sysv/linux/hppa/sysdep.h:
- Change to the unix & core hppa sysdep header stacks.
- Undef a few defines that the core headers already set up for us.

10 years agohppa: rewrite INLINE_SYSCALL
Mike Frysinger [Thu, 30 Jul 2015 03:01:01 +0000 (23:01 -0400)] 
hppa: rewrite INLINE_SYSCALL

The semi-recent SYSCALL_CANCEL macro imposes a slight nuance on the
implementation of INLINE_SYSCALL: the nr argument cannot be expanded
directly but must be passed on to another macro which may expand it.
Most arches don't notice because INLINE_SYSCALL is defined in terms
of INTERNAL_SYSCALL which has the additional layer of expansion, but
on hppa, it was attempting to expand it directly.  That causes build
errors like so:
../sysdeps/unix/sysv/linux/sigsuspend.c: In function '__sigsuspend':
../sysdeps/unix/sysv/linux/sigsuspend.c:31:62: error:
implicit declaration of function 'LOAD_ARGS___SYSCALL_NARGS'
../sysdeps/unix/sysv/linux/sigsuspend.c:31:304: error:
called object 'LOAD_ARGS___SYSCALL_NARGS(set, 8)' is not a function

So rewrite hppa's INLINE_SYSCALL to use INTERNAL_SYSCALL like other
arches do.  This is also a nice clean up as the two macros had quite
a bit of duplicated logic.

10 years agoExtend local PLT reference check
H.J. Lu [Wed, 29 Jul 2015 18:57:54 +0000 (11:57 -0700)] 
Extend local PLT reference check

On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
R_*_GLOB_DAT relocation against the same symbol.  This patch extends
local PLT reference check to support alternate relocations.

[BZ #18078]
* scripts/check-localplt.awk: Support alternate relocations.
* scripts/localplt.awk: Also check relocations in DT_RELA/DT_REL
sections.
* sysdeps/unix/sysv/linux/i386/localplt.data: Mark free and
malloc entries with + REL R_386_GLOB_DAT.
* sysdeps/x86_64/localplt.data: New file.

10 years agoAdded runtime check for AVX vector math tests.
Andrew Senkevich [Wed, 29 Jul 2015 16:47:29 +0000 (19:47 +0300)] 
Added runtime check for AVX vector math tests.

    [BZ #18731]
    * sysdeps/x86_64/fpu/math-tests-arch.h: Added AVX runtime check.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.

10 years agoia64: drop __tls_get_addr from expected ld.so plt usage
Mike Frysinger [Tue, 28 Jul 2015 09:28:57 +0000 (05:28 -0400)] 
ia64: drop __tls_get_addr from expected ld.so plt usage

This file was updated with an educated guess as to the symbols needed,
but on ia64, we don't have __tls_get_addr calls, so drop it from the
list.

10 years agoia64: atomic.h: fix atomic_exchange_and_add 64bit handling
Mike Frysinger [Tue, 28 Jul 2015 06:19:49 +0000 (02:19 -0400)] 
ia64: atomic.h: fix atomic_exchange_and_add 64bit handling

Way back in 2005 the atomic_exchange_and_add function was cleaned up to
avoid the explicit size checking and instead let gcc handle things itself.
Unfortunately that change ended up leaving beyond a cast to int, even when
the incoming value was a long.  This has flown under the radar for a long
time due to the function not being heavily used in the tree (especially as
a full 64bit field), but a recent change to semaphores made some nptl tests
fail reliably.  This is due to the code packing two 32bit values into one
64bit variable (where the high 32bits contained the number of waiters), and
then the whole variable being atomically updated between threads.  On ia64,
that meant we never atomically updated the count, so sometimes the sem_post
would not wake up the waiters.

10 years agoia64: clean up old kernel headers cruft
Mike Frysinger [Tue, 28 Jul 2015 04:15:18 +0000 (00:15 -0400)] 
ia64: clean up old kernel headers cruft

This define made more sense in the pre-sanitized kernel headers days,
but since we require kernel versions that are sanitized, we don't need
this hack anymore.

10 years agopwd.h: revert __nonnull markings on putpwent [BZ #18641]
Mike Frysinger [Tue, 28 Jul 2015 03:43:09 +0000 (23:43 -0400)] 
pwd.h: revert __nonnull markings on putpwent [BZ #18641]

This function actually checks for NULL arguments and the API has been
tenatively documented as using EINVAL in that case.  We can debate
leaving it this way, but it should be done after the pending release.

10 years agoMark bug 2981 (elf/tst-audit* fail on MIPS) as fixed.
Joseph Myers [Mon, 27 Jul 2015 23:59:08 +0000 (23:59 +0000)] 
Mark bug 2981 (elf/tst-audit* fail on MIPS) as fixed.

Changes in support of -fno-plt also cause the elf/tst-audit* tests to
start passing on MIPS.  This patch duly marks the relevant bug as
fixed in ChangeLog and NEWS.

10 years agoFix spurious conform test failures
Andreas Schwab [Mon, 27 Jul 2015 14:04:40 +0000 (16:04 +0200)] 
Fix spurious conform test failures

10 years agoFixes extern protected data handling testcases elf/tst-protected1a
Chung-Lin Tang [Sun, 26 Jul 2015 12:27:18 +0000 (05:27 -0700)] 
Fixes extern protected data handling testcases elf/tst-protected1a
and elf/tst-protected1b for Nios II.

10 years agoAdd #include <string.h> to nptl/tst-join7mod.c to silence GCC warnings.
Chung-Lin Tang [Sun, 26 Jul 2015 07:54:27 +0000 (00:54 -0700)] 
Add #include <string.h> to nptl/tst-join7mod.c to silence GCC warnings.

10 years agoUpdate Nios II ulps file.
Chung-Lin Tang [Sat, 25 Jul 2015 14:14:29 +0000 (07:14 -0700)] 
Update Nios II ulps file.

10 years agoFix order of arguments to rt_sigprocmask syscall when setting the signal mask
Chung-Lin Tang [Sat, 25 Jul 2015 06:19:50 +0000 (23:19 -0700)] 
Fix order of arguments to rt_sigprocmask syscall when setting the signal mask
in setcontext/swapcontext.

10 years agoNaCl: Remove bogus O_SHLOCK, O_EXLOCK definitions.
Roland McGrath [Fri, 24 Jul 2015 19:31:23 +0000 (12:31 -0700)] 
NaCl: Remove bogus O_SHLOCK, O_EXLOCK definitions.

10 years agoUse IE model for static variables in libc.so, libpthread.so and rtld
Siddhesh Poyarekar [Fri, 24 Jul 2015 13:43:38 +0000 (19:13 +0530)] 
Use IE model for static variables in libc.so, libpthread.so and rtld

The recently introduced TLS variables in the thread-local destructor
implementation (__cxa_thread_atexit_impl) used the default GD access
model, resulting in a call to __tls_get_addr.  This causes a deadlock
with recent changes to the way TLS is initialized because DTV
allocations are delayed and hence despite knowing the offset to the
variable inside its TLS block, the thread has to take the global rtld
lock to safely update the TLS offset.

This causes deadlocks when a thread is instantiated and joined inside
a destructor of a dlopen'd DSO.  The correct long term fix is to
somehow not take the lock, but that will need a lot deeper change set
to alter the way in which the big rtld lock is used.

Instead, this patch just eliminates the call to __tls_get_addr for the
thread-local variables inside libc.so, libpthread.so and rtld by
building all of their units with -mtls-model=initial-exec.

There were concerns that the static storage for TLS is limited and
hence we should not be using it.  Additionally, dynamically loaded
modules may result in libc.so looking for this static storage pretty
late in static binaries.  Both concerns are valid when using TLSDESC
since that is where one may attempt to allocate a TLS block from
static storage for even those variables that are not IE.  They're not
very strong arguments for the traditional TLS model though, since it
assumes that the static storage would be used sparingly and definitely
not by default.  Hence, for now this would only theoretically affect
ARM architectures.

The impact is hence limited to statically linked binaries that dlopen
modules that in turn load libc.so, all that on arm hardware.  It seems
like a small enough impact to justify fixing the larger problem that
currently affects everything everywhere.

This still does not solve the original problem completely.  That is,
it is still possible to deadlock on the big rtld lock with a small
tweak to the test case attached to this patch.  That problem is
however not a regression in 2.22 and hence could be tackled as a
separate project.  The test case is picked up as is from Alex's patch.

This change has been tested to verify that it does not cause any
issues on x86_64.

ChangeLog:

[BZ #18457]
* nptl/Makefile (tests): New test case tst-join7.
(modules-names): New test case module tst-join7mod.
* nptl/tst-join7.c: New file.
* nptl/tst-join7mod.c: New file.
* Makeconfig (tls-model): Pass -ftls-model=initial-exec for
all translation units in libc.so, libpthread.so and rtld.