]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
9 years agoconfigure: fix `test ==` usage gentoo/2.22
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 e2c17de539da301c96afa4181347c63eb94d99b1)

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)
(cherry picked from commit a07df04187284a7993d890d5164a4433cebfd930)

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)

(cherry picked from commit 740e642e32f600afd95d1bddcfd3a961e46a9472)

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)
(cherry picked from commit 5fc92dc17d6a2eb6420cef33d8d6bd3a84bb968c)

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)
(cherry picked from commit 942c502aca15983fde794e4465adbcf42b51c379)

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)
(cherry picked from commit d87bf6412b4cb0a5cd174d746eb596158075a5bb)

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)

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

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

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)
(cherry picked from commit 2b8ab5c3f618e4d9e0a9147c24f8cf6bbf35a1d8)

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)
(cherry picked from commit c95a56e2a8b16eeb911eed5c1bdc8fd26f337f4d)

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

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.

(cherry picked from commit 425c48c217ef93c2c4f81f9f3bb2fdba096877a2)

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)
(cherry picked from commit a33d347c181cfa0d84c37e9961ebf030495ed248)

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

(cherry picked from commit 3803874b4a368eb8245fbf091651b6c8edd90b23)

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)
(cherry picked from commit b995d95a5943785be3ab862b2d3276f3b4a22481)

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)
(cherry picked from commit 287de30e170cb765ed326d23d22791a81aab6e0f)

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)
(cherry picked from commit 43f189b0032fbce67fc0c0f4e122e917cd232670)

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)
(cherry picked from commit 84f80d5ea11fb3b6325c18c31ba0a6a99d5f68bb)

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)
(cherry picked from commit 7a5d3129638db8a832e2c3090d263bbc1b1b919b)

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)
(cherry picked from commit 0c5f5b233964aa97d1aa470488a1731c022ff615)

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.

(cherry picked from commit 3b54d911809643fb6a293807333b7f2cf15a3b50)

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

(cherry picked from commit cd51b1424477652cccdb83e7a95644d198fd4513)

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

(cherry picked from commit 13ff0739fdca293adab02b9f4fe78395de251086)

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.

(cherry picked from commit 060f8dbd0ca6eb17d20442dc4df72c2a707bdf86)

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)
(cherry picked from commit 387011e0b6f9cbefd26691f0df8ce76bb7ddfa03)

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)
(cherry picked from commit 5b319ce2949cf6fb97862ff81558944f76c704f1)

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)
(cherry picked from commit 5fb7924cb6cf606ce865122e5bbac9df934db14e)

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)
(cherry picked from commit 6c84109cfa26f35c3dfed3acb97d347361bd5849)

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.

(cherry picked from commit 9031106ea063f0476bdabf3f5ec22758cdcf987b)

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)
(cherry picked from commit dc22a1ec157d02529a0b17986679d3f1c122985e)

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)
(cherry picked from commit 666bb4dc55f5a93538d020024c34abad641f50ae)

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)
(cherry picked from commit 5c8c3123652045191474a4ca85fbb6e8d9e7d2bc)

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

(cherry picked from commit 36c6e27a26b0afe0187f8790990cf880abdbf244)

9 years ago[BZ #17250] Fix static dlopen default library search path
Maciej W. Rozycki [Fri, 25 Sep 2015 08:37:12 +0000 (09:37 +0100)] 
[BZ #17250] Fix static dlopen default library search path

Fix a regression introduced with commit 0d23a5c1 [Static dlopen
correction fallout fixes] that caused the default library search path to
be ignored for modules loaded with dlopen from static executables.

[BZ #17250]
* elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1
member.

(cherry picked from commit 93bad7c97c7047ecaf7664859e2b49c0fe995443)

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)
(cherry picked from commit 3007f797a1a596e954f44879a5a7267966186ba4)

9 years agomanual: skip build when perl is unavailable
Mike Frysinger [Thu, 23 Feb 2006 02:12:28 +0000 (21:12 -0500)] 
manual: skip build when perl is unavailable

Do not try to generate the manual when perl is unavailable.  This
matches the behavior when makeinfo is unavailable.  Otherwise the
install step fails when trying to generate the libm section since
it runs a perl script.

(cherry picked from commit 1695cdae065fa3693e7b18169a100f53444eac69)

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.

10 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)
(cherry picked from commit a34d1c6afc86521d6ad17662a3b5362d8481514c)

10 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)
(cherry picked from commit 561a9f11a974a447acb3dd03550a05df701a900e)

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

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 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 agonptl: fix set-but-unused warning w/_STACK_GROWS_UP
Mike Frysinger [Thu, 30 Jul 2015 02:53:28 +0000 (22:53 -0400)] 
nptl: fix set-but-unused warning w/_STACK_GROWS_UP

On arches that set _STACK_GROWS_UP, the stacktop variable is declared
and set, but never actually used.  Refactor the code a bit so that the
variable is only declared/set under _STACK_GROWS_DOWN settings.

10 years agodisable PIE when checking for PIC default
Kevin F. Quinn [Tue, 9 Sep 2014 21:41:57 +0000 (17:41 -0400)] 
disable PIE when checking for PIC default

When the compiler builds PIEs by default, the configure PIC check is
confused into thinking PIC code is default.  The end result is that
we end up with only PIC being produced.

Run the configure check with -fno-PIE so that we produce PIC & non-PIC
(PIE) objects like normal.

2014-09-09  Kevin F. Quinn  <kevquinn@gentoo.org>

* configure.ac (libc_cv_pic_default): Pass -fno-PIE.
* configure: Regenerated.

10 years agohppa: fix pthread spinlock
John David Anglin [Sun, 10 Aug 2014 13:54:53 +0000 (09:54 -0400)] 
hppa: fix pthread spinlock

10 years agohppa: fix build problems with atomic code
John David Anglin [Sun, 10 Aug 2014 13:39:25 +0000 (09:39 -0400)] 
hppa: fix build problems with atomic code

Specifically:
../sysdeps/unix/sysv/linux/hppa/bits/atomic.h:68:6: error:
can't find a register in class 'R1_REGS' while reloading 'asm'

10 years agoarm: fix PIC vs SHARED typos
David Lamparter [Fri, 16 Aug 2013 19:06:34 +0000 (15:06 -0400)] 
arm: fix PIC vs SHARED typos

the logic in setjmp/__longjmp incorrectly tie to "PIC" to figure out
whether the code is going into a shared library when it should be using
"SHARED".  otherwise, building static PIC code goes wrong.

https://bugs.gentoo.org/336914
http://sourceware.org/ml/libc-ports/2011-09/msg00018.html

2011-09-19  David Lamparter  <equinox-gentoo@diac24.net>

* sysdeps/arm/setjmp.S: Change PIC to SHARED.
* sysdeps/arm/__longjmp.S: Likewise

10 years agogentoo: disable building in timezone subdir
Mike Frysinger [Fri, 16 Aug 2013 19:05:26 +0000 (15:05 -0400)] 
gentoo: disable building in timezone subdir

We've split this out into the package sys-libs/timezone-data

10 years agogentoo: support running tests under sandbox
Stephanie J. Lockwood-Childs [Fri, 16 Aug 2013 19:03:41 +0000 (15:03 -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

10 years agortld: do not ignore arch-specific CFLAGS
Guy Martin [Fri, 16 Aug 2013 19:00:05 +0000 (15:00 -0400)] 
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

10 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

10 years agoreload /etc/resolv.conf when it has changed
Thorsten Kukuk [Fri, 16 Aug 2013 18:54:23 +0000 (14:54 -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

10 years agoFix localedef segfault when run under exec-shield, PaX or similar
Jakub Jelinek [Fri, 16 Aug 2013 18:52:25 +0000 (14:52 -0400)] 
Fix localedef segfault when run under exec-shield, PaX or similar

http://bugs.debian.org/198099
http://bugs.debian.org/231438

10 years agoworkaround crash when handling signals in static PIEs
Mike Frysinger [Sat, 4 May 2013 18:10:41 +0000 (14:10 -0400)] 
workaround crash when handling signals in static PIEs

work around ... not entirely sure what is going on here.

2011-03-01 squeezy  <vina@mailserver.eu>

* sysdeps/unix/sysv/linux/x86_64/sigaction.c fix the __restore_rt symbol

http://bugs.gentoo.org/283470

10 years agodisable ldconfig during install
Mike Frysinger [Sat, 4 May 2013 18:07:11 +0000 (14:07 -0400)] 
disable ldconfig during install

do not bother running ldconfig on DESTDIR.  it wants to write the temp cache
file outside of the chroot.  doesnt matter anyways as we wont use the cache
results (portage will rebuild cache), so running ldconfig is simply a waste
of time.

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

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.

10 years agoUpdate powerpc-fpu libm-test-ulps.
Adhemerval Zanella [Fri, 24 Jul 2015 13:21:56 +0000 (10:21 -0300)] 
Update powerpc-fpu libm-test-ulps.

10 years agoFixed several libmvec bugs found during testing on KNL hardware.
Andrew Senkevich [Fri, 24 Jul 2015 11:47:23 +0000 (14:47 +0300)] 
Fixed several libmvec bugs found during testing on KNL hardware.

AVX512 IFUNC implementations, implementations of wrappers to
AVX2 versions and KNL expf implementation fixed.

    * sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.S: Fixed AVX512 IFUNC.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Fixed wrappers to AVX2.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S: Fixed KNL
    implementation.

10 years ago[ARM][BZ #17711] Fix extern protected data handling
Szabolcs Nagy [Fri, 24 Jul 2015 09:05:07 +0000 (10:05 +0100)] 
[ARM][BZ #17711] Fix extern protected data handling

Fixes elf/tst-protected1a and elf/tst-protected1b tests.

Depends on a gcc patch that makes protected visibility data non-local:
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01871.html
and on a binutils patch so R_*_GLOB_DAT relocs are used for it:
https://sourceware.org/ml/binutils/2015-07/msg00247.html

10 years ago[AArch64][BZ #17711] Fix extern protected data handling
Szabolcs Nagy [Fri, 24 Jul 2015 08:57:32 +0000 (09:57 +0100)] 
[AArch64][BZ #17711] Fix extern protected data handling

Fixes elf/tst-protected1a and elf/tst-protected1b tests.

Depends on a gcc patch that makes protected visibility data non-local:
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01871.html
and on a binutils patch so R_*_GLOB_DAT relocs are used for it:
https://sourceware.org/ml/binutils/2015-07/msg00246.html

10 years agoMention dl_load_lock by name in the comments
Siddhesh Poyarekar [Fri, 24 Jul 2015 00:39:47 +0000 (06:09 +0530)] 
Mention dl_load_lock by name in the comments

Mention dl_load_lock by name instead of just 'load lock' in the
comments.  This makes it unambigious which lock we're talking about.

10 years agoMake sysdeps/posix bring in login subdir.
Roland McGrath [Fri, 24 Jul 2015 00:04:22 +0000 (17:04 -0700)] 
Make sysdeps/posix bring in login subdir.

10 years agoAdd SIGWINCH to generic <bits/signum.h>.
Roland McGrath [Thu, 23 Jul 2015 23:44:47 +0000 (16:44 -0700)] 
Add SIGWINCH to generic <bits/signum.h>.

10 years agoNaCl: Fix missing getdtablesize symbol.
Roland McGrath [Thu, 23 Jul 2015 22:54:21 +0000 (15:54 -0700)] 
NaCl: Fix missing getdtablesize symbol.

10 years agoconform/linknamespace: whitelist matherrf/matherrl
Mike Frysinger [Thu, 23 Jul 2015 03:11:10 +0000 (23:11 -0400)] 
conform/linknamespace: whitelist matherrf/matherrl

glibc supports the deprecated matherr hook for math error reporting.  The
conform tests take this into consideration and whitelist this symbol when
running linknamespace tests.

The ia64 libm code has long provided two additional hooks in this space:
matherrf (for floats)
matherrl (for long doubles)

Which causes the conform tests to fail with chains that all look like:
[initial] __atan2 ->
[libm.a(e_atan2.o)] __libm_error_support ->
[libm.a(libm_error.o)] matherrf

We can't (losslessly) redirect existing usage of these funcs to matherr
because the structure passed in is different -- matherr uses a struct with
doubles while matherrf/matherrl use floats and long doubles respectively.
Plus, this has been part of the exported ABI since glibc-2.2.3, so it
doesn't feel right to change it so late.

Until we get around to obsoleting matherr entirely, whitelist these two
additional ia64 symbols.

10 years agoia64: sigaction.h: fix sa_flags ordering
Mike Frysinger [Thu, 23 Jul 2015 07:27:04 +0000 (03:27 -0400)] 
ia64: sigaction.h: fix sa_flags ordering

Since ia64 is little endian, sa_flags has to come before the padding
when splitting it from 64bits to 32bits.

Reported-by: Joseph Myers <joseph@codesourcery.com>
10 years agoAlso use l_tls_dtor_count to decide on object unload (BZ #18657)
Siddhesh Poyarekar [Thu, 23 Jul 2015 05:46:18 +0000 (11:16 +0530)] 
Also use l_tls_dtor_count to decide on object unload (BZ #18657)

When an TLS destructor is registered, we set the DF_1_NODELETE flag to
signal that the object should not be destroyed.  We then clear the
DF_1_NODELETE flag when all destructors are called, which is wrong -
the flag could have been set by other means too.

This patch replaces this use of the flag by using l_tls_dtor_count
directly to determine whether it is safe to unload the object.  This
change has the added advantage of eliminating the lock taking when
calling the destructors, which could result in a deadlock.  The patch
also fixes the test case tst-tls-atexit - it was making an invalid
dlclose call, which would just return an error silently.

I have also added a detailed note on concurrency which also aims to
justify why I chose the semantics I chose for accesses to
l_tls_dtor_count.  Thanks to Torvald for his help in getting me
started on this and (literally) teaching my how to approach the
problem.

Change verified on x86_64; the test suite does not show any
regressions due to the patch.

ChangeLog:

[BZ #18657]
* elf/dl-close.c (_dl_close_worker): Don't unload DSO if there
are pending TLS destructor calls.
* include/link.h (struct link_map): Add concurrency note for
L_TLS_DTOR_COUNT.
* stdlib/cxa_thread_atexit_impl.c (__cxa_thread_atexit_impl):
Don't touch the link map flag.  Atomically increment
l_tls_dtor_count.
(__call_tls_dtors): Atomically decrement l_tls_dtor_count.
Avoid taking the load lock and don't touch the link map flag.
* stdlib/tst-tls-atexit-nodelete.c: New test case.
* stdlib/Makefile (tests): Use it.
* stdlib/tst-tls-atexit.c (do_test): dlopen
tst-tls-atexit-lib.so again before dlclose.  Add conditionals
to allow tst-tls-atexit-nodelete test case to use it.

10 years agoia64: msg.h: fix msg_qnum/msg_qbytes types
Mike Frysinger [Wed, 22 Jul 2015 02:44:48 +0000 (22:44 -0400)] 
ia64: msg.h: fix msg_qnum/msg_qbytes types

These two fields have dedicated types, so change the ia64 header to match
all the other arches.  This fixes the conform test for msg.h.

10 years agoia64: stat.h: rename pad0 to __glibc_reserved0
Mike Frysinger [Wed, 22 Jul 2015 02:42:37 +0000 (22:42 -0400)] 
ia64: stat.h: rename pad0 to __glibc_reserved0

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

10 years agoia64: sifaction.h: change sa_flags to an int
Mike Frysinger [Wed, 22 Jul 2015 02:40:25 +0000 (22:40 -0400)] 
ia64: sifaction.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 agoia64: siginfo.h: delete siginfo name
Mike Frysinger [Wed, 22 Jul 2015 02:34:48 +0000 (22:34 -0400)] 
ia64: siginfo.h: delete siginfo name

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

10 years agoNaCl: Use only nacl_irt_dev_filename, never nacl_irt_filename.
Roland McGrath [Tue, 21 Jul 2015 22:48:56 +0000 (15:48 -0700)] 
NaCl: Use only nacl_irt_dev_filename, never nacl_irt_filename.

10 years agoAdd abilist files and NEWS item for arm-nacl port.
Roland McGrath [Tue, 21 Jul 2015 20:31:21 +0000 (13:31 -0700)] 
Add abilist files and NEWS item for arm-nacl port.