about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* tunables: Fix environment variable processing for setuid binaries (bz #21073)Siddhesh Poyarekar2017-02-029-35/+511
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Florian Weimer pointed out that we have three different kinds of environment variables (and hence tunables): 1. Variables that are removed for setxid processes 2. Variables that are ignored in setxid processes but is passed on to child processes 3. Variables that are passed on to child processes all the time Tunables currently only does (2) and (3) when it should be doing (1) for MALLOC_CHECK_. This patch enhances the is_secure flag in tunables to an enum value that can specify which of the above three categories the tunable (and its envvar alias) belongs to. The default is for tunables to be in (1). Hence, all of the malloc tunables barring MALLOC_CHECK_ are explicitly specified to belong to category (2). There were discussions around abolishing category (2) completely but we can do that as a separate exercise in 2.26. Tested on x86_64 to verify that there are no regressions. [BZ #21073] * elf/dl-tunable-types.h (tunable_seclevel_t): New enum. * elf/dl-tunables.c (tunables_strdup): Remove. (get_next_env): Also return the previous envp. (parse_tunables): Erase tunables of category TUNABLES_SECLEVEL_SXID_ERASE. (maybe_enable_malloc_check): Make MALLOC_CHECK_ TUNABLE_SECLEVEL_NONE if /etc/setuid-debug is accessible. (__tunables_init)[TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring]: Update GLIBC_TUNABLES envvar after parsing. [TUNABLES_FRONTEND != TUNABLES_FRONTEND_valstring]: Erase tunable envvars of category TUNABLES_SECLEVEL_SXID_ERASE. * elf/dl-tunables.h (struct _tunable): Change member is_secure to security_level. * elf/dl-tunables.list: Add security_level annotations for all tunables. * scripts/gen-tunables.awk: Recognize and generate enum values for security_level. * elf/tst-env-setuid.c: New test case. * elf/tst-env-setuid-tunables: new test case. * elf/Makefile (tests-static): Add them.
* alpha: Use saturating arithmetic in memchrRichard Henderson2017-02-012-1/+9
|
* Fix missing test dependencyAndreas Schwab2017-02-012-0/+4
|
* m68k: fix 64bit atomic opsAndreas Schwab2017-02-012-6/+15
|
* Add ipc_priv.h header for Nios II to set __IPC_64 to zero.Chung-Lin Tang2017-01-312-0/+25
|
* Add VZEROUPPER to memset-vec-unaligned-erms.S [BZ #21081]H.J. Lu2017-01-302-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Since memset-vec-unaligned-erms.S has VDUP_TO_VEC0_AND_SET_RETURN at function entry, memset optimized for AVX2 and AVX512 will always use ymm/zmm register. VZEROUPPER should be placed before ret in L(stosb): movq %rdx, %rcx movzbl %sil, %eax movq %rdi, %rdx rep stosb movq %rdx, %rax ret since it can be reached from L(stosb_more_2x_vec): cmpq $REP_STOSB_THRESHOLD, %rdx ja L(stosb) [BZ #21081] * sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S (L(stosb)): Add VZEROUPPER before ret.
* Bug 20116: Fix use after free in pthread_create()Carlos O'Donell2017-01-2817-55/+479
| | | | | | | | | | | | | | | | | | The commit documents the ownership rules around 'struct pthread' and when a thread can read or write to the descriptor. With those ownership rules in place it becomes obvious that pd->stopped_start should not be touched in several of the paths during thread startup, particularly so for detached threads. In the case of detached threads, between the time the thread is created by the OS kernel and the creating thread checks pd->stopped_start, the detached thread might have already exited and the memory for pd unmapped. As a regression test we add a simple test which exercises this exact case by quickly creating detached threads with large enough stacks to ensure the thread stack cache is bypassed and the stacks are unmapped. Before the fix the testcase segfaults, after the fix it works correctly and completes without issue. For a detailed discussion see: https://www.sourceware.org/ml/libc-alpha/2017-01/msg00505.html
* nptl: Add tst-robust-forkFlorian Weimer2017-01-2717-1/+531
|
* string/tst-strcoll-overflow: Do not accept timeout as test resultFlorian Weimer2017-01-253-24/+32
| | | | The test completes within 300 seconds if enough memory is available.
* * soft-fp/op-common.h (_FP_MUL, _FP_FMA, _FP_DIV): AddJakub Jelinek2017-01-242-0/+10
| | | | /* FALLTHRU */ comments.
* Add missing bugzilla reference in previous ChangeLog entryAdhemerval Zanella2017-01-241-0/+1
|
* Bug 21053: sh: Reduce namespace pollution from sys/ucontext.hJames Clarke2017-01-244-68/+78
| | | | | | | | | | | | | | | | | | | | | | | The problem is basically that sys/ucontext.h is defining R0..R15 which happens to conflict with some packages like Firefox when trying to build on SH. The very same problem existed on arm back then [1] and it was fixed by renaming R0..R15 to REG_R0..REG_R15. This patch imploy a similar strategy for SH. Checked on sh4-linux-gnu with run-built-tests=no and I also got reports that it fixes Firefox build on Debian sh4. * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: Use new REG_R* constants instead of the old R* ones. * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGPREG): Rename... (NGREG): ... to this, to fit in with other architectures. (gpregset_t): Use new NGREG macro. [__USE_GNU]: Remove condition; all architectures other than tile are unconditional. (R*): Rename to REG_R*.
* * elf/dl-tunables.c (tunable_set_val_if_valid_range): Split into ...DJ Delorie2017-01-202-4/+33
| | | | | | (tunable_set_val_if_valid_range_signed) ... this, and ... (tunable_set_val_if_valid_range_unsigned) ... this. (tunable_initialize): Call the correct one of the above based on type.
* Remove very old libm-test-ulps entries.Joseph Myers2017-01-206-208/+6
| | | | | | | | | | | | | | | | | | | | | | I noticed that some libm-test-ulps files still had long-obsolete entries for *_tonearest functions, which will no longer be used since functions with FE_TONEAREST explicitly set aren't tested separately from those functions with it as the default rounding mode any more. This patch removes those obsolete entries. However, as they are a sign of libm-test-ulps not having been regenerated from scratch for a long time, I strongly advise people testing on those platforms to remove / truncate the libm-test-ulps file, run "make regen-ulps" and commit the regenerated-from-scratch file. (Ideally any failures of libm tests still present after regeneration would be investigated / fixed - there are several open "math" bugs spread across these platforms - but simply regenerating from scratch improves things.) * sysdeps/hppa/fpu/libm-test-ulps: Remove *_tonearest entries. * sysdeps/ia64/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise. * sysdeps/microblaze/libm-test-ulps: Likewise. * sysdeps/sh/libm-test-ulps: Likewise.
* Update README.libm-test.Joseph Myers2017-01-202-0/+13
| | | | | | | | | This patch updates math/README.libm-test to have a more complete and up-to-date list of the characters used in TEST_* macros to indicate the types of function inputs and outputs. * math/README.libm-test: Update list of characters for input and output types.
* powerpc: Fix adapt_count update in __lll_unlock_elisionTulio Magno Quites Machado Filho2017-01-202-1/+6
| | | | | Commit e9a96ea1aca4ebaa7c86e8b83b766f118d689d0f had an error that prevents adapt_count from being updated in __lll_unlock_elision.
* Fix mutex pretty printer test and pretty printer output.Torvald Riegel2017-01-204-21/+43
| | | | | | | | | | | | | | | | | | This fixes the mutex pretty printer so that, if the owner ID isn't recorded (such as in the current lock elision implementation), "Owner ID" will be shown as "Unknown" instead of 0. It also changes the mutex printer output so that it says "Acquired" instead of "Locked". The mutex tests are updated accordingly. In addition, this adds a paragraph to the "Known issues" section of the printers README explaining that the printer output isn't guaranteed to cover every detail. 2017-01-14 Martin Galvan <martingalvan@sourceware.org> * README.pretty-printers (Known issues): Warn about printers not always covering everything. * nptl/nptl-printers.py (MutexPrinter): Change output. * nptl/test-mutex-printers.py: Fix test and adapt to changed output.
* S390: Adjust lock elision code after review.Stefan Liebler2017-01-205-43/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adjusts s390 specific lock elision code after review of the following patches: -S390: Use own tbegin macro instead of __builtin_tbegin. (8bfc4a2ab4bebdf86c151665aae8a266e2f18fb4) -S390: Use new __libc_tbegin_retry macro in elision-lock.c. (53c5c3d5ac238901c13f28a73ba05b0678094e80) -S390: Optimize lock-elision by decrementing adapt_count at unlock. (dd037fb3df286b7c2d0b0c6f8d02a2dd8a8e8a08) The futex value is not tested before starting a transaction, __glibc_likely is used instead of __builtin_expect and comments are adjusted. ChangeLog: * sysdeps/unix/sysv/linux/s390/htm.h: Adjust comments. * sysdeps/unix/sysv/linux/s390/elision-unlock.c: Likewise. * sysdeps/unix/sysv/linux/s390/elision-lock.c: Adjust comments. (__lll_lock_elision): Do not test futex before starting a transaction. Use __glibc_likely instead of __builtin_expect. * sysdeps/unix/sysv/linux/s390/elision-trylock.c: Adjust comments. (__lll_trylock_elision): Do not test futex before starting a transaction. Use __glibc_likely instead of __builtin_expect.
* Add target to incorporate translations from translations.orgSiddhesh Poyarekar2017-01-202-0/+15
| | | | | | | | | | | Add a convenience target for maintainers to download and incorporate translation updates from translations.org. Invoke as follows: make -r PARALLELMFLAGS="" -C ../po objdir=`pwd` update-translations similar to generating libc.pot. * po/Makefile (update-translations): New target.
* Restore clock_* librt exports for MicroBlaze (bug 21061).Joseph Myers2017-01-192-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | MicroBlaze had clock_* functions exported from librt in glibc 2.18 and 2.19, as confirmed in <https://sourceware.org/ml/libc-alpha/2017-01/msg00369.html>, and they then disappeared in 2.20, presumably as a result of the fix <https://sourceware.org/ml/libc-alpha/2014-02/msg00598.html> for a Versions.def bug that had resulted in their unintended inclusion in 2.18 (followed by removal of the Versions.def mechanism that allowed such bugs). As they were released in that library, they should be considered part of the GLIBC_2.18 ABI and so restored for the sake of any binaries that expect them in that library. This patch restores them by adding a MicroBlaze version of clock-compat.c that overrides SHLIB_COMPAT. Tested (compilation only) with build-many-glibcs.py (where this fixes the librt ABI test failure; elf/check-execstack still fails and still needs architecture maintainer attention to fix it or XFAIL it with an appropriate explanatory comment). [BZ #21061] * sysdeps/unix/sysv/linux/microblaze/clock-compat.c: New file.
* Fix environment traversal when an envvar value is emptySiddhesh Poyarekar2017-01-204-2/+69
| | | | | | | | | | | | | | The condition when the value of an envvar is empty (not just '\0'), the loop in tunables_init gets stuck infinitely because envp is not incremented. Fix that by always incrementing envp in the loop. Added test case (tst-empty-env.c) verifies the fix when the source is configured with --enable-hardcoded-path-in-tests, thanks Josh Stone for providing the test case. Verified on x86_64. * elf/dl-tunables (get_next_env): Always advance envp. * stdlib/tst-empty-env.c: New test case. * stdlib/Makefile (tests): Use it.
* Fix ARM fpu_control.h for assemblers requiring VFP insn names (bug 21047).Joseph Myers2017-01-192-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 21047 reports that the clang assembler disallows the ARM implementations of _FPU_GETCW and _FPU_SETCW. These are deliberately written the way they are, using generic coprocessor instructions (from the days when VFP was just one possible coprocessor for ARM) that have the right encodings, to handle the case of the instructions being used runtime-conditionally inside glibc, where use of these macros is not meant to result in either the assembler requiring VFP to be enabled at assembly time or in it marking the object as using VFP. However, more recent ARM ARM versions have restricted the definitions of the coprocessor instructions and reportedly the clang assembler follows that in disallowing those names for VFP instructions. In the non-__SOFTFP__ case - which in fact is the only case where these macro definitions can be used outside the build of glibc itself - using VFP instruction names is of course fine, since we know that VFP is enabled for that compilation. Thus, this patch uses the current VFP names for these instructions in that case to improve compatibility for this header file. Tested for hard-float and soft-float builds of glibc, including that installed stripped shared libraries are unchanged by the patch. [BZ #21047] * sysdeps/arm/fpu_control.h [!__SOFTFP__] (_FPU_GETCW): Use VFP name for instruction. [!__SOFTFP__] (_FPU_SETCW): Likewise.
* Avoid parallel GCC install in build-many-glibcs.py.Joseph Myers2017-01-182-1/+16
| | | | | | | | | | | | | | | | | | A recent build-many-glibcs.py build <https://sourceware.org/ml/libc-testresults/2017-q1/msg00067.html> ran into what proves to be an old known bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42980> with parallel install of GCC (one which as discussed there might require automake changes to fix). This patch makes build-many-glibcs.py avoid such intermittent failures from parallel install by using -j1 for GCC make install (the code in question also applies to binutils make install, but it doesn't seem worth trying to avoid -j1 there; the builds and installs of different toolchains are still fully parallel with each other, this is only about the case when there are few enough of those that multiple jobs can get used within a single make install). * scripts/build-many-glibcs.py (Config.build_cross_tool): Use -j1 for make install.
* Merge translations from the Translation ProjectSiddhesh Poyarekar2017-01-196-3394/+3259
| | | | | | | | * po/bg.po: Merge from Translation Project. * po/fr.po: Likewise. * po/ko.po: Likewise. * po/nl.po: Likewise. * po/sv.po: Likewise.
* Update install.texi latest GCC version known to work.Joseph Myers2017-01-183-2/+8
| | | | | | * manual/install.texi (Tools for Compilation): Update GCC version known to work to build glibc. * INSTALL: Regenerated.
* S390: Fix FAIL in test string/tst-xbzero-opt [BZ #21006]Stefan Liebler2017-01-172-0/+13
| | | | | | | | | | | | | | | | | | | | | | On s390x this test failed with: FAIL: explicit clear/test: expected 0 got 1 In setup_explicit_clear, the buffer is filled with the test_pattern. On s390x the memcpy in prepare_test_buffer is done by loading r4 / r5 with the test_pattern and using store multiple instruction to store r4 / r5 to buf. If explicit_bzero is resolved in setup_explicit_clear, r4 / r5 is stored to stack by _dl_runtime_resolve and the call to memmem in count_test_patterns finds a hit of the test_pattern on the stack. This patch resolves all symbols at program startup by linking with -z now. This omits the call of _dl_runtime_resolve within setup_explicit_clear and the test passes. ChangeLog: [BZ #21006] * string/Makefile (LDFLAGS-tst-xbzero-opt): New variable.
* Make soft-float powerpc swapcontext restore the signal mask (bug 21045).Joseph Myers2017-01-162-1/+9
| | | | | | | | | | | | | | | | | | | | | | The soft-float powerpc version of swapcontext does not restore the signal mask, resulting in stdlib/tst-setcontext2 failing: after getcontext after setcontext after swapcontext FAIL: SIGUSR2 is blocked after swapcontext. This patch fixes this by adjusting the arguments passed to __sigprocmask so that it restores the saved signal mask as well as saving the existing one. (For hard-float, this code is only used for a compat symbol, not for the current version of swapcontext.) Tested for soft-float powerpc. [BZ #21045] * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S (__CONTEXT_FUNC_NAME): Pass address of signal mask to be restored to __sigprocmask.
* tile: Check for pointer add overflow in memchrChris Metcalf2017-01-163-0/+12
| | | | | | | | | | | | As was done in b224637928e9, check for large size causing an overflow in the loop that walks over the array. Branching out of line here is the fastest approach for handling this problem, since tile can bundle the instructions to compute the branch test in parallel with doing the required memchr loop setup computation. Unfortunately, the existing saturated ops (e.g. tilegx addxsc) are all signed saturing ops, so don't help with unsigned saturation.
* tile: pass __IPC_64 as zero for SysV IPC callsChris Metcalf2017-01-162-0/+25
| | | | | | | | In 1e5834c38a22 ("Refactor Linux ipc_priv header") a different approach to passing __IPC_64 as zero was created. The tile architecture also needs to pass __IPC_64 as zero since it does not set CONFIG_ARCH_WANT_IPC_PARSE_VERSION in the kernel. So create a minimal ipc_priv.h that specifies __IPC_64 as zero.
* Fix typo in NEWSSiddhesh Poyarekar2017-01-142-1/+5
| | | | | | The ip6-bytestring resolver corresponds to the RES_USEBSTRING flag and not RES_NOIP6DOTINT. Thank you Michael Kerrisk for noticing and pointing it out.
* Add compiler barriers around modifications of the robust mutex list.Torvald Riegel2017-01-135-9/+133
| | | | | | | | | | | | | | | | | | | Any changes to the per-thread list of robust mutexes currently acquired as well as the pending-operations entry are not simply sequential code but basically concurrent with any actions taken by the kernel when it tries to clean up after a crash. This is not quite like multi-thread concurrency but more like signal-handler concurrency. This patch fixes latent bugs by adding compiler barriers where necessary so that it is ensured that the kernel crash handling sees consistent data. This is meant to be easy to backport, so we do not use C11-style signal fences yet. * nptl/descr.h (ENQUEUE_MUTEX_BOTH, DEQUEUE_MUTEX): Add compiler barriers and comments. * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full): Likewise. * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Likewise.
* Clear list of acquired robust mutexes in the child process after forking.Torvald Riegel2017-01-132-6/+20
| | | | | | | | | | | | | | Robust mutexes acquired at the time of a call to fork() do not remain acquired by the forked child process. We have to clear the list of acquired robust mutexes before registering this list with the kernel; otherwise, if some of the robust mutexes are process-shared, the parent process can alter the child's robust mutex list, which can lead to deadlocks or even modification of memory that may not be occupied by a mutex anymore. [BZ #19402] * sysdeps/nptl/fork.c (__libc_fork): Clear list of acquired robust mutexes.
* robust mutexes: Fix broken x86 assembly by removing itTorvald Riegel2017-01-1314-977/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lll_robust_unlock on i386 and x86_64 first sets the futex word to FUTEX_WAITERS|0 before calling __lll_unlock_wake, which will set the futex word to 0. If the thread is killed between these steps, then the futex word will be FUTEX_WAITERS|0, and the kernel (at least current upstream) will not set it to FUTEX_OWNER_DIED|FUTEX_WAITERS because 0 is not equal to the TID of the crashed thread. The lll_robust_lock assembly code on i386 and x86_64 is not prepared to deal with this case because the fastpath tries to only CAS 0 to TID and not FUTEX_WAITERS|0 to TID; the slowpath simply waits until it can CAS 0 to TID or the futex_word has the FUTEX_OWNER_DIED bit set. This issue is fixed by removing the custom x86 assembly code and using the generic C code instead. However, instead of adding more duplicate code to the custom x86 lowlevellock.h, the code of the lll_robust* functions is inlined into the single call sites that exist for each of these functions in the pthread_mutex_* functions. The robust mutex paths in the latter have been slightly reorganized to make them simpler. This patch is meant to be easy to backport, so C11-style atomics are not used. [BZ #20985] * nptl/Makefile: Adapt. * nptl/pthread_mutex_cond_lock.c (LLL_ROBUST_MUTEX_LOCK): Remove. (LLL_ROBUST_MUTEX_LOCK_MODIFIER): New. * nptl/pthread_mutex_lock.c (LLL_ROBUST_MUTEX_LOCK): Remove. (LLL_ROBUST_MUTEX_LOCK_MODIFIER): New. (__pthread_mutex_lock_full): Inline lll_robust* functions and adapt. * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Inline lll_robust* functions and adapt. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Likewise. * sysdeps/nptl/lowlevellock.h (__lll_robust_lock_wait, __lll_robust_lock, lll_robust_cond_lock, __lll_robust_timedlock_wait, __lll_robust_timedlock, __lll_robust_unlock): Remove. * sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_robust_lock, lll_robust_cond_lock, lll_robust_timedlock, lll_robust_unlock): Remove. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_robust_lock, lll_robust_cond_lock, lll_robust_timedlock, lll_robust_unlock): Remove. * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (__lll_robust_lock_wait, __lll_robust_lock, lll_robust_cond_lock, __lll_robust_timedlock_wait, __lll_robust_timedlock, __lll_robust_unlock): Remove. * nptl/lowlevelrobustlock.c: Remove file. * nptl/lowlevelrobustlock.sym: Likewise. * sysdeps/unix/sysv/linux/i386/lowlevelrobustlock.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Likewise.
* powerpc: Regenerate ULPsTulio Magno Quites Machado Filho2017-01-132-14/+18
| | | | | | | After this update, math/test-ildouble, math/test-ldouble and math/test-ldouble-finite pass on hard float, POWER < 7 builds. Tested on powerpc, powerpc64 and powerpc64le.
* Merge translations from the Translation ProjectSiddhesh Poyarekar2017-01-129-6385/+7560
| | | | | | | | | | | | | Update translations from the 2.25 candidate libc.pot. * po/cs.po: Merge translations from the Translation Project. * po/de.po: Likewise. * po/pl.po: Likewise. * po/ru.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise.
* Fix MIPS o32 posix_fadvise.Joseph Myers2017-01-122-0/+6
| | | | | | | | | | | | | | | | | | | | | | | The posix_fadvise consolidation broke posix_fadvise for MIPS o32, so resulting in posix/tst-posix_fadvise failing. MIPS o32 (and the other ABIs) has only the posix_fadvise64 syscall, which acts like posix_fadvise64_64 (in the o32 case, because of the alignment argument it's actually a 7-argument syscall). The generic posix_fadvise implementation presumes that if __NR_fadvise64 is defined, it's for the case where a single len argument is passed to the syscall rather than two syscall arguments in the case of a 32-bit system. The generic posix_fadvise64 works fine for this case (defining __NR_fadvise64_64 to __NR_fadvise64 as needed). ARM has a posix_fadvise.c that uses __posix_fadvise64_l64 in posix_fadvise, and that approach also works for MIPS o32, so this patch makes MIPS o32 include the ARM file. Tested for MIPS o32. * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c: New file.
* Make fallback fegetexceptflag work with generic fetestexceptflag.Joseph Myers2017-01-122-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The generic implementation of fetestexceptflag does: int fetestexceptflag (const fexcept_t *flagp, int excepts) { /* Most versions of fegetexceptflag store exceptions in a form such that this works. */ return *flagp & excepts & FE_ALL_EXCEPT; } In the case where FE_ALL_EXCEPT is nonzero but exceptions may not be supported at runtime, this only works if fegetexceptflag cleared all the bits of FE_ALL_EXCEPT in *flagp; otherwise it accesses uninitialized data. This showed up as a failure of math/test-fetestexceptflag for MIPS o32 soft-float. This patch makes the fallback fegetexceptflag store 0 (fexcept_t is an integer type everywhere) so that this works. (No bug report in Bugzilla because this wasn't user-visible - at least, without using tools to detect uninitialized memory use at runtime - without fetestexceptflag, which is new in 2.25.) Tested for MIPS o32 soft-float. * math/fgetexcptflg.c (__fegetexceptflag): Store 0 in fexcept_t object.
* Make endian-conversion macros always return correct types (bug 16458).Joseph Myers2017-01-118-19/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 16458 reports that the endian-conversion macros in <endian.h> and <netinet/in.h>, in the case where no endian conversion is needed, just return their arguments without converting to the expected return type, so failing to act as expected for a macro version of a function. (The <netinet/in.h> macros, in particular, are described with prototypes in POSIX so should act like correspondingly prototyped functions.) Where previously this was a fairly obscure issue, it now results in glibc build with GCC mainline breaking for big-endian systems: nss_hesiod/hesiod-service.c: In function '_nss_hesiod_getservbyport_r': nss_hesiod/hesiod-service.c:142:39: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Werror=format-truncation=] snprintf (portstr, sizeof portstr, "%d", ntohs (port)); ^~ nss_hesiod/hesiod-service.c:142:38: note: using the range [1, -2147483648] for directive argument snprintf (portstr, sizeof portstr, "%d", ntohs (port)); ^~~~ nss_hesiod/hesiod-service.c:142:3: note: format output between 2 and 12 bytes into a destination of size 6 snprintf (portstr, sizeof portstr, "%d", ntohs (port)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The port argument is passed as int to this function, so when ntohs does not convert the compiler cannot tell that the result is within the range of uint16_t. (I don't know if in fact it's possible for out-of-range values to reach this function and so get truncated as strings without this patch or as integers with it.) This patch arranges for these macros to use identity functions to ensure appropriate conversions while having warnings for implicit conversions of function arguments that might not occur with a cast. Tested for x86_64 and x86; with build-many-glibcs.py with GCC 6; and with build-many-glibcs.py with GCC mainline for powerpc to test the build fix. [BZ #16458] * bits/uintn-identity.h: New file. * inet/netinet/in.h: Include <bits/uintn-identity.h>. [__BYTE_ORDER == __BIG_ENDIAN] (ntohl): Use __uint32_identity. [__BYTE_ORDER == __BIG_ENDIAN] (ntohs): Use __uint16_identity. [__BYTE_ORDER == __BIG_ENDIAN] (htonl): Use __uint32_identity. [__BYTE_ORDER == __BIG_ENDIAN] (htohs): Use __uint16_identity. * string/endian.h: Include <bits/uintn-identity.h>. [__BYTE_ORDER == __LITTLE_ENDIAN] (htole16): Use __uint16_identity. [__BYTE_ORDER == __LITTLE_ENDIAN] (le16toh): Likewise. [__BYTE_ORDER == __LITTLE_ENDIAN] (htole32): Use __uint32_identity. [__BYTE_ORDER == __LITTLE_ENDIAN] (le32toh): Likewise. [__BYTE_ORDER == __LITTLE_ENDIAN] (htole64): Use __uint64_identity. [__BYTE_ORDER == __LITTLE_ENDIAN] (le64toh): Likewise. [__BYTE_ORDER != __LITTLE_ENDIAN] (htobe16): Use __uint16_identity. [__BYTE_ORDER != __LITTLE_ENDIAN] (be16toh): Likewise. [__BYTE_ORDER != __LITTLE_ENDIAN] (htobe32): Use __uint32_identity. [__BYTE_ORDER != __LITTLE_ENDIAN] (be32toh): Likewise. [__BYTE_ORDER != __LITTLE_ENDIAN] (htobe64): Use __uint64_identity. [__BYTE_ORDER != __LITTLE_ENDIAN] (be64toh): Likewise. * string/Makefile (headers): Add bits/uintn-identity.h. (tests): Add test-endian-types. * string/test-endian-types.c: New file. * inet/Makefile (tests): Add test-hnto-types. * inet/test-hnto-types.c: New file.
* Update translations from the Translation ProjectSiddhesh Poyarekar2017-01-1135-56631/+37441
| | | | | | Pulled from: http://translationproject.org/latest/libc/
* Fix testsuite build for GCC 7 -Wformat-truncation.Joseph Myers2017-01-115-3/+30
| | | | | | | | | | | | | | | | | | | | This patch fixes the glibc testsuite build for GCC 7 -Wformat-truncation, newly moved out of -Wformat-length and with some further warnings that didn't previously appear. Two tests that previously disabled -Wformat-length are changed to disable -Wformat-truncation instead; two others are made to disable that option as well. Tested (compilation only) with build-many-glibcs.py for aarch64 with GCC mainline. * stdio-common/tst-printf.c [__GNUC_PREREQ (7, 0)]: Ignore -Wformat-truncation instead of -Wformat-length. * time/tst-strptime2.c (mkbuf) [__GNUC_PREREQ (7, 0)]: Likewise. * stdio-common/tstdiomisc.c (F): Ignore -Wformat-truncation for GCC 7. * wcsmbs/tst-wcstof.c: Include <libc-internal.h>. (do_test): Ignore -Wformat-truncation for GCC 7.
* Fix ld-address format-truncation error.Joseph Myers2017-01-112-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | With the elf/sotruss-lib.c failure fixed, building 64-bit glibc with GCC mainline fails with another format-truncation error in locale/programs/ld-address.c, where 11 bytes are allocated for a buffer to print a long int value. This patch changes that code to allocate 21 bytes. Treating this value as signed is questionable and I don't think large values are actually useful here, but I think those can be considered as instances of bug 21036 which I've filed for overflow checks for numeric values in localedef in general, and don't need to be addressed to fix the build. Tested with GCC mainline with compilation for aarch64 with build-many-glibcs.py, and with glibc testsuite for x86_64 (built with GCC 6). (Note that while this fixes the build of 64-bit glibc with GCC mainline, further fixes will be needed to get the testsuite building with GCC mainline again.) * locale/programs/ld-address.c (INT_STR_ELEM): Increase size of buffer used to print long int value.
* Fix elf/sotruss-lib format-truncation error.Joseph Myers2017-01-112-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building 64-bit glibc with GCC mainline fails with: ../elf/sotruss-lib.c: In function 'la_version': ../elf/sotruss-lib.c:91:28: error: '%lu' directive output may be truncated writing between 1 and 20 bytes into a region of size 11 [-Werror=format-truncation=] snprintf (endp, 12, ".%lu", (unsigned long int) pid); ^~~ ../elf/sotruss-lib.c:91:26: note: using the range [1, 18446744073709551615] for directive argument snprintf (endp, 12, ".%lu", (unsigned long int) pid); ^~~~~~ ../elf/sotruss-lib.c:91:6: note: format output between 3 and 22 bytes into a destination of size 12 snprintf (endp, 12, ".%lu", (unsigned long int) pid); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pids from getpid cannot actually be negative, but the compiler doesn't know this. Other places in this file use (signed) long int for printing, so this patch makes this place do so as well. Then it increases the buffer size by one byte to allow for the minus sign that can't actually occur. It doesn't seem worth using diagnostic pragmas to save one byte; other place in this file just use a cruder 3 * sizeof (pid_t) calculation for number of digits. Tested with GCC mainline with compilation for aarch64 with build-many-glibcs.py, and with glibc testsuite for x86_64 (built with GCC 6). * elf/sotruss-lib.c (init): Increase space allocated for pid by one byte. Print it with %ld, cast to long int.
* Make build-many-glibcs.py work on python3.2Szabolcs Nagy2017-01-112-0/+42
| | | | | | | | | | | | | | | | | I used this patch to run the new build script with python3.2, it may be worth adding this hack if python3.5 is not widespread (might work with older python, i haven't tested that). This patch make build-many-glibcs.py work with python 3.2 by adding fallback implementation to python 3.5 facilities if they are not present. Checked building a x86_64-linux-gnu toolchain with python 3.2. 2016-11-22 Szabolcs Nagy <szabolcs.nagy@arm.com> * scripts/build-many-glibcs.py (os.cpu_count): Add compatibility definition. (re.fullmatch, subprocess.run): Likewise.
* Regenerate libc.potSiddhesh Poyarekar2017-01-112-138/+56
|
* tunables: Avoid getenv calls and disable glibc.malloc.check by defaultSiddhesh Poyarekar2017-01-103-78/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Builds with --enable-tunables failed on i686 because a call to getenv got snuck into tunables, which pulled in strncmp. This patch fixes this build failure by making the glibc.malloc.check check even simpler. The previous approach was convoluted where the tunable was disabled using an unsetenv and overwriting the tunable value with colons. The easier way is to simply mark the tunable as insecure by default (i.e. won't be read for AT_SECURE programs) and then enabled only when the /etc/suid-debug file is found. This also ends up removing a bunch of functions that were specially reimplemented (strlen, unsetenv) to avoid calling into string routines. Tested on x86_64 and i686. * elf/dl-tunables.c (tunables_unsetenv): Remove function. (min_strlen): Likewise. (disable_tunable): Likewise. (maybe_disable_malloc_check): Rename to maybe_enable_malloc_check. (maybe_enable_malloc_check): Enable glibc.malloc.check tunable if /etc/suid-debug file exists. (__tunables_init): Update caller. * elf/dl-tunables.list (glibc.malloc.check): Don't mark as secure.
* New pthread rwlock that is more scalable.Torvald Riegel2017-01-1042-917/+1550
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the pthread rwlock with a new implementation that uses a more scalable algorithm (primarily through not using a critical section anymore to make state changes). The fast path for rdlock acquisition and release is now basically a single atomic read-modify write or CAS and a few branches. See nptl/pthread_rwlock_common.c for details. * nptl/DESIGN-rwlock.txt: Remove. * nptl/lowlevelrwlock.sym: Remove. * nptl/Makefile: Add new tests. * nptl/pthread_rwlock_common.c: New file. Contains the new rwlock. * nptl/pthreadP.h (PTHREAD_RWLOCK_PREFER_READER_P): Remove. (PTHREAD_RWLOCK_WRPHASE, PTHREAD_RWLOCK_WRLOCKED, PTHREAD_RWLOCK_RWAITING, PTHREAD_RWLOCK_READER_SHIFT, PTHREAD_RWLOCK_READER_OVERFLOW, PTHREAD_RWLOCK_WRHANDOVER, PTHREAD_RWLOCK_FUTEX_USED): New. * nptl/pthread_rwlock_init.c (__pthread_rwlock_init): Adapt to new implementation. * nptl/pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock_slow): Remove. (__pthread_rwlock_rdlock): Adapt. * nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock): Adapt. * nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock): Adapt. * nptl/pthread_rwlock_trywrlock.c (pthread_rwlock_trywrlock): Adapt. * nptl/pthread_rwlock_tryrdlock.c (pthread_rwlock_tryrdlock): Adapt. * nptl/pthread_rwlock_unlock.c (pthread_rwlock_unlock): Adapt. * nptl/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock_slow): Remove. (__pthread_rwlock_wrlock): Adapt. * nptl/tst-rwlock10.c: Adapt. * nptl/tst-rwlock11.c: Adapt. * nptl/tst-rwlock17.c: New file. * nptl/tst-rwlock18.c: New file. * nptl/tst-rwlock19.c: New file. * nptl/tst-rwlock2b.c: New file. * nptl/tst-rwlock8.c: Adapt. * nptl/tst-rwlock9.c: Adapt. * sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/hppa/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/sparc/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * sysdeps/x86/bits/pthreadtypes.h (pthread_rwlock_t): Adapt. * nptl/nptl-printers.py (): Adapt. * nptl/nptl_lock_constants.pysym: Adapt. * nptl/test-rwlock-printers.py: Adapt. * nptl/test-rwlockattr-printers.c: Adapt. * nptl/test-rwlockattr-printers.py: Adapt.
* XFAIL libm-test.inc tests as needed for ibm128.Joseph Myers2017-01-103-94/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch arranges for various libm-test.inc tests to be XFAILed for ibm128-libgcc in non-default rounding modes. The tests are marked with XFAIL_ROUNDING_IBM128_LIBGCC and gen-libm-test.pl is made to transform that to XFAIL_IBM128_LIBGCC or 0 depending on the rounding mode. This should allow test-ldouble, test-ildouble and test-ldouble-finite to pass with unmodified libgcc, given an ulps regeneration. (The case of patched libgcc was already clean up to ulps and possibly hypot cases very close to the overflow threshold that may need more XFAILing; patched libgcc, which should work with TEST_COND_ibm128_libgcc defined to 0 to disable all these XFAILs, does need slightly different ulps from unpatched.) Note that soft-float powerpc will still fail because of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64811> resulting in spurious "invalid" exceptions in the libgcc code (for hard float, <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58684> hides that bug). Tested for powerpc. * math/libm-test.inc (XFAIL_IBM128_LIBGCC): New macro. (fdim_test_data): Use XFAIL_ROUNDING_IBM128_LIBGCC for some tests. (fma_test_data): Likewise. (hypot_test_data): Likewise. (log1p_test_data): Likewise. (modf_test_data): Likewise. (pow_test_data): Likewise. (remainder_test_data): Likewise. (remquo_test_data): Likewise. (scalb_test_data): Likewise. (scalbn_test_data): Likewise. (scalbln_test_data): Likewise. * math/gen-libm-test.pl (parse_args): Transform XFAIL_ROUNDING_IBM128_LIBGCC to XFAIL_IBM128_LIBGCC or 0 depending on the rounding mode.
* Improve libm-test XFAILing for ibm128-libgcc.Joseph Myers2017-01-094-16664/+16686
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch further improves XFAILing for ibm128-libgcc of tests in auto-libm-test-*. The bulk of the cases needing XFAILing are xfail-rounding:ibm128-libgcc used for inputs where (possibly after rounding the inputs to another floating-point type) the result overflows (and the result in non-default rounding modes may be wildly wrong with unpatched libgcc) or underflows near 0 (and the result in non-default rounding modes may end up having the wrong sign). This patch makes gen-auto-libm-tests detect such cases and apply xfail-rounding:ibm128-libgcc automatically to them, so most of the manual XFAILs in auto-libm-test-in are no longer needed (some are still needed if e.g. the result is very close to overflow, resulting in an internal overflow in libgcc in some rounding modes). A few manual XFAILs are added for cases not covered by this gen-auto-libm-tests change, and a few existing such XFAILs are left in. Tested for powerpc. * math/gen-auto-libm-tests.c (output_for_one_input_case): Apply xfail-rounding:ibm128-libgcc automatically to tests overflowing and those that can underflow to zero. * math/auto-libm-test-in: Remove most XFAILs for ibm128-libgcc and add others. * math/auto-libm-test-out: Regenerated.
* Fix math/test-fenv for no-exceptions / no-rounding-modes configurations.Joseph Myers2017-01-092-13/+26
| | | | | | | | | | | | | This patch fixes math/test-fenv.c to check EXCEPTION_TESTS and ROUNDING_TESTS to avoid failing in cases where some exceptions or rounding modes are defined but not supported at runtime. Tested for mips64 soft float and for x86_64. * math/test-fenv.c (fe_tests): Skip most tests when exceptions not supported. (feholdexcept_tests): Skip tests requiring exceptions or rounding modes support if not supported.
* Update MicroBlaze localplt.data.Joseph Myers2017-01-092-1/+8
| | | | | | | | | | | | | This patch updates the MicroBlaze localplt.data based on the results of a build with build-many-glibcs.py. This is simply an empirical update; quite possibly the port could be optimized to remove more local PLT entry usage. Tested (compilation tests) with build-many-glibcs.py. * sysdeps/unix/sysv/linux/microblaze/localplt.data (__pread64): Add libc.so PLT entry. (__tls_get_addr): Make ld.so PLT entry optional.