about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Move fortified explicit_bzero back to string3Adhemerval Zanella2017-01-093-9/+14
| | | | | | | | | | | | | | | Commit 38765ab68f329fd moved the bzero, bcopy, and explicit_bzero fortified macros to a common header (strings_fortified.h). However the side effect is a fortified explicit_bzero is defined when including only strings.h. This patch moves back the fortified explicit_bzero definition to strings3.h header. Checked on x86_64-linux-gnu. * string/bits/strings_fortified.h (explicit_bzero): Move back to .. * string/bits/string3.h: ... here.
* Make fallback fesetexceptflag always succeed (bug 21028).Joseph Myers2017-01-053-3/+17
| | | | | | | | | | | | | | | | | | | | The fallback implementation of fesetexceptflag currently fails if any exceptions are specified. It should always succeed, because the exception state is always that all exceptions (if any are defined in <fenv.h> but not supported in this configuration) are always clear, just as fallback fetestexcept always succeeds and fallback fesetenv always succeeds unless asked to set FE_NOMASK_ENV. This patch fixes it accordingly. Together with the patch to test-fexcept.c to allow feraiseexcept to fail in another place, this stops that test from failing for MIPS soft-float. Tested for mips64 soft-float. [BZ #21028] * math/fsetexcptflg.c (__fesetexceptflag): Always return 0. * math/test-fexcept.c (test_set): Allow failure of feraiseexcept if EXCEPTION_TESTS returns false.
* Use fortify macros for b{zero,copy} along decl from strings.hAdhemerval Zanella2017-01-056-21/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in BZ#20558, bzero and bcopy declaration can only benefit from fortified macros when decl came from string.h and when __USE_MISC is defined (default behaviour). This is due no standard includes those functions in string.h, so they are only declared if __USE_MISC is defined (as pointed out in comment 4). However fortification should be orthogona to other features test macros, i.e, any function should be fortified if that function is declared. To fix this behavior, the patch moved the bzero, bcopy, and __explicit_bzero_chk to a common header (string/bits/strings_fortified.h) and explicit fortified inclusion macros similar to string.h is added on strings.h. This allows to get fortified declarions by only including strings.h. Checked on x86_64-linux-gnu and along on a bootstrap installation to check if the fortified are correctly triggered with example from bug report. [BZ #20558] * string/bits/string3.h [__USE_MISC] (bcopy): Move to strings_fortified.h. [__USE_MISC] (bzero): Likewise. [__USE_MISC] (explicit_bzero): Likewise. * string/strings.h: Include strings_fortified.h. * string/Makefile (headers): Add strings_fortified.h. * string/bits/strings_fortified.h: New file. * include/bits/strings_fortified.h: Likewise.
* Increase some test timeouts.Joseph Myers2017-01-057-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch increases timeouts on some tests I've observed timing out. elf/tst-tls13 and iconvdata/tst-loading both dynamically load many objects and so are slow when testing over NFS. They had timeouts set from before the default changed from 2 to 20 seconds; this patch removes those old settings, so effectively increasing the timeout to 20 seconds (from 3 and 10 seconds respectively). malloc/tst-malloc-thread-fail.c and malloc/tst-mallocfork2.c are slow on slow systems and so I set a fairly arbitrary 100 second timeout, which seems to suffice on the system where I saw them timing out. nss/tst-cancel-getpwuid_r.c and nss/tst-nss-getpwent.c are slow on systems with a large passwd file; I set timeouts that empirically worked for me. (It seems tst-cancel-getpwuid_r.c is hitting the 100000 getpwuid_r call limit in my testing, with each call taking a bit over 0.007 seconds, so 700 seconds for the test.) * elf/tst-tls13.c (TIMEOUT): Remove. * iconvdata/tst-loading.c (TIMEOUT): Likewise. * malloc/tst-malloc-thread-fail.c (TIMEOUT): Increase to 100. * malloc/tst-mallocfork2.c (TIMEOUT): Define to 100. * nss/tst-cancel-getpwuid_r.c (TIMEOUT): Define to 900. * nss/tst-nss-getpwent.c (TIMEOUT): Define to 300.
* Fix MIPS n64 readahead (bug 21026).Joseph Myers2017-01-052-0/+8
| | | | | | | | | | | | | | | | As noted in bug 20126, MIPS n64 uses an incorrect implementation of readahead intended for 32-bit systems. This patch adds a syscalls.list entry to fix this. An updated version of the consolidation patch <https://sourceware.org/ml/libc-alpha/2016-09/msg00527.html> could remove this syscalls.list entry again. Tested with compilation (only) for mips64; the nature of the syscall doesn't allow for a glibc test to detect this issue. [BZ #21026] * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list (readahead): New syscall entry.
* Fix string/tester.c for GCC 7 -Wstringop-overflow=.Joseph Myers2017-01-042-0/+60
| | | | | | | | | | | | | | | GCC 7 has a -Wstringop-overflow= warning that includes warning for strncat with a size specified that is larger than the size of the buffer (which is dubious usage, but valid at runtime if in fact there isn't an overflow with the particular buffer contents present). string/tester.c tests such cases; this patch arranges for this warning to be ignored around relevant strncat calls. Tested compilation for aarch64 (GCC mainline) with build-many-glibcs.py; did execution testing for x86_64 (GCC 5). * string/tester.c (test_strncat): Disable -Wstringop-overflow= around tests of strncat with large sizes.
* Fix malloc/ tests for GCC 7 -Walloc-size-larger-than=.Joseph Myers2017-01-044-0/+62
| | | | | | | | | | | | | | | | | | | | | GCC 7 has a -Walloc-size-larger-than= warning for allocations of half the address space or more. This causes errors building glibc tests that deliberately test failure of very large allocations. This patch arranges for this warning to be ignored around the problematic function calls. Tested compilation for aarch64 (GCC mainline) with build-many-glibcs.py; did execution testing for x86_64 (GCC 5). * malloc/tst-malloc.c: Include <libc-internal.h>. (do_test): Disable -Walloc-size-larger-than= around tests of malloc with negative sizes. * malloc/tst-mcheck.c: Include <libc-internal.h>. (do_test): Disable -Walloc-size-larger-than= around tests of malloc and realloc with negative sizes. * malloc/tst-realloc.c: Include <libc-internal.h>. (do_test): Disable -Walloc-size-larger-than= around tests of realloc with negative sizes.
* Update libm-test XFAILs for ibm128 format.Joseph Myers2017-01-044-12945/+12945
| | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up and updates the libm-test XFAILs for the ibm128 format. More of them are changed to use a new ibm128-libgcc conditional, to reflect that they are not in fact needed if you've patched libgcc to fix the known issues (at substantial performance cost). Many additional XFAILs are added for tests that fail with unpatched libgcc (most but not all of them xfail-rounding). Note that further such fixes will be needed for test-ldouble actually to pass with default libgcc (in particular, XFAILs for pow tests and for various affected tests directly embedded in libm-test.inc). With patched libgcc, there may be a few XFAILs needed but the results are already substantially clean apart from a few ulps differences. Tested for powerpc. * math/libm-test.inc (TEST_COND_ibm128_libgcc): New macro. (init_max_error) [TEST_COND_ibm128]: Increase maximum error allowed to 16 ulps. * math/auto-libm-test-in: Change most XFAILs for ibm128 to use ibm128-libgcc. XFAIL more tests for ibm128-libgcc. * math/auto-libm-test-out: Regenerated.
* Move wrappers to libm-compat-calls-autoGabriel F. T. Gomes2017-01-04191-66/+474
| | | | | | | | | | This commit moves one step towards the deprecation of wrappers that use _LIB_VERSION / matherr / __kernel_standard functionality, by adding the suffix '_compat' to their filenames and adjusting Makefiles and #includes accordingly. New template wrappers that do not use such functionality will be added by future patches and will be first used by the float128 wrappers.
* Fix MicroBlaze bits/setjmp.h for C++.Joseph Myers2017-01-042-1/+4
| | | | | | | | | | | | | | | For MicroBlaze, setjmp/check-installed-headers-cxx fails with: ../setjmp/setjmp.h:34:8: error: '__jmp_buf_tag' has a field '__jmp_buf_tag::__jmpbuf' whose type depends on the type '<unnamed struct>' which has no linkage [-Werror=subobject-linkage] This patch fixes this in the same way as for some other architectures: the struct used for the internal __jmp_buf type is given the tag __jmp_buf_internal_tag. Tested (compilation tests) with build-many-glibcs.py. * sysdeps/microblaze/bits/setjmp.h (__jmp_buf): Give struct tag __jmp_buf_internal_tag.
* Make MIPS soft-fp preserve NaN payloads for NAN2008.Joseph Myers2017-01-043-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to a patch applied to libgcc. In glibc it doesn't actually affect much (only fma, I think). The MIPS sfp-machine.h files have an _FP_CHOOSENAN implementation which emulates hardware semantics of not preserving signaling NaN payloads for an operation with two NaN arguments (although that doesn't suffice to avoid sNaN payload preservation in any case with just one NaN argument). However, those are only hardware semantics in the legacy NaN case; in the NAN2008 case, the architecture documentation says hardware preserves payloads in such cases. Furthermore, this implementation assumes legacy NaN semantics, so in the NAN2008 case the implementation actually has the effect of preserving sNaN payloads but not preserving qNaN payloads, when both should be preserved. This patch fixes the code just to copy from the first argument. Tested for mips64 soft-float. * sysdeps/mips/mips32/sfp-machine.h (_FP_CHOOSENAN): Always preserve NaN payload if [__mips_nan2008]. * sysdeps/mips/mips64/sfp-machine.h (_FP_CHOOSENAN): Likewise.
* Fix MicroBlaze __backtrace get_frame_size namespace (bug 21022).Joseph Myers2017-01-042-1/+6
| | | | | | | | | | | | Many linknamespace tests fail for MicroBlaze because __backtrace (as brought in by libc_fatal.c) uses an inline function get_frame_size which is not declared static. This patch fixes it to be declared static. Tested (compilation tests) with build-many-glibcs.py. [BZ #21022] * sysdeps/microblaze/backtrace.c (get_frame_size): Make static.
* Update i386 libm-test-ulps.Joseph Myers2017-01-032-4/+8
| | | | | | | | | | When testing changes to i386 libm functions (that are shadowed for i686 builds by i686 versions) recently, I saw that the plain i386 libm-test-ulps (as opposed to the i686 multiarch version) needed updating for tests that had been added since it was last updated. This patch updates it accordingly. * sysdeps/i386/fpu/libm-test-ulps: Update.
* Remove duplicate strcat implementationsAdhemerval Zanella2017-01-036-62/+12
| | | | | | | | | | | | | | | | | Since commit 6e46de42fe16 default strcat implementation is essentially the same for specialized ia64 and powerpc ones. This patch removes the redundant implementation and adjust powerpc64 ifunc code to use the default one. Checked on powerpc32-linux-gnu (default and power4) and ia64-linux build and on powerpc64le-linux-gnu. * sysdeps/ia64/strcat.c: Remove file. * sysdeps/powerpc/strcat.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcat-power7.c: Use default C implementation. * sysdeps/powerpc/powerpc64/multiarch/strcat-power8.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcat-ppc64.c: Likewise.
* powerpc: Fix write-after-destroy in lock elision [BZ #20822]Tulio Magno Quites Machado Filho2017-01-034-12/+33
| | | | | | The update of *adapt_count after the release of the lock causes a race condition when thread A unlocks, thread B continues and destroys the mutex, and thread A writes to *adapt_count.
* Fix math/test-fenvinline for no-exceptions configurations.Joseph Myers2017-01-032-5/+13
| | | | | | | | | | | | | | | This patch fixes math/test-fenvinline.c to stop it failing in no-exceptions configurations (where some exception macros are defined but may not be supported at runtime). The relevant parts of the test are disabled in that case; some parts can still run (and the rounding mode tests are written in a way such that they work even if the rounding modes aren't supported). Tested for mips64 soft-float, and for x86_64 to make sure the tests still run when the exceptions are supported. * math/test-fenvinline.c (do_test): Disable tests of raised exceptions if !EXCEPTION_TESTS (FLOAT).
* Fix x86 strncat optimized implementation for large sizesAdhemerval Zanella2017-01-034-0/+29
| | | | | | | | | | | | | | | | | | | | | | Similar to BZ#19387, BZ#21014, and BZ#20971, both x86 sse2 strncat optimized assembly implementations do not handle the size overflow correctly. The x86_64 one is in fact an issue with strcpy-sse2-unaligned, but that is triggered also with strncat optimized implementation. This patch uses a similar strategy used on 3daef2c8ee4df2, where saturared math is used for overflow case. Checked on x86_64-linux-gnu and i686-linux-gnu. It fixes BZ #19390. [BZ #19390] * string/test-strncat.c (test_main): Add tests with SIZE_MAX as maximum string size. * sysdeps/i386/i686/multiarch/strcat-sse2.S (STRCAT): Avoid overflow in pointer addition. * sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S (STRCPY): Likewise.
* Fix elf/tst-ldconfig-X for cross testing.Joseph Myers2017-01-032-1/+7
| | | | | | | | | | | | | elf/Makefile passes arguments to tst-ldconfig-X.sh that are different from what it expects, so resulting in the test failing in cross testing. This patch corrects the arguments passed (the script itself has correct logic for cross testing, it's just the Makefile that's wrong). Tested for powerpc (cross testing) and for x86_64 (native testing). * elf/Makefile ($(objpfx)tst-ldconfig-X.out): Correct arguments passed to tst-ldconfig-X.sh.
* Fix up tabs/spaces mismatchesMartin Galvan2017-01-032-8/+12
| | | | | | | | | | Mixing them up breaks the gdb pretty printer tests. ChangeLog: 2017-01-02 Martin Galvan <martingalvan@sourceware.org> * nptl/nptl-printers.py: Fix tabs/spaces mismatches.
* Fix MIPS n32 lseek, lseek64 (bug 21019).Joseph Myers2017-01-024-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lseek consolidation broke lseek64 for MIPS n32, so resulting in io/test-lfs failing with an incorrect return from ftello64. This configuration uses the lseek syscall with a 64-bit return value; as the C syscall macros return long, they cannot be used in this case and so an assembly implementation is needed; accordingly, this patch adds lseek64 back to syscalls.list for this configuration. lseek was also broken, truncating the result without checking for overflow. lseek however was already broken before the consolidation; it aliased lseek64 so would return an out-of-range value, resulting in architecturally undefined behavior in the caller if it tried to use a non-sign-extended value with a 32-bit instruction. This patch adds a custom lseek implementation in C for n32, which calls __lseek64 to get the 64-bit value then checks for overflow. Because the prior lseek breakage did not show in test results, and the lseek64 breakage showed only indirectly through tests of ftello64, test coverage was clearly inadequate. This patch extends io/test-lfs.c to test the lseek64 return value (at a point where it has already seeked over 2GB into a file), and then to test the lseek return value (with the latter's expectations depending on whether off_t is smaller than off64_t). Tested for mips64 n32. Also tested test-lfs for x86_64 and x86, where as expected it passes. [BZ #21019] * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (lseek64): New syscall entry. * sysdeps/unix/sysv/linux/mips/mips64/n32/lseek.c: New file. * io/test-lfs.c (do_test): Test offset returned from lseek64 and lseek.
* Add build-many-glibcs.py powerpc-linux-gnu-power4 build.Joseph Myers2017-01-022-1/+9
| | | | | | | | | | | | The 32-bit powerpc configurations in build-many-glibcs.py were failing to cover the powerpc32 multiarch code at all, because that code is only built for power4 and above configurations. This patch adds a 32-bit power4 configuration so that at least some of that multiarch code gets build-tested. (This is preparation for reviewing the w_* file renaming, which affects such powerpc32 multiarch files.) * scripts/build-many-glibcs.py (Context.add_all_configs): Add power4 glibc for powerpc-linux-gnu.
* Fix test-sysvsem on some platformsAdhemerval Zanella2017-01-022-1/+13
| | | | | | | | | The command IPC_STAT of semctl expects an union semun in its fourth argument instead of struct semid_ds *. This can cause failures on powerpc32-linux-gnu. Checked on x86_64-linux-gnu, i686-linux-gnu, and powerpc32-linux-gnu (qemu system emulation).
* Fix math/test-nearbyint-except for no-exceptions configurations.Joseph Myers2017-01-022-1/+16
| | | | | | | | | | | | | | | | | | | The test math/test-nearbyint-except conditions some of its tests on an EXCEPTION_TESTS call, not not all that need such a condition. This patch fixes it to use such a conditional for all its tests and to return 77 (UNSUPPORTED) if none of the floating-point types tested support exceptions. Tested for mips64 soft float (where the test previously failed and is now UNSUPPORTED); also tested for x86_64 to make sure the test still PASSes in exceptions-supported cases. * math/test-nearbyint-except.c: Include <stdbool.h>. (any_supported): New variable. (TEST_FUNC): Return early if !EXCEPTION_TESTS (FLOAT). Otherwise set any_supported. (do_test): Return 77 if no floating-point type supported exceptions.
* Correct MIPS math-tests.h condition for sNaN payload preservation.Joseph Myers2017-01-022-1/+6
| | | | | | | | | | | | | | | | | | | | | | Testing for MIPS soft float shows that the issue with NaN payload preservation applies to soft float as well as hard float: the sfp-machine.h emulates hardware non-preservation semantics, although only for the case of two NaN arguments. This patch duly changes the MIPS math-tests.h to expect such non-preservation for soft float as well as hard float. The issue in the NAN2008 case for which I posted <https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00034.html>, of sNaN payloads being preserved but qNaN payloads not being preserved, is not currently an issue for glibc tests because we don't have any tests that check for qNaN payloads being preserved by arithmetic, so a simple __mips_nan2008 conditional suffices without needing compiler version checks in the __mips_nan2008 case. Tested for mips64 soft float. * sysdeps/mips/math-tests.h (SNAN_TESTS_PRESERVE_PAYLOAD): Do not condition on [__mips_hard_float].
* Fix i686 memchr for large input sizesAdhemerval Zanella2017-01-023-3/+22
| | | | | | | | | | | | | | | | | | | Similar to BZ#19387 and BZ#20971, both i686 memchr optimized assembly implementations (memchr-sse2-bsf and memchr-sse2) do not handle the size overflow correctly. It is shown by the new tests added by commit 3daef2c8ee4df29, where both implementation fails with size as SIZE_MAX. This patch uses a similar strategy used on 3daef2c8ee4df2, where saturared math is used for overflow case. Checked on i686-linux-gnu. [BZ #21014] * sysdeps/i386/i686/multiarch/memchr-sse2-bsf.S (MEMCHR): Avoid overflow in pointer addition. * sysdeps/i386/i686/multiarch/memchr-sse2.S (MEMCHR): Likewise.
* Fix pthread_cond_t on sparc for new condvar.Torvald Riegel2017-01-022-8/+26
| | | | | * sysdeps/sparc/nptl/bits/pthreadtypes.h (pthread_cond_t): Adapt to new condvar.
* Make build-many-glibcs.py use binutils 2.28 branch by default.Joseph Myers2017-01-022-1/+6
| | | | | | | | Now that a release branch exists for binutils 2.28, this patch makes build-many-glibcs.py use that by default in place of 2.27. * scripts/build-many-glibcs.py (Context.checkout): Default binutils version to 2.28 branch.