aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-07-24Use IE model for static variables in libc.so, libpthread.so and rtldSiddhesh Poyarekar6-9/+136
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.
2015-07-24Update powerpc-fpu libm-test-ulps.Adhemerval Zanella2-56/+156
2015-07-24Fixed several libmvec bugs found during testing on KNL hardware.Andrew Senkevich16-223/+220
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.
2015-07-24[ARM][BZ #17711] Fix extern protected data handlingSzabolcs Nagy3-3/+12
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
2015-07-24[AArch64][BZ #17711] Fix extern protected data handlingSzabolcs Nagy3-1/+11
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
2015-07-24Mention dl_load_lock by name in the commentsSiddhesh Poyarekar2-9/+15
Mention dl_load_lock by name instead of just 'load lock' in the comments. This makes it unambigious which lock we're talking about.
2015-07-23Make sysdeps/posix bring in login subdir.Roland McGrath7-25/+54
2015-07-23Add SIGWINCH to generic <bits/signum.h>.Roland McGrath2-4/+15
2015-07-23NaCl: Fix missing getdtablesize symbol.Roland McGrath3-0/+7
2015-07-23conform/linknamespace: whitelist matherrf/matherrlMike Frysinger2-2/+8
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.
2015-07-23ia64: sigaction.h: fix sa_flags orderingMike Frysinger2-1/+6
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>
2015-07-23Also use l_tls_dtor_count to decide on object unload (BZ #18657)Siddhesh Poyarekar8-36/+176
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.
2015-07-21ia64: msg.h: fix msg_qnum/msg_qbytes typesMike Frysinger2-4/+18
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.
2015-07-21ia64: stat.h: rename pad0 to __glibc_reserved0Mike Frysinger2-2/+8
This fixes the conform test for the stat.h header and makes it match all the other arches.
2015-07-21ia64: sifaction.h: change sa_flags to an intMike Frysinger2-1/+8
This fixes the conform test for the sigaction.h header and makes it match all the other arches.
2015-07-21ia64: siginfo.h: delete siginfo nameMike Frysinger2-1/+6
This fixes the conform test for the siginfo.h header and makes it match all the other arches.
2015-07-21NaCl: Use only nacl_irt_dev_filename, never nacl_irt_filename.Roland McGrath4-4/+7
2015-07-21Add abilist files and NEWS item for arm-nacl port.Roland McGrath12-0/+2538
2015-07-21tile: Fix BZ #18508 (makecontext yield infinite backtrace)Chris Metcalf3-4/+13
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.
2015-07-21locale: Remove obsolete repertoire map referencesMarko Myllynen84-96/+87
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.
2015-07-21locale: Do not define lang_ab for tcy_IN and bhb_INKhem Raj3-2/+8
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.
2015-07-20Reflect renaming of bh_IN and tu_IN in SUPPORTED file [BZ #17475]Khem Raj4-6/+17
2015-07-20sparc: fix sigaction for 32bit builds [BZ #18694]Mike Frysinger3-1/+16
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.
2015-07-21Remove Linuxism from tst-tls-atexitSiddhesh Poyarekar3-43/+64
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.
2015-07-21m68k: update libm test ULPsAndreas Schwab2-133/+315
2015-07-20tst-leaks: raise timeout to 5 secondsChris Metcalf2-0/+5
This test takes about 2.3 seconds on my tilegx system, and so times out. Bump it up to 5 seconds instead.
2015-07-20Add si_addr_bnd to _sigfault in x86 struct siginfoH.J. Lu3-1/+16
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.
2015-07-16Regenerate SPARC ULPs.David S. Miller2-239/+393
* sysdeps/sparc/fpu/libm-test-ulps: Regenerated.
2015-07-16libio: Fix fmemopen 'w' mode with provided bufferAdhemerval Zanella3-5/+12
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.
2015-07-16powerpc: strstr optimizationRajalakshmi Srinivasaraghavan7-1/+636
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.
2015-07-16hppa/ia64: _dl_unmap: make it hiddenMike Frysinger5-4/+11
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.
2015-07-16hppa/ia64: _dl_symbol_address: add PLT bypass for rtldMike Frysinger4-0/+10
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.
2015-07-16Add comment to clarify how the test can failSiddhesh Poyarekar2-0/+5
2015-07-16Whitespace fixup in cxa_thread_atexit_impl.cSiddhesh Poyarekar2-1/+3
2015-07-16Set NODELETE flag when opening already open objects with RTLD_NODELETESiddhesh Poyarekar6-8/+106
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.
2015-07-15Fix sparc build.David S. Miller6-2/+23
* 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.
2015-07-15Sort NEWSH.J. Lu1-3/+3
2015-07-15Correcting language code for Bhili and Tulu locales (bug 17475)Pravin Satpute6-41/+53
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.
2015-07-15Modify several tests to use test-skeleton.cArjun Shankar9-16/+73
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.
2015-07-15Modify elf/tst-audit9.c to use test-skeleton.cArjun Shankar2-1/+12
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.
2015-07-15tst-tzset: raise timeout to 5 secondsMike Frysinger2-0/+5
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.
2015-07-15i686: Mark stdlib/tst-makecontext as XFAIL.Stefan Liebler2-0/+11
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.
2015-07-15S390: Regenerate ULPsStefan Liebler2-28/+32
I've regenerated the ulps for s390 from scratch. ChangeLog: * sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2015-07-14Factor file identity rules out of generic rtld code.Roland McGrath6-12/+125
2015-07-14Fix up typo in tst-tls-atexitSiddhesh Poyarekar2-1/+5
2015-07-14Avoid C++ tests when the C++ cannot be linkedAdhemerval Zanella3-5/+15
* 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.
2015-07-14Fix up ChangeLogSiddhesh Poyarekar1-1/+1
2015-07-14Whitespace fix in tst-tls-atexit.cSiddhesh Poyarekar2-1/+5
2015-07-13Add AArch64 versions of math_opt_barrier and math_force_eval that avoid ↵Wilco Dijkstra2-0/+11
going via memory.
2015-07-13Optimize the strlen implementation by using a page cross check and a fast checkWilco Dijkstra2-65/+169
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.