external/glibc.git
9 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.

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

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

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

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

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

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

9 years agotile: Fix BZ #18508 (makecontext yield infinite backtrace)
Chris Metcalf [Tue, 21 Jul 2015 16:04:52 +0000 (12:04 -0400)]
tile: Fix BZ #18508 (makecontext yield infinite backtrace)

It turns out tile suffered from the same problem as S390.  However,
disabling CFI information for the __startcontext on tile was not
sufficient to fix the problem; I think the backtracer will just
blindly try to follow the link register (lr) in that case.

Instead, the change adds a cfi_undefined directive for "lr"
and then arranges to call __startcontext directly when the new
context starts, rather than just synthesizing a return to it.
In addition to being a bit easier now to understand the control
flow, this also allows the cfi_undefined directive to be placed in
a way that causes it to be in force at the address that the "lr"
from the called function points to.

9 years agolocale: Remove obsolete repertoire map references
Marko Myllynen [Wed, 13 May 2015 08:41:43 +0000 (11:41 +0300)]
locale: Remove obsolete repertoire map references

repertoire maps and character mnemonics were used early in the glibc
i18n/l10n effort but were quickly deprecated in favor of Unicode code
points. According to ChangeLog, the in-tree repertoire maps were
removed 2000-07-07 but some stray references remain even today. The
patch below removes them.

9 years agolocale: Do not define lang_ab for tcy_IN and bhb_IN
Khem Raj [Tue, 21 Jul 2015 06:39:42 +0000 (23:39 -0700)]
locale: Do not define lang_ab for tcy_IN and bhb_IN

After renaming localedef now complains and build fails

LC_ADDRESS: field `lang_ab' must not be defined

earlier the names were similar to lang_ab definitions 'tu' or 'bh'
but after rename they are not.

9 years agoReflect renaming of bh_IN and tu_IN in SUPPORTED file [BZ #17475]
Khem Raj [Fri, 17 Jul 2015 09:16:59 +0000 (02:16 -0700)]
Reflect renaming of bh_IN and tu_IN in SUPPORTED file [BZ #17475]

9 years agosparc: fix sigaction for 32bit builds [BZ #18694]
Mike Frysinger [Mon, 20 Jul 2015 11:29:15 +0000 (07:29 -0400)]
sparc: fix sigaction for 32bit builds [BZ #18694]

Commit a059d359d86130b5fa74e04a978c8523a0293f77 changed the sigaction
struct to pass conform tests, but it ended up also changing the ABI for
32 bit builds.  For 64 bit builds, changing the long to two ints works,
but for 32 bit builds, it inserts 4 extra bytes.  This leads to many
packages randomly failing like bash that spews things like:
configure: line 471: wait_for: No record of process 0

Bracket the new member by a wordsize check to fix the ABI for 32bit.

9 years agoRemove Linuxism from tst-tls-atexit
Siddhesh Poyarekar [Tue, 21 Jul 2015 01:44:16 +0000 (07:14 +0530)]
Remove Linuxism from tst-tls-atexit

The tst-tls-atexit test case searches for its module in /proc/PID/maps
to verify that it is unloaded, which is a Linux-specific test.  This
patch makes the test generic by looking for the library in the link
map list in the _r_debug structure.

Verified that the test continues to succeed on x86_64.  There is a bug
in the test case where it calls dlclose once again, which is actually
incorrect but still manages to unload the DSO thanks to an existing
bug in __tls_call_dtors.  This will be fixed in a later patch which
also fixes up the __cxa_thread_atexit_impl implementation.  I have
added a FIXME comment to that call momentarily, which I will remove
when I fix the problem.

* stdlib/tst-tls-atexit-lib.c (do_foo): Rename to reg_dtor.
* stdlib/tst-tls-atexit.c: (is_loaded): New function.
(spawn_thread): New function.
(load): Rename to reg_dtor_and_close.  Move dlopen to...
(do_test): ... here.  Use IS_LOADED to test for its
availability.

9 years agom68k: update libm test ULPs
Andreas Schwab [Mon, 20 Jul 2015 22:16:24 +0000 (00:16 +0200)]
m68k: update libm test ULPs

9 years agotst-leaks: raise timeout to 5 seconds
Chris Metcalf [Mon, 20 Jul 2015 21:32:34 +0000 (17:32 -0400)]
tst-leaks: raise timeout to 5 seconds

This test takes about 2.3 seconds on my tilegx system, and so
times out.  Bump it up to 5 seconds instead.

9 years agoAdd si_addr_bnd to _sigfault in x86 struct siginfo
H.J. Lu [Mon, 20 Jul 2015 18:54:39 +0000 (11:54 -0700)]
Add si_addr_bnd to _sigfault in x86 struct siginfo

X86 struct siginfo in kernel 3.19 has been changed by

commit ee1b58d36aa1b5a79eaba11f5c3633c88231da83
Author: Qiaowei Ren <qiaowei.ren@intel.com>
Date:   Fri Nov 14 07:18:19 2014 -0800

    mpx: Extend siginfo structure to include bound violation information

    This patch adds new fields about bound violation into siginfo
    structure. si_lower and si_upper are respectively lower bound
    and upper bound when bound violation is caused.

This patch updates x86 struct siginfo to enable GDB with MPX support.

[BZ #18696]
* sysdeps/unix/sysv/linux/x86/bits/siginfo.h (_sigfault): Add
si_addr_bnd.
(si_lower): New.
(si_upper): Likewise.

9 years agoRegenerate SPARC ULPs.
David S. Miller [Thu, 16 Jul 2015 19:03:33 +0000 (12:03 -0700)]
Regenerate SPARC ULPs.

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

9 years agolibio: Fix fmemopen 'w' mode with provided buffer
Adhemerval Zanella [Wed, 15 Jul 2015 19:15:47 +0000 (16:15 -0300)]
libio: Fix fmemopen 'w' mode with provided buffer

If 'w' mode is used with a provided buffer the fmemopen will try to find
the first null byte to set as maximum internal stream size.  It should be
done only for append mode ('a').

Kudos for Stefan Liebler for finding this error on s390-32.

* libio/fmemopen.c (__fmemopen): Fix 'w' openmode with provided
buffer.
* stdio-common/tst-fmemopen2.c (do_test_with_buffer): Fix typo and
fail output information.

9 years agopowerpc: strstr optimization
Rajalakshmi Srinivasaraghavan [Wed, 24 Jun 2015 06:08:21 +0000 (02:08 -0400)]
powerpc: strstr optimization

This patch optimizes strstr function for power >= 7 systems.  Performance
gain is obtained using aligned memory access and usage of cmpb
instruction for quicker comparison.  The average improvement of this
optimization is ~40%.  Tested on ppc64 and ppc64le.

2015-07-16  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>

* sysdeps/powerpc/powerpc64/multiarch/Makefile: Add strstr().
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
* sysdeps/powerpc/powerpc64/power7/strstr.S: New File.
* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: New File.
* sysdeps/powerpc/powerpc64/multiarch/strstr-ppc64.c: New File.
* sysdeps/powerpc/powerpc64/multiarch/strstr.c: New File.

9 years agohppa/ia64: _dl_unmap: make it hidden
Mike Frysinger [Wed, 15 Jul 2015 11:40:56 +0000 (07:40 -0400)]
hppa/ia64: _dl_unmap: make it hidden

This symbol is only used by DL_UNMAP which in turn is only used by
_dl_close_worker in dl-close.c, and _dl_close_worker itself is marked
hidden as it is only used by the ldso.  That means _dl_unmap should
be marked hidden.  Without this, the elf/check-localplt test fails.

9 years agohppa/ia64: _dl_symbol_address: add PLT bypass for rtld
Mike Frysinger [Wed, 15 Jul 2015 11:37:47 +0000 (07:37 -0400)]
hppa/ia64: _dl_symbol_address: add PLT bypass for rtld

This symbol is defined in the ldso, and is used both there and libc.so.
There is no hidden symbol for it though which leads to relocations in
the ldso and the elf/check-localplt test failing.  Add a hidden def for
rtld to fix all of that.

This function/file is only used by hppa & ia64, so no testing is needed
for other arches.

9 years agoAdd comment to clarify how the test can fail
Siddhesh Poyarekar [Thu, 16 Jul 2015 05:08:29 +0000 (10:38 +0530)]
Add comment to clarify how the test can fail

9 years agoWhitespace fixup in cxa_thread_atexit_impl.c
Siddhesh Poyarekar [Thu, 16 Jul 2015 03:24:39 +0000 (08:54 +0530)]
Whitespace fixup in cxa_thread_atexit_impl.c

9 years agoSet NODELETE flag when opening already open objects with RTLD_NODELETE
Siddhesh Poyarekar [Thu, 16 Jul 2015 03:23:28 +0000 (08:53 +0530)]
Set NODELETE flag when opening already open objects with RTLD_NODELETE

The DF_1_NODELETE flag is set too late when opening a DSO, due to
which, if a DSO is already open, subsequently opening it with
RTLD_NODELETE fails to set the DF_1_NODELETE flag.  This patch fixes
this by setting the flag immediately after bumping the opencount.

Verified on x86_64.

[BZ #18676]
* elf/tst-nodelete-opened.c: New test case.
* elf/tst-nodelete-opened-lib.c: New test case module.
* elf/Makefile (tests, modules-names): Use them.
* elf/dl-open.c (dl_open_worker): Set DF_1_NODELETE flag
early.

9 years agoFix sparc build.
David S. Miller [Wed, 15 Jul 2015 22:22:48 +0000 (15:22 -0700)]
Fix sparc build.

* sysdeps/sparc/nptl/pthread_barrier_init.c: Include
futex-intenal.h
* sysdeps/sparc/sparc32/sparcv9/Makefile (nscd): Add cpu_relax.
* sysdeps/sparc/sparc64/Makefile: Likewise.
* sysdeps/sparc/sparc32/sparcv9/bits/atomic.h (atomic_spin_nop):
Remove space from macro define.
* sysdeps/sparc/sparc64/bits/atomic.h (atomic_spin_nop): Likewise.

9 years agoSort NEWS
H.J. Lu [Wed, 15 Jul 2015 12:38:01 +0000 (05:38 -0700)]
Sort NEWS

9 years agoCorrecting language code for Bhili and Tulu locales (bug 17475)
Pravin Satpute [Wed, 15 Jul 2015 10:36:17 +0000 (16:06 +0530)]
Correcting language code for Bhili and Tulu locales (bug 17475)

Bhili [1] and Tulu [2] language does not have iso-639-1 codes. Patch
moves locale file with correct code and also fix iso-639.def.

1. http://www-01.sil.org/iso639-3/documentation.asp?id=bhb
2. http://www-01.sil.org/iso639-3/documentation.asp?id=tcy

localedata/ChangeLog:

2015-07-02  Pravin Satpute  <psatpute@redhat.com>

[BZ #17475]
        * locales/tu_IN: renamed to tcy_IN
* locales/bh_IN: renamed to bhb_IN

Changelog:

2015-03-05  Pravin Satpute  <psatpute@redhat.com>

[BZ #17475]
* locale/iso-639.def: Update Bhili and Tulu language codes as
per iso639-3.

9 years agoModify several tests to use test-skeleton.c
Arjun Shankar [Thu, 9 Jul 2015 15:29:17 +0000 (15:29 +0000)]
Modify several tests to use test-skeleton.c

These tests were skipped by the use-test-skeleton conversion done in
commit 29955b5d because they were reused in other tests via the #include
directive, and so deemed worth an inspection before they were modified.
This has now been done.

ChangeLog:

2015-07-09  Arjun Shankar  <arjun.is@lostca.se>

* elf/tst-leaks1.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* localedata/tst-langinfo.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* math/test-fpucw.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* math/test-tgmath.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* math/test-tgmath2.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* setjmp/tst-setjmp.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* stdio-common/tst-sscanf.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.
* sysdeps/x86_64/tst-audit6.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.

9 years agoModify elf/tst-audit9.c to use test-skeleton.c
Arjun Shankar [Thu, 9 Jul 2015 14:51:30 +0000 (14:51 +0000)]
Modify elf/tst-audit9.c to use test-skeleton.c

This test was skipped by the use-test-skeleton conversion script
[29955b5d] because the definition of `main' did not begin according to
the GNU formatting style that the script assumed.

ChangeLog:

2015-07-09  Arjun Shankar  <arjun.is@lostca.se>

* elf/tst-audit9.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
Include test-skeleton.c.

9 years agotst-tzset: raise timeout to 5 seconds
Mike Frysinger [Wed, 15 Jul 2015 07:46:03 +0000 (03:46 -0400)]
tst-tzset: raise timeout to 5 seconds

This test is reliably taking 2.3 seconds on my system, and the default
is 2 seconds, so it always times out.  Bump it up to 5 seconds instead.

9 years agoi686: Mark stdlib/tst-makecontext as XFAIL.
Stefan Liebler [Wed, 15 Jul 2015 07:33:15 +0000 (09:33 +0200)]
i686: Mark stdlib/tst-makecontext as XFAIL.

The testcase stdlib/tst-makecontext fails on i686 because
_Unwind_Backtrace from libgcc produces a segmentation fault if it was
called within a context created by makecontext. See Bug 18635.

ChangeLog:

* sysdeps/i386/i686/Makefile (test-xfail-tst-makecontext):
New variable.

9 years agoS390: Regenerate ULPs
Stefan Liebler [Wed, 15 Jul 2015 07:33:14 +0000 (09:33 +0200)]
S390: Regenerate ULPs

I've regenerated the ulps for s390 from scratch.

ChangeLog:

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

9 years agoFactor file identity rules out of generic rtld code.
Roland McGrath [Tue, 14 Jul 2015 20:15:26 +0000 (13:15 -0700)]
Factor file identity rules out of generic rtld code.

9 years agoFix up typo in tst-tls-atexit
Siddhesh Poyarekar [Tue, 14 Jul 2015 14:57:09 +0000 (20:27 +0530)]
Fix up typo in tst-tls-atexit

9 years agoAvoid C++ tests when the C++ cannot be linked
Adhemerval Zanella [Tue, 14 Jul 2015 13:50:05 +0000 (10:50 -0300)]
Avoid C++ tests when the C++ cannot be linked

* elf/Makefile [ifeq (yes,$(build-shared)) (tests)] (tst-nodelete):
Add iff $CXX is set.
[ifeq (yes,$(build-shared)) (modules-names)] (tst-nodelete-rtldmod):
Likewise.
(tst-nodelete-zmodiff): Likewise.
* nptl/Makefile [[ifeq (,$(CXX))] (tests-unsupported)]: Add tst-once5.

9 years agoFix up ChangeLog
Siddhesh Poyarekar [Tue, 14 Jul 2015 14:15:16 +0000 (19:45 +0530)]
Fix up ChangeLog

9 years agoWhitespace fix in tst-tls-atexit.c
Siddhesh Poyarekar [Tue, 14 Jul 2015 14:14:55 +0000 (19:44 +0530)]
Whitespace fix in tst-tls-atexit.c

9 years agoAdd AArch64 versions of math_opt_barrier and math_force_eval that avoid going via...
Wilco Dijkstra [Mon, 13 Jul 2015 11:48:33 +0000 (12:48 +0100)]
Add AArch64 versions of math_opt_barrier and math_force_eval that avoid going via memory.

9 years agoOptimize the strlen implementation by using a page cross check and a fast check
Wilco Dijkstra [Mon, 13 Jul 2015 11:38:12 +0000 (12:38 +0100)]
Optimize the strlen implementation by using a page cross check and a fast check
for nul bytes which reverts to separate loop when a non-ASCII char is encountered.
Speedup on test-strlen is ~10%, long ASCII strings are processed ~60% faster,
and on random tests it is ~80% better.

9 years agoReplace %ld with %jd and cast to intmax_t
H.J. Lu [Sat, 11 Jul 2015 20:41:47 +0000 (13:41 -0700)]
Replace %ld with %jd and cast to intmax_t

On x32, GCC 5.1 complains:

tst-fmemopen2.c: In function â€˜do_test_without_buffer’:
tst-fmemopen2.c:124:15: error: format â€˜%ld’ expects argument of type â€˜long int’, but argument 2 has type â€˜off_t {aka long long int}’ [-Werror=format=]
       printf ("FAIL: first ftello returned %ld, expected %zu\n", o, nstr);
               ^
tst-fmemopen2.c:135:15: error: format â€˜%ld’ expects argument of type â€˜long int’, but argument 2 has type â€˜off_t {aka long long int}’ [-Werror=format=]
       printf ("FAIL: second ftello returned %ld, expected %zu\n", o, nbuf);
               ^
tst-fmemopen2.c:148:15: error: format â€˜%ld’ expects argument of type â€˜long int’, but argument 2 has type â€˜off_t {aka long long int}’ [-Werror=format=]
       printf ("FAIL: third ftello returned %ld, expected %zu\n", o, nstr2);
               ^
tst-fmemopen2.c: In function â€˜do_test_length_zero’:
tst-fmemopen2.c:183:15: error: format â€˜%ld’ expects argument of type â€˜long int’, but argument 2 has type â€˜off_t {aka long long int}’ [-Werror=format=]
       printf ("FAIL: first ftello returned %ld, expected 0\n", o);
               ^

This patch silences GCC.

* stdio-common/tst-fmemopen2.c (do_test_without_buffer): Replace
%ld with %jd and cast to intmax_t.
(do_test_length_zero): Likewise.

9 years agoNaCl: Make pthread_condattr_setclock reject CLOCK_MONOTONIC.
Roland McGrath [Fri, 10 Jul 2015 21:18:14 +0000 (14:18 -0700)]
NaCl: Make pthread_condattr_setclock reject CLOCK_MONOTONIC.

9 years agotile: Regenerate ULPs.
Chris Metcalf [Fri, 10 Jul 2015 20:16:37 +0000 (16:16 -0400)]
tile: Regenerate ULPs.

Regenerated from scratch on tilegx.

9 years agomath/test-fenvinline: avoid compiler warning
Chris Metcalf [Fri, 10 Jul 2015 20:11:40 +0000 (16:11 -0400)]
math/test-fenvinline: avoid compiler warning

On tile (and any other machine with no FP exceptions) the
feenable_test() function will generate a "function defined but
not used" warning because all of the callers are commented out.
We already were ifdef'ing out the body of the function, so instead
just ifdef out the entire function if FE_ALL_EXCEPT == 0.

9 years agoRemove unnecessary mutex locks from tst-tls-atexit test case
Siddhesh Poyarekar [Fri, 10 Jul 2015 17:53:57 +0000 (23:23 +0530)]
Remove unnecessary mutex locks from tst-tls-atexit test case

The locks don't synchronize with anything - they were likely
introduced initially to synchronize with some main thread code, but
that is no longer evident.

9 years agoAvoid boolean coercion in tst-tls-atexit test case
Siddhesh Poyarekar [Fri, 10 Jul 2015 17:50:28 +0000 (23:20 +0530)]
Avoid boolean coercion in tst-tls-atexit test case

9 years agoClean up semaphore EINTR handling after Linux futex docs clarification.
Torvald Riegel [Mon, 8 Jun 2015 21:14:20 +0000 (23:14 +0200)]
Clean up semaphore EINTR handling after Linux futex docs clarification.

The Linux kernel futex documentation now states that since Linux 2.6.22,
FUTEX_WAIT does return EINTR only when interrupted by a signal, and not
spuriously anymore.  We only support more recent kernels, so clean up
EINTR handling in the semaphore and update the comments.

9 years agoAdd and use new glibc-internal futex API.
Torvald Riegel [Thu, 4 Dec 2014 13:12:23 +0000 (14:12 +0100)]
Add and use new glibc-internal futex API.

This adds new functions for futex operations, starting with wait,
abstimed_wait, reltimed_wait, wake.  They add documentation and error
checking according to the current draft of the Linux kernel futex manpage.

Waiting with absolute or relative timeouts is split into separate functions.
This allows for removing a few cases of code duplication in pthreads code,
which uses absolute timeouts; also, it allows us to put platform-specific
code to go from an absolute to a relative timeout into the platform-specific
futex abstractions..

Futex operations that can be canceled are also split out into separate
functions suffixed by "_cancelable".

There are separate versions for both Linux and NaCl; while they currently
differ only slightly, my expectation is that the separate versions of
lowlevellock-futex.h will eventually be merged into futex-internal.h
when we get to move the lll_ functions over to the new futex API.

9 years agoThe patch committed to fix bug #18435 caused regressions on aarch64
Martin Sebor [Thu, 9 Jul 2015 23:25:38 +0000 (19:25 -0400)]
The patch committed to fix bug #18435 caused regressions on aarch64
and also powerpc64 and powerpc64le. See the discussion in the thread
below for details. This change reverts the problematic bits leaving
the added test in place and marking XFAIL in anticipation of fixing
the bug in the near future.
https://sourceware.org/ml/libc-alpha/2015-07/msg00141.html

[BZ #18435]
* nptl/pthreadP.h (pthread_cleanup_push, pthread_cleanup_pop):
Revert commit ed225df3ad9cbac3c22ec3f0fbbed1f9c61d1c54.
* nptl/Makefile (test-xfail-tst-once5): Define.

9 years agoProvide __libc_fatal for rtld.
Roland McGrath [Thu, 9 Jul 2015 22:32:32 +0000 (15:32 -0700)]
Provide __libc_fatal for rtld.

9 years agoPLT avoidance for _exit in rtld.
Roland McGrath [Thu, 9 Jul 2015 22:25:47 +0000 (15:25 -0700)]
PLT avoidance for _exit in rtld.

9 years agoImprove bndmov encoding with zero displacement
H.J. Lu [Thu, 9 Jul 2015 16:30:09 +0000 (09:30 -0700)]
Improve bndmov encoding with zero displacement

If x86-64 assembler doesn't support MPX, we encode bndmov instruction by
hand.  When displacement is zero, assembler generates shorter encoding.
This patch improves bndmov encoding with zero displacement so that ld.so
is identical when using assemblers with and without MPX support.

* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Improve
bndmov encoding with zero displacement.

9 years agoPreserve bound registers for pointer pass/return
Igor Zamyatin [Thu, 9 Jul 2015 13:50:12 +0000 (06:50 -0700)]
Preserve bound registers for pointer pass/return

We need to save/restore bound registers and add a BND prefix before
branches in _dl_runtime_profile so that bound registers for pointer
pass and return are preserved when LD_AUDIT is used.

[BZ #18134]
* sysdeps/i386/configure.ac: Set HAVE_MPX_SUPPORT.
* sysdeps/i386/configure: Regenerated.
* sysdeps/i386/dl-trampoline.S (PRESERVE_BND_REGS_PREFIX): New.
(_dl_runtime_profile): Save and restore Intel MPX return bound
registers when calling _dl_call_pltexit.  Add
PRESERVE_BND_REGS_PREFIX before return.
* sysdeps/i386/link-defines.sym (LRV_BND0_OFFSET): New.
(LRV_BND1_OFFSET): Likewise.
* sysdeps/x86/bits/link.h (La_i86_retval): Add lrv_bnd0 and
lrv_bnd1.
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix
typo in bndmov encoding.
* sysdeps/x86_64/dl-trampoline.h: Properly save and restore
Intel MPX bound registers.  Add PRESERVE_BND_REGS_PREFIX before
branch instructions to preserve bounds.

9 years agolibio: Update powerpc64le libc.abilist
Adhemerval Zanella [Thu, 9 Jul 2015 13:27:02 +0000 (13:27 +0000)]
libio: Update powerpc64le libc.abilist

This patch adds the missing fmemopen entry for powerpc64le libc abilist
check file.

* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist

9 years agohurd: permit to use mlock from non-root process
Samuel Thibault [Thu, 9 Jul 2015 11:56:30 +0000 (13:56 +0200)]
hurd: permit to use mlock from non-root process

* sysdeps/mach/hurd/mlock.c (mlock): When __get_privileged_ports
returns an error, also try to use host port from __mach_host_self for
the __vm_wire call.
* sysdeps/mach/hurd/munlock.c (munlock): Likewise.

9 years ago[AArch64][BZ 18648] change greg_t definition in ucontext.h
Szabolcs Nagy [Thu, 9 Jul 2015 08:53:30 +0000 (09:53 +0100)]
[AArch64][BZ 18648] change greg_t definition in ucontext.h

This is an ABI breaking change, but

typedef int greg_t;

is not a useful definition on aarch64.

greg_t is usually used for defining gregset_t which is used
in mcontext_t.  The general registers in mcontext_t can only
be accessed by target specific code and on aarch64 greg_t
is not needed for that so this change is not supposed to break
existing code, just fix the definition.

[BZ #18648]
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (greg_t): Change the
definition to elf_greg_t.

(Added another BZ entry that was missed in the previous commit).

9 years ago[AArch64][BZ 18400] fix elf_prpsinfo in procfs.h
Szabolcs Nagy [Thu, 9 Jul 2015 08:39:51 +0000 (09:39 +0100)]
[AArch64][BZ 18400] fix elf_prpsinfo in procfs.h

Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.

This is an ABI breaking change, but the size and alignment of
the struct and the layout of other members is not changed and
there is no known usage of pr_uid and pr_gid so it is expected
to be safe.

[BZ #18400]
* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (struct elf_prpsinfo):
Fix pr_uid and pr_gid members.

9 years agoBZ#18383: Conditionalize test-xfail-tst-tlsalign{,-static} on ARM assembler bug.
Roland McGrath [Wed, 8 Jul 2015 22:00:43 +0000 (15:00 -0700)]
BZ#18383: Conditionalize test-xfail-tst-tlsalign{,-static} on ARM assembler bug.

9 years agoFix some places to use $(LN_S) makefile variable.
Roland McGrath [Wed, 8 Jul 2015 21:21:41 +0000 (14:21 -0700)]
Fix some places to use $(LN_S) makefile variable.

9 years agoInstall a dummy <rpc/netdb.h> when not building sunrpc/.
Roland McGrath [Wed, 8 Jul 2015 20:38:50 +0000 (13:38 -0700)]
Install a dummy <rpc/netdb.h> when not building sunrpc/.

9 years agolibio: Update tst-fmemopen2.c
Adhemerval Zanella [Fri, 13 Jun 2014 20:38:32 +0000 (17:38 -0300)]
libio: Update tst-fmemopen2.c

This patch updates tst-fmemopen2 to check for fmemopen with NULL buffer
inputs and also refactor the code a bit.

The test relies on a POSIX compliant fmemopen implementation.

* stdio-common/tst-fmemopen2.c (do_test): Add test for NULL and zero
length buffers.
* stdio-common/tst-fmemopen.c (do_test): Refactor to use
test-skeleton.c.

9 years agolibio: fmemopen rewrite to POSIX compliance
Adhemerval Zanella [Mon, 9 Jun 2014 19:19:25 +0000 (16:19 -0300)]
libio: fmemopen rewrite to POSIX compliance

This patch added a new fmemopen version, for glibc 2.22, that aims to be
POSIX complaint.  It fixes some long-stading glibc fmemopen issues, such
as:

* it changes the way fseek with SEEK_END works on fmemopen to seek
  relative to buffer size instead of first '\0'.  This is default mode and
  'b' opening mode does not change internal behavior (bz#6544).

* fix apending opening mode to use as start position either first null
  byte of len specified in function call (bz#13152 and #13151).

* remove binary option 'b' and internal different handling (bz#12836)

* fix seek/SEE_END with negative values (bz#14292).

A compatibility symbol is provided to with old behavior for older symbols
version (2.2.5).

* include/stdio.h (fmemopen): Remove hidden prototype.
(__fmemopen): Add new hidden prototype.
* libio/Makefile: Add oldfmemopen object.
* libio/Versions [GLIBC_2.22]: Add new fmemopen symbol.
* libio/fmemopen.c (__fmemopen): Function rewrite to be POSIX
compliance.
* libio/oldfmemopen.c: New file: old fmemopen implementation for
symbol compatibility.
* stdio-common/Makefile [tests]: Add new tst-fmemopen3.
* stdio-common/psiginfo.c [psiginfo]: Call __fmemopen instead of
fmemopen.
* stdio-common/tst-fmemopen3.c: New file: more fmemopen tests, focus
on append and read mode.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.22]: Add
fmemopen.
* sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist [GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist [GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist [GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
[GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist [GLIBC_2.22]:
Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist [GLIBC_2.22]: Likewise.

9 years agoAdd missing Advanced API (RFC3542) (1) defines.
Carlos O'Donell [Wed, 8 Jul 2015 13:26:45 +0000 (09:26 -0400)]
Add missing Advanced API (RFC3542) (1) defines.

Fixes bug 18643.

Defines IPV6_RECVPATHMTU, IPV6_PATHMTU, and IPV6_DONTFRAG for Linux.

9 years agoUse "|" instead of "+" when combine the _IO_LINE_BUF and _IO_UNBUFFERED flags
Feng Gao [Wed, 8 Jul 2015 08:10:50 +0000 (13:40 +0530)]
Use "|" instead of "+" when combine the _IO_LINE_BUF and _IO_UNBUFFERED flags

Both of "_IO_UNBUFFERED" and "_IO_LINE_BUF"  are the bit flags, but I
find there are some codes looks like "_IO_LINE_BUF+_IO_UNBUFFERED",
while some codes are "_IO_LINE_BUF|_IO_UNBUFFERED".

I think the former is not good, even though the final result is same.

9 years agonscd: drop selinux/flask.h include
Mike Frysinger [Sat, 30 May 2015 18:55:16 +0000 (14:55 -0400)]
nscd: drop selinux/flask.h include

Building nscd w/selinux enabled yields a warning which yields an error:
In file included from selinux.c:32:0:
/usr/include/selinux/flask.h:5:2: error:
 #warning "Please remove any #include's of this header in your source code."

I've done just that and it builds cleanly with libselinux-2.4.

9 years agopwd.h: add __nonnull markings [BZ #18641]
Mike Frysinger [Sat, 30 May 2015 17:33:22 +0000 (13:33 -0400)]
pwd.h: add __nonnull markings [BZ #18641]

Mark all the functions that don't handle NULL pointers as __nonnull.
POSIX does not require either behavior, so the prototypes should match
the reality of the codebase.

9 years agoFix ruserok scalability with large ~/.rhosts file.
Carlos O'Donell [Wed, 8 Jul 2015 06:42:11 +0000 (02:42 -0400)]
Fix ruserok scalability with large ~/.rhosts file.

Fixes bug 18557.

The ruserok API does hosts checks first while it walks the
user's ~/.rhosts file. This results in lots of DNS queries
that could have been skipped if we short-circuit test the
user portion first to see if would have had a failed match.

This supports configurations where rlogin is used on internal
secure networks with large numbers of users and machines.

The Red Hat QE team did extensive testing on various rlogin
combinations to validate this change, and in fact we found
a defect in the first version which is fixed in this version.

9 years agoAdd forced deletion support to _dl_close_worker
Pavel Kopyl [Tue, 7 Jul 2015 15:45:46 +0000 (18:45 +0300)]
Add forced deletion support to _dl_close_worker

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

I've a shared library that contains both undefined and unique symbols.
Then I try to call the following sequence of dlopen:

1. dlopen("./libfoo.so", RTLD_NOW)
2. dlopen("./libfoo.so", RTLD_LAZY | RTLD_GLOBAL)

First dlopen call terminates with error because of undefined symbols,
but STB_GNU_UNIQUE ones set DF_1_NODELETE flag and hence block library
in the memory.

The library goes into inconsistent state as several structures remain
uninitialized. For instance, relocations for GOT table were not performed.

By the time of second dlopen call this library looks like as it would be
fully initialized but this is not true: any call through incorrect GOT
table leads to segmentation fault.  On some systems this inconsistency
triggers assertions in the dynamic linker.

This patch adds a parameter to _dl_close_worker to implement forced object
deletion in case of dlopen() failure:

1. Clears DF_1_NODELETE bit if forced, to allow library to be removed from
memory.
2. For each unique symbol that is defined in this object clears
appropriate entry in _ns_unique_sym_table.

[BZ #17833]
* elf/Makefile (tests): Add tst-nodelete.
(modules-names): Add tst-nodelete-uniquemod.
(tst-nodelete-uniquemod.so-no-z-defs): New.
(tst-nodelete-rtldmod.so-no-z-defs): Likewise.
(tst-nodelete-zmod.so-no-z-defs): Likewise.
($(objpfx)tst-nodelete): Likewise.
($(objpfx)tst-nodelete.out): Likewise.
(LDFLAGS-tst-nodelete): Likewise.
(LDFLAGS-tst-nodelete-zmod.so): Likewise.
* elf/dl-close.c (_dl_close_worker): Add a parameter to
implement forced object deletion.
(_dl_close): Pass false to _dl_close_worker.
* elf/dl-open.c (_dl_open): Pass true to _dl_close_worker.
* elf/tst-nodelete.cc: New file.
* elf/tst-nodeletelib.cc: Likewise.
* elf/tst-znodeletelib.cc: Likewise.
* include/dlfcn.h (_dl_close_worker): Add a new parameter.

9 years agoS390: Fix "backtrace() returns infinitely deep stack frames with makecontext()" ...
Stefan Liebler [Tue, 7 Jul 2015 14:11:14 +0000 (16:11 +0200)]
S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()" [BZ #18508].

On s390/s390x backtrace(buffer, size) returns the series of called functions until
"makecontext_ret" and additional entries (up to "size") with "makecontext_ret".
GDB-backtrace is also warning:
"Backtrace stopped: previous frame identical to this frame (corrupt stack?)"

To reproduce this scenario you have to setup a new context with makecontext()
and activate it with setcontext(). See e.g. cf() function in testcase stdlib/tst-makecontext.c.
Or see bug in libgo "Bug 66303 - runtime.Caller() returns infinitely deep stack frames
on s390x " (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66303).

This patch omits the cfi_startproc/cfi_endproc directives in ENTRY/END macro of
__makecontext_ret. Thus no frame information is generated in .eh_frame and backtrace
stops after __makecontext_ret. There is also no .eh_frame info for _start or
thread_start functions.

ChangeLog:

[BZ #18508]
* stdlib/Makefile ($(objpfx)tst-makecontext3):
Depend on $(libdl).
* stdlib/tst-makecontext.c (cf): Test if _Unwind_Backtrace
is not called infinitely times.
(backtrace_helper): New function.
(trace_arg): New struct.
(st1): Enlarge stack size.
* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:
(__makecontext_ret): Omit cfi_startproc and cfi_endproc.
* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S:
Likewise.

9 years agoS390: Regenerate ULPs.
Stefan Liebler [Tue, 7 Jul 2015 14:11:14 +0000 (16:11 +0200)]
S390: Regenerate ULPs.

Regenerated ulps after recent changes.
Tested on s390/s390x.
All math-tests passes on s390 after this patch.

ChangeLog:

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

9 years agoS390: Fix sem.h conformance test failures.
Stefan Liebler [Tue, 7 Jul 2015 14:11:14 +0000 (16:11 +0200)]
S390: Fix sem.h conformance test failures.

On s390 the following tests are failing due to unkown types time_t, pid_t:
FAIL: conform/UNIX98/sys/sem.h/conform
FAIL: conform/XOPEN2K/sys/sem.h/conform
FAIL: conform/XOPEN2K8/sys/sem.h/conform
FAIL: conform/XPG3/sys/sem.h/conform
FAIL: conform/XPG4/sys/sem.h/conform

This patch changes the s390 specific sem.h and includes sys/types.h instead
of bits/types.h. All other archs include sys/types.h, too.
Including bits/wordsize.h is obselete, because it is already inlcuded in
sys/types.h -> bits/types.h.

ChangeLog:

* sysdeps/unix/sysv/linux/s390/bits/sem.h:
Include sys/types.h instead of bits/types.h.
Remove inclusion of bits/wordsize.h.

9 years agoAdd la_symbind32 to x86-64 audit tests
H.J. Lu [Tue, 7 Jul 2015 13:09:29 +0000 (06:09 -0700)]
Add la_symbind32 to x86-64 audit tests

la_symbind32 is used for x32 in x86-64 audit tests.  We should define
both la_symbind32 and la_symbind64 in x86-64 audit tests.

* sysdeps/x86_64/tst-auditmod10b.c (la_symbind32): New.
* sysdeps/x86_64/tst-auditmod4b.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod5b.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod6b.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod6c.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod7b.c (la_symbind32): Likewise.

9 years agoAdd and use sysdeps/i386/link-defines.sym
H.J. Lu [Tue, 7 Jul 2015 12:23:24 +0000 (05:23 -0700)]
Add and use sysdeps/i386/link-defines.sym

Define macros for fields in La_i86_regs and La_i86_retval and use them
in dl-trampoline.S, instead of hardcoded values.

* sysdeps/i386/Makefile (gen-as-const-headers)[elf]: Add
link-defines.sym.
* sysdeps/i386/dl-trampoline.S: Include <link-defines.h>.
(_dl_runtime_profile): Use LONG_DOUBLE_SIZE, LRV_SIZE,
LRV_EAX_OFFSET, LRV_EDX_OFFSET, LRV_ST0_OFFSET, LRV_ST1_OFFSET
and LR_SIZE.
* sysdeps/i386/link-defines.sym: New file.

9 years agoAdd a testcase for i386 LD_AUDIT
H.J. Lu [Tue, 7 Jul 2015 12:09:16 +0000 (05:09 -0700)]
Add a testcase for i386 LD_AUDIT

This patch adds a testcase for i386 LD_AUDIT to check function return
and parameters passed in registers.

* sysdeps/i386/Makefile (tests)[elf]: Add tst-audit3.
(modules-names): Add tst-auditmod3a tst-auditmod3b.
($(objpfx)tst-audit3): New rule.
($(objpfx)tst-audit3.out): Likewise.
* sysdeps/i386/tst-audit3.c: New file.
* sysdeps/i386/tst-audit3.h: Likewise.
* sysdeps/i386/tst-auditmod3a.c: Likewise.
* sysdeps/i386/tst-auditmod3b.c: Likewise.

9 years agoDo not create invalid pointers in C code of string functions.
Torvald Riegel [Fri, 3 Jul 2015 18:35:26 +0000 (20:35 +0200)]
Do not create invalid pointers in C code of string functions.

Some of the x86 string functions create pointers based on input strings
that may be outside of the input strings.  When this happens in C code,
the compiler can potentially detect this, leading to warnings in
application code when those string functions are inlined.  Perform those
operations in the assembly code instead of the C code to fix this.

9 years agoUpdate NEWS
Andreas Schwab [Tue, 7 Jul 2015 10:29:14 +0000 (12:29 +0200)]
Update NEWS

9 years agoSet errno to ENOMEM on overflow in sbrk (bug 18592)
Cyril Hrubis [Wed, 20 May 2015 11:50:00 +0000 (13:50 +0200)]
Set errno to ENOMEM on overflow in sbrk (bug 18592)

9 years agoInline __ieee754_sqrt and __ieee754_sqrtf. Also add external definitions.
Wilco Dijkstra [Mon, 6 Jul 2015 11:43:31 +0000 (12:43 +0100)]
Inline __ieee754_sqrt and __ieee754_sqrtf. Also add external definitions.

9 years agoRemove unused file sysdeps/ieee754/support.c
Wilco Dijkstra [Thu, 4 Jun 2015 12:11:43 +0000 (13:11 +0100)]
Remove unused file sysdeps/ieee754/support.c

9 years ago[AArch64] make setcontext etc functions consistent with the kernel
Szabolcs Nagy [Mon, 6 Jul 2015 11:46:43 +0000 (12:46 +0100)]
[AArch64] make setcontext etc functions consistent with the kernel

since
https://sourceware.org/ml/libc-alpha/2014-04/msg00006.html
setcontext etc is no longer tied to the kernel use of ucontext.

in that patch the ucontext reserved space is not used consistently
with the kernel abi: the d8,d9 pair is saved in the slot of q8.

this is ok (*context functions work together), but probably not
desirable (ucontexts created by the kernel and getcontext are
subtly different).

the fix just replaces dN with qN in the save/restore code, which
does a bit more than needed (saves/restores the top half of qN that
is not callee saved), but this should not be an issue (and avoids
having to deal with endianness).

(kernel fpsimd context layout: the first 64bit contains 0x210 the fpsimd
context size and 0x46508001 the FPSIMD_MAGIC, the second 64bit is for
fpsr and fpcr, and the rest is the 128bit q0..q31 registers).

given d8=8.1, d9=9.1,... d15=15.1, the context created by getcontext is

current:

(gdb) x/40xg ctx.uc_mcontext.__reserved
0x410df0 <ctx+464>:     0x0000021046508001      0x0000000000000000
0x410e00 <ctx+480>:     0x0000000000000000      0x0000000000000000
0x410e10 <ctx+496>:     0x0000000000000000      0x0000000000000000
0x410e20 <ctx+512>:     0x0000000000000000      0x0000000000000000
0x410e30 <ctx+528>:     0x0000000000000000      0x0000000000000000
0x410e40 <ctx+544>:     0x0000000000000000      0x0000000000000000
0x410e50 <ctx+560>:     0x0000000000000000      0x0000000000000000
0x410e60 <ctx+576>:     0x0000000000000000      0x0000000000000000
0x410e70 <ctx+592>:     0x0000000000000000      0x0000000000000000
0x410e80 <ctx+608>:     0x4020333333333333      0x4022333333333333
0x410e90 <ctx+624>:     0x0000000000000000      0x0000000000000000
0x410ea0 <ctx+640>:     0x4024333333333333      0x4026333333333333
0x410eb0 <ctx+656>:     0x0000000000000000      0x0000000000000000
0x410ec0 <ctx+672>:     0x4028333333333333      0x402a333333333333
0x410ed0 <ctx+688>:     0x0000000000000000      0x0000000000000000
0x410ee0 <ctx+704>:     0x402c333333333333      0x402e333333333333
0x410ef0 <ctx+720>:     0x0000000000000000      0x0000000000000000
0x410f00 <ctx+736>:     0x0000000000000000      0x0000000000000000
0x410f10 <ctx+752>:     0x0000000000000000      0x0000000000000000
0x410f20 <ctx+768>:     0x0000000000000000      0x0000000000000000

fixed:

(gdb) x/40xg ctx.uc_mcontext.__reserved
0x410d70 <ctx+464>:     0x0000021046508001      0x0000000000000000
0x410d80 <ctx+480>:     0x0000000000000000      0x0000000000000000
0x410d90 <ctx+496>:     0x0000000000000000      0x0000000000000000
0x410da0 <ctx+512>:     0x0000000000000000      0x0000000000000000
0x410db0 <ctx+528>:     0x0000000000000000      0x0000000000000000
0x410dc0 <ctx+544>:     0x0000000000000000      0x0000000000000000
0x410dd0 <ctx+560>:     0x0000000000000000      0x0000000000000000
0x410de0 <ctx+576>:     0x0000000000000000      0x0000000000000000
0x410df0 <ctx+592>:     0x0000000000000000      0x0000000000000000
0x410e00 <ctx+608>:     0x4020333333333333      0x0000000000000000
0x410e10 <ctx+624>:     0x4022333333333333      0x0000000000000000
0x410e20 <ctx+640>:     0x4024333333333333      0x0000000000000000
0x410e30 <ctx+656>:     0x4026333333333333      0x0000000000000000
0x410e40 <ctx+672>:     0x4028333333333333      0x0000000000000000
0x410e50 <ctx+688>:     0x402a333333333333      0x0000000000000000
0x410e60 <ctx+704>:     0x402c333333333333      0x0000000000000000
0x410e70 <ctx+720>:     0x402e333333333333      0x0000000000000000
0x410e80 <ctx+736>:     0x0000000000000000      0x0000000000000000
0x410e90 <ctx+752>:     0x0000000000000000      0x0000000000000000
0x410ea0 <ctx+768>:     0x0000000000000000      0x0000000000000000

2015-07-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>

* sysdeps/unix/sysv/linux/aarch64/getcontext.S (__getcontext): Use q
registers instead of d ones so the layout is kernel abi compatible.
* sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext): Likewise.
* sysdeps/unix/sysv/linux/aarch64/swapcontext.S (__swapcontext):
Likewise.# Please enter the commit message for your changes. Lines starting

9 years agoRegenerate aarch64 libm-test-ulps
Szabolcs Nagy [Thu, 2 Jul 2015 13:58:12 +0000 (14:58 +0100)]
Regenerate aarch64 libm-test-ulps

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

9 years agoFix ldbl-128 expm1l (-min_subnorm) result sign (bug 18619).
Joseph Myers [Wed, 1 Jul 2015 22:27:49 +0000 (22:27 +0000)]
Fix ldbl-128 expm1l (-min_subnorm) result sign (bug 18619).

In the ldbl-128 implementation of expm1l, when expm1l's result should
underflow to 0 (argument minus the least subnormal, in some rounding
modes), it can be a zero of the wrong sign.  This patch fixes this in
the same way previously used for the x86 / x86_64 versions.

Tested for mips64.

[BZ #18619]
* sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Force underflow
and return argument in case of subnormal argument.

9 years agoThe C++ 2011 std::call_once function is specified to allow
Martin Sebor [Wed, 1 Jul 2015 20:05:27 +0000 (14:05 -0600)]
The C++ 2011 std::call_once function is specified to allow
the initialization routine to exit by throwing an exception.
Such an execution, termed exceptional, requires call_once to
propagate the exception to its caller.  A program may contain
any number of exceptional executions but only one returning
execution (which, if it exists, must be the last execution
with the same once flag).

On POSIX systems such as Linux, std::call_once is implemented
in terms of pthread_once.  However, as discussed in libstdc++
bug 66146 - "call_once not C++11-compliant on ppc64le," GLIBC's
pthread_once hangs when the initialization function exits by
throwing an exception on at least arm and ppc64 (though
apparently not on x86_64).  This effectively prevents call_once
from conforming to the C++ requirements since there doesn't
appear to be a thread-safe way to work around this problem in
libstdc++.

This patch changes pthread_once to handle gracefully init
functions that exit by throwing exceptions. It was successfully
tested on ppc64, ppc64le, and x86_64.

        [BZ #18435]
        * nptl/Makefile: Add tst-once5.cc.
        * nptl/pthreadP.h (pthread_cleanup_push, pthread_cleanup_pop):
        Remove macro redefinitions.
        * nptl/tst-once5.cc: New test.

9 years agoRegenerate powerpc-nofpu libm-test-ulps.
Joseph Myers [Wed, 1 Jul 2015 18:04:28 +0000 (18:04 +0000)]
Regenerate powerpc-nofpu libm-test-ulps.

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

9 years agoRegenerate ARM libm-test-ulps.
Joseph Myers [Wed, 1 Jul 2015 17:50:15 +0000 (17:50 +0000)]
Regenerate ARM libm-test-ulps.

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

9 years agoRegenerate MIPS libm-test-ulps.
Joseph Myers [Wed, 1 Jul 2015 17:24:37 +0000 (17:24 +0000)]
Regenerate MIPS libm-test-ulps.

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

9 years agoRemove documentation of lowlevellock systemtap probes.
Torvald Riegel [Tue, 30 Jun 2015 15:05:44 +0000 (17:05 +0200)]
Remove documentation of lowlevellock systemtap probes.

The probes are not provided on all architectures (and only partially by the
x86 assembly implementation), and we are not aware of actual uses of these
probes.
a need for them.

9 years agoClean up BUSY_WAIT_NOP and atomic_delay.
Torvald Riegel [Tue, 23 Jun 2015 13:22:25 +0000 (15:22 +0200)]
Clean up BUSY_WAIT_NOP and atomic_delay.

This patch combines BUSY_WAIT_NOP and atomic_delay into a new
atomic_spin_nop function and adjusts all clients.  The new function is
put into atomic.h because what is best done in a spin loop is
architecture-specific, and atomics must be used for spinning.  The
function name is meant to tell users that this has no effect on
synchronization semantics but is a performance aid for spinning.

9 years agoImprove tgamma accuracy (bug 18613).
Joseph Myers [Mon, 29 Jun 2015 23:29:35 +0000 (23:29 +0000)]
Improve tgamma accuracy (bug 18613).

In non-default rounding modes, tgamma can be slightly less accurate
than permitted by glibc's accuracy goals.

Part of the problem is error accumulation, addressed in this patch by
setting round-to-nearest for internal computations.  However, there
was also a bug in the code dealing with computing pow (x + n, x + n)
where x + n is not exactly representable, providing another source of
error even in round-to-nearest mode; it was necessary to address both
bugs to get errors for all testcases within glibc's accuracy goals.
Given this second fix, accuracy in round-to-nearest mode is also
improved (hence regeneration of ulps for tgamma should be from scratch
- truncate libm-test-ulps or at least remove existing tgamma entries -
so that the expected ulps can be reduced).

Some additional complications also arose.  Certain tgamma tests should
strictly, according to IEEE semantics, overflow or not depending on
the rounding mode; this is beyond the scope of glibc's accuracy goals
for any function without exactly-determined results, but
gen-auto-libm-tests doesn't handle being lax there as it does for
underflow.  (libm-test.inc also doesn't handle being lax about whether
the result in cases very close to the overflow threshold is infinity
or a finite value close to overflow, but that doesn't cause problems
in this case though I've seen it cause problems with random test
generation for some functions.)  Thus, spurious-overflow markings,
with a comment, are added to auto-libm-test-in (no bug in Bugzilla
because the issue is with the testsuite, not a user-visible bug in
glibc).  And on x86, after the patch I saw ERANGE issues as previously
reported by Carlos (see my commentary in
<https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html>), which
needed addressing by ensuring excess range and precision were
eliminated at various points if FLT_EVAL_METHOD != 0.

I also noticed and fixed a cosmetic issue where 1.0f was used in long
double functions and should have been 1.0L.

This completes the move of all functions to testing in all rounding
modes with ALL_RM_TEST, so gen-libm-have-vector-test.sh is updated to
remove the workaround for some functions not using ALL_RM_TEST.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #18613]
* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Take log of
X_ADJ not X when adjusting exponent.
(__ieee754_gamma_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Take log
of X_ADJ not X when adjusting exponent.
(__ieee754_gammaf_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.
* sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive): Take
log of X_ADJ not X when adjusting exponent.
(__ieee754_gammal_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.  Use 1.0L not 1.0f as numerator of division.
* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive): Take
log of X_ADJ not X when adjusting exponent.
(__ieee754_gammal_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.  Use 1.0L not 1.0f as numerator of division.
* sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive): Take log
of X_ADJ not X when adjusting exponent.
(__ieee754_gammal_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.  Use 1.0L not 1.0f as numerator of division.
* math/libm-test.inc (tgamma_test_data): Remove one test.  Moved
to auto-libm-test-in.
(tgamma_test): Use ALL_RM_TEST.
* math/auto-libm-test-in: Add one test of tgamma.  Mark some other
tests of tgamma with spurious-overflow.
* math/auto-libm-test-out: Regenerated.
* math/gen-libm-have-vector-test.sh: Do not check for START.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoFix ldbl-128 j1l spurious underflows (bug 18612).
Joseph Myers [Mon, 29 Jun 2015 17:51:32 +0000 (17:51 +0000)]
Fix ldbl-128 j1l spurious underflows (bug 18612).

The ldbl-128 implementation of j1l produces spurious underflow
exceptions for some small arguments, as a result of squaring the
argument.  This patch fixes it just to use a linear approximation for
sufficiently small arguments, and then to force an underflow exception
only in the cases where it is required.

Tested for mips64.

[BZ #18612]
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): For small
arguments, just return 0.5 times the argument, with underflow
forced as needed.
* math/auto-libm-test-in: Add more tests of j1.
* math/auto-libm-test-out: Regenerated.

9 years agoFix j1, jn missing underflows (bug 16559).
Joseph Myers [Mon, 29 Jun 2015 16:52:16 +0000 (16:52 +0000)]
Fix j1, jn missing underflows (bug 16559).

Similar to various other bugs in this area, j1 and jn implementations
can fail to raise the underflow exception when the internal
computation is exact although the actual function is inexact.  This
patch forces the exception in a similar way to other such fixes.  (The
ldbl-128 / ldbl-128ibm j1l implementation is different and doesn't
need a change for this until spurious underflows in it are fixed.)

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16559]
* sysdeps/ieee754/dbl-64/e_j1.c: Include <float.h>.
(__ieee754_j1): Force underflow exception for small results.
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c: Include <float.h>.
(__ieee754_j1f): Force underflow exception for small results.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_j1l.c: Include <float.h>.
(__ieee754_j1l): Force underflow exception for small results.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
* math/auto-libm-test-in: Add more tests of j1 and jn.
* math/auto-libm-test-out: Regenerated.

9 years agoUpdate headers for Linux 4.0, 4.1 definitions.
Joseph Myers [Mon, 29 Jun 2015 14:38:46 +0000 (14:38 +0000)]
Update headers for Linux 4.0, 4.1 definitions.

This patch updates installed glibc headers for new definitions from
Linux 4.0 and 4.1 that seem relevant to glibc headers.  In addition, I
noticed that PF_IB / AF_IB, added in Linux 3.11, were missing for no
obvious reason, so added those as well.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

* sysdeps/unix/sysv/linux/bits/in.h (IP_CHECKSUM): New macro.
* sysdeps/unix/sysv/linux/bits/socket.h (PF_IB): Likewise.
(PF_MPLS): Likewise.
(AF_IB): Likewise.
(AF_MPLS): Likewise.
* sysdeps/unix/sysv/linux/sys/mount.h (MS_LAZYTIME): New enum
value and macro.
(MS_RMT_MASK): Include MS_LAZYTIME.

9 years agomalloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE [BZ #18502]
Mel Gorman [Mon, 8 Jun 2015 12:36:13 +0000 (13:36 +0100)]
malloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE [BZ #18502]

mksquashfs was reported in openSUSE to be causing segmentation faults when
creating installation images. Testing showed that mksquashfs sometimes
failed and could be reproduced within 10 attempts. The core dump looked
like the heap top was corrupted and was pointing to an unmapped area. In
other cases, this has been due to an application corrupting glibc structures
but mksquashfs appears to be fine in this regard.

The problem is that heap_trim is "growing" the top into unmapped space.
If the top chunk == MINSIZE then top_area is -1 and this check does not
behave as expected due to a signed/unsigned comparison

  if (top_area <= pad)
    return 0;

The next calculation extra = ALIGN_DOWN(top_area - pad, pagesz) calculates
extra as a negative number which also is unnoticed due to a signed/unsigned
comparison. We then call shrink_heap(heap, negative_number) which crashes
later. This patch adds a simple check against MINSIZE to make sure extra
does not become negative. It adds a cast to hint to the reader that this
is a signed vs unsigned issue.

Without the patch, mksquash fails within 10 attempts. With it applied, it
completed 1000 times without error. The standard test suite "make check"
showed no changes in the summary of test results.

9 years agoAdd support for DT_MIPS_RLD_MAP_REL.
Matthew Fortune [Thu, 11 Jun 2015 09:43:48 +0000 (10:43 +0100)]
Add support for DT_MIPS_RLD_MAP_REL.

This tag allows debugging of MIPS position independent executables
and provides access to shared library information.

* elf/elf.h (DT_MIPS_RLD_MAP_REL): New macro.
(DT_MIPS_NUM): Update.
* sysdeps/mips/dl-machine.h (ELF_MACHINE_DEBUG_SETUP): Handle
DT_MIPS_RLD_MAP_REL.

9 years agoUse round-to-nearest internally in jn, test with ALL_RM_TEST (bug 18602).
Joseph Myers [Thu, 25 Jun 2015 21:46:02 +0000 (21:46 +0000)]
Use round-to-nearest internally in jn, test with ALL_RM_TEST (bug 18602).

Some existing jn tests, if run in non-default rounding modes, produce
errors above those accepted in glibc, which causes problems for moving
tests of jn to use ALL_RM_TEST.  This patch makes jn set rounding
to-nearest internally, as was done for yn some time ago, then computes
the appropriate underflowing value for results that underflowed to
zero in to-nearest, and moves the tests to ALL_RM_TEST.  It does
nothing about the general inaccuracy of Bessel function
implementations in glibc, though it should make jn more accurate on
average in non-default rounding modes through reduced error
accumulation.  The recomputation of results that underflowed to zero
should as a side-effect fix some cases of bug 16559, where jn just
used an exact zero, but that is *not* the goal of this patch and other
cases of that bug remain unfixed.

(Most of the changes in the patch are reindentation to add new scopes
for SET_RESTORE_ROUND*.)

Tested for x86_64, x86, powerpc and mips64.

[BZ #16559]
[BZ #18602]
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Set
round-to-nearest internally then recompute results that
underflowed to zero in the original rounding mode.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise
* math/libm-test.inc (jn_test): Use ALL_RM_TEST.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoMore correct description of linking with vector math library.
Andrew Senkevich [Thu, 25 Jun 2015 16:46:50 +0000 (19:46 +0300)]
More correct description of linking with vector math library.

    * NEWS: Fixed description of link with vector math library.

9 years agoFix buffer overflow for writes to memory buffer stream (bug 18549)
Andreas Schwab [Thu, 25 Jun 2015 09:53:06 +0000 (11:53 +0200)]
Fix buffer overflow for writes to memory buffer stream (bug 18549)

9 years agoSupport compilers defaulting to PIE
H.J. Lu [Thu, 25 Jun 2015 09:37:04 +0000 (02:37 -0700)]
Support compilers defaulting to PIE

To support building glibc with GCC 6 configured with --enable-default-pie,
which generates PIE by default, we need to build programs as PIE.  But
elf/tst-dlopen-aout must not be built as PIE since it tests dlopen on
ET_EXEC file and PIE is ET_DYN.

[BZ #17841]
* Makeconfig (no-pie-ldflag): New.
(+link): Set to $(+link-pie) if default to PIE.
(+link-tests): Set to $(+link-pie-tests) if default to PIE.
* config.make.in (build-pie-default): New.
* configure.ac (libc_cv_pie_default): New.  Set to yes if -fPIE
is default.  AC_SUBST.
* configure: Regenerated.
* elf/Makefile (LDFLAGS-tst-dlopen-aout): New.

9 years agoNPTL: Use unsigned type for setxid_futex.
Roland McGrath [Thu, 25 Jun 2015 01:09:32 +0000 (18:09 -0700)]
NPTL: Use unsigned type for setxid_futex.

9 years agoUse unsigned types for counters in getaddrinfo_a code.
Roland McGrath [Thu, 25 Jun 2015 00:58:12 +0000 (17:58 -0700)]
Use unsigned types for counters in getaddrinfo_a code.

9 years agoUse unsigned types for counters in AIO code.
Roland McGrath [Thu, 25 Jun 2015 00:43:32 +0000 (17:43 -0700)]
Use unsigned types for counters in AIO code.