aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-06-12libio: freopen of default streams crashes in old programs [BZ #24632]Florian Weimer
As seen with very old i386 GCC binaries.
2019-06-12Linux: Deprecate <sys/sysctl.h> and sysctlFlorian Weimer
Now that there are no internal users of __sysctl left, it is possible to add an unconditional deprecation warning to <sys/sysctl.h>. To avoid a test failure due this warning in check-install-headers, skip the test for sys/sysctl.h. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-06-12<sys/stat.h>: Use Linux UAPI header for statx if available and usefulFlorian Weimer
This will automatically import new STATX_* constants. It also avoids a conflict between <sys/stat.h> and <linux/stat.h>.
2019-06-12<sys/cdefs.h>: Add __glibc_has_include macroFlorian Weimer
2019-06-12Improve performance of memmemWilco Dijkstra
This patch significantly improves performance of memmem using a novel modified Horspool algorithm. Needles up to size 256 use a bad-character table indexed by hashed pairs of characters to quickly skip past mismatches. Long needles use a self-adapting filtering step to avoid comparing the whole needle repeatedly. By limiting the needle length to 256, the shift table only requires 8 bits per entry, lowering preprocessing overhead and minimizing cache effects. This limit also implies worst-case performance is linear. Small needles up to size 2 use a dedicated linear search. Very long needles use the Two-Way algorithm (to avoid increasing stack size or slowing down the common case, inlining is disabled). The performance gain is 6.6 times on English text on AArch64 using random needles with average size 8. Tested against GLIBC testsuite and randomized tests. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com> * string/memmem.c (__memmem): Rewrite to improve performance.
2019-06-12Improve performance of strstrWilco Dijkstra
This patch significantly improves performance of strstr using a novel modified Horspool algorithm. Needles up to size 256 use a bad-character table indexed by hashed pairs of characters to quickly skip past mismatches. Long needles use a self-adapting filtering step to avoid comparing the whole needle repeatedly. By limiting the needle length to 256, the shift table only requires 8 bits per entry, lowering preprocessing overhead and minimizing cache effects. This limit also implies worst-case performance is linear. Small needles up to size 3 use a dedicated linear search. Very long needles use the Two-Way algorithm. The performance gain using the improved bench-strstr on Cortex-A72 is 5.8 times basic_strstr and 3.7 times twoway_strstr. Tested against GLIBC testsuite, randomized tests and the GNULIB strstr test (https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-strstr.c). Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com> * string/str-two-way.h (two_way_short_needle): Add inline to avoid warning. (two_way_long_needle): Block inlining. * string/strstr.c (strstr2): Add new function. (strstr3): Likewise. (STRSTR): Completely rewrite strstr to improve performance.
2019-06-11Benchmark strstr hard needlesWilco Dijkstra
Benchmark needles which exhibit worst-case performance. This shows that basic_strstr is quadratic and thus unsuitable for large needles. On the other hand the Two-way and new strstr implementations are linear with increasing needle sizes. The slowest cases of the two implementations are within a factor of 2 on several different microarchitectures. Two-way is slowest on inputs which cause a branch mispredict on almost every character. The new strstr is slowest on inputs which almost match and result in many calls to memcmp. Thanks to Szabolcs for providing various hard needles. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> * benchtests/bench-strstr.c (test_hard_needle): New function.
2019-06-10Fix malloc tests build with GCC 10.Joseph Myers
GCC mainline has recently added warn_unused_result attributes to some malloc-like built-in functions, where glibc previously had them in its headers only for __USE_FORTIFY_LEVEL > 0. This results in those attributes being newly in effect for building the glibc testsuite, so resulting in new warnings that break the build where tests deliberately call such functions and ignore the result. Thus patch duly adds calls to DIAG_* macros around those calls to disable the warning. Tested with build-many-glibcs.py for aarch64-linux-gnu. * malloc/tst-calloc.c: Include <libc-diag.h>. (null_test): Ignore -Wunused-result around calls to calloc. * malloc/tst-mallocfork.c: Include <libc-diag.h>. (do_test): Ignore -Wunused-result around call to malloc.
2019-06-07Linux: Add getdents64 system callFlorian Weimer
No 32-bit system call wrapper is added because the interface is problematic because it cannot deal with 64-bit inode numbers and 64-bit directory hashes. A future commit will deprecate the undocumented getdirentries and getdirentries64 functions. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-06-06[powerpc] get_rounding_mode: utilize faster method to get rounding modePaul A. Clarke
Add support to use 'mffsl' instruction if compiled for POWER9 (or later). Also, mask the result to avoid bleeding unrelated bits into the result of _FPU_GET_RC(). Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2019-06-06riscv: Do not use __has_include__Florian Weimer
The user-visible preprocessor construct is called __has_include.
2019-06-05[powerpc] fegetexcept: utilize function instead of duplicating codePaul A. Clarke
fegetexcept() included code which exactly duplicates the code in fenv_reg_to_exceptions(). Replace with a call to that function. 2019-06-05 Paul A. Clarke <pc@us.ibm.com> * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Replace code with call to equivalent function.
2019-06-04iconv: Use __twalk_r in __gconv_release_shlibFlorian Weimer
2019-06-04Fix iconv buffer handling with IGNORE error handler (bug #18830)Andreas Schwab
2019-06-03Add INADDR_ALLSNOOPERS_GROUP from Linux 5.1 to netinet/in.h.Joseph Myers
This patch adds INADDR_ALLSNOOPERS_GROUP from Linux 5.1 to netinet/in.h. Tested for x86_64. * inet/netinet/in.h (INADDR_ALLSNOOPERS_GROUP): New macro.
2019-06-01Fix data of ChangeLog entryFlorian Weimer
2019-06-01arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl supportFlorian Weimer
Linux only supports the required ISA sysctls on StrongARM devices, which are armv4 and no longer tested during glibc development and probably bit-rotted by this point. (No reported test results, and the last discussion of armv4 support was in the glibc 2.19 release notes.)
2019-06-01Linux: Add oddly-named arm syscalls to syscall-names.listFlorian Weimer
<asm/unistd.h> on arm defines the following macros: #define __ARM_NR_breakpoint (__ARM_NR_BASE+1) #define __ARM_NR_cacheflush (__ARM_NR_BASE+2) #define __ARM_NR_usr26 (__ARM_NR_BASE+3) #define __ARM_NR_usr32 (__ARM_NR_BASE+4) #define __ARM_NR_set_tls (__ARM_NR_BASE+5) #define __ARM_NR_get_tls (__ARM_NR_BASE+6) These do not follow the regular __NR_* naming convention and have so far been ignored by the syscall-names.list consistency checks. This commit adds these names to the file, preparing for the availability of these names in the regular __NR_* namespace.
2019-05-30powerpc: Fix build failures with current GCCGabriel F. T. Gomes
Since GCC commit 271500 (svn), also known as the following commit on the git mirror: commit 61edec870f9fdfb5df3fa4e40f28cbaede28a5b1 Author: amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed May 22 04:34:26 2019 +0000 [RS6000] Don't pass -many to the assembler glibc builds are failing when an assembly implementation does not declare the correct '.machine' directive, or when no such directive is declared at all. For example, when a POWER6 instruction is used, but '.machine power6' is not declared, the assembler will fail with an error similar to the following: ../sysdeps/powerpc/powerpc64/power8/strcmp.S: Assembler messages: 24 ../sysdeps/powerpc/powerpc64/power8/strcmp.S:55: Error: unrecognized opcode: `cmpb' This patch adds '.machine powerN' directives where none existed, as well as it updates '.machine power7' directives on POWER8 files, because the minimum binutils version required to build glibc (binutils 2.25) now provides this machine version. It also adds '-many' to the assembler command used to build tst-set_ppr.c. Tested for powerpc, powerpc64, and powerpc64le, as well as with build-many-glibcs.py for powerpc targets. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2019-05-29Remove unused get_clockfreq filesAdhemerval Zanella
The patch 6e8ba7fd574f meant to remove the all get_clockfreq.c. This patch removes the missing files for sparcv9 and x86_64. Checked against a build to x86_64-linux-gnu and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c: Remove file. * sysdeps/unix/sysv/linux/x86_64/get_clockfreq.c: Likewise.
2019-05-28powerpc: generic nearbyint/nearbyintfAdhemerval Zanella
This patches consolidates all the powerpc nearbyint{f} implementations on the generic sysdeps/powerpc/fpu/s_nearbyint{f}. * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode): Add NEARBYINT handling. * sysdeps/powerpc/fpu/s_nearbyint.c: New file. * sysdeps/powerpc/fpu/s_nearbyintf.c: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
2019-05-28tt_RU: Add lang_name [BZ #24370]mansayk
This commit adds a lang_name according to CLDR-35.1. [BZ #24370] * localedata/locales/tt_RU (lang_name): Add from CLDR-35.1.
2019-05-28tt_RU: Fix orthographic mistakes in mon and abmon sections [BZ #24369]mansayk
This commit fixes some errors and converts all month names to lowercase. The content is synchronized with CLDR-35.1 now but trailing dots are removed from abmon values in order to maintain consistency with the previous values and with many other locales which do the same. [BZ #24369] * localedata/locales/tt_RU (mon): Update from CLDR-35.1, fix errors. (abmon): Likewise, but remove the trailing dots.
2019-05-28Add IGMP_MRDISC_ADV from Linux 5.1 to netinet/igmp.h.Joseph Myers
This patch adds the IGMP_MRDISC_ADV macro from Linux 5.1 to netinet/igmp.h. Tested for x86_64. * inet/netinet/igmp.h (IGMP_MRDISC_ADV): New macro.
2019-05-27nptl: Add comment to __pthread_get_minstack about external usersFlorian Weimer
2019-05-24nss_dns: Check for proper A/AAAA address alignmentFlorian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-05-23Add F_SEAL_FUTURE_WRITE from Linux 5.1 to bits/fcntl-linux.h.Joseph Myers
This patch adds the new F_SEAL_FUTURE_WRITE constant from Linux 5.1 to bits/fcntl-linux.h. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU] (F_SEAL_FUTURE_WRITE): New macro.
2019-05-23elf: Add tst-ldconfig-bad-aux-cache test [BZ #18093]Alexandra Hájková
This test corrupts /var/cache/ldconfig/aux-cache and executes ldconfig to check it will not segfault using the corrupted aux_cache. The test uses the test-in-container framework. Verified no regressions on x86_64.
2019-05-22Add ChangeLog entry for previous commit.Zack Weinberg
2019-05-22Remove support for PowerPC SPE extension (powerpc*-*-*gnuspe*).Zack Weinberg
GCC 9 dropped support for the SPE extensions to PowerPC, which means powerpc*-*-*gnuspe* configurations are no longer buildable with that compiler. This ISA extension was peculiar to the “e500” line of embedded PowerPC chips, which, as far as I can tell, are no longer being manufactured, so I think we should follow suit. This patch was developed by grepping for “e500”, “__SPE__”, and “__NO_FPRS__”, and may not eliminate every vestige of SPE support. Most uses of __NO_FPRS__ are left alone, as they are relevant to normal embedded PowerPC with soft-float. * sysdeps/powerpc/preconfigure: Error out on powerpc-*-*gnuspe* host type. * scripts/build-many-glibcs.py: Remove powerpc-*-linux-gnuspe and powerpc-*-linux-gnuspe-e500v1 from list of build configurations. * sysdeps/powerpc/powerpc32/e500: Recursively delete. * sysdeps/unix/sysv/linux/powerpc/powerpc32/e500: Recursively delete. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h: Delete. * sysdeps/powerpc/fpu_control.h: Remove SPE variant. Issue an #error if used with a compiler in SPE-float mode. * sysdeps/powerpc/powerpc32/__longjmp_common.S * sysdeps/powerpc/powerpc32/setjmp_common.S * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Remove code to preserve SPE register state. * sysdeps/unix/sysv/linux/powerpc/elision-lock.c * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c * sysdeps/unix/sysv/linux/powerpc/elision-unlock.c Remove __SPE__ ifndefs.
2019-05-21Improve string benchtest timingWilco Dijkstra
Improve string benchtest timing. Many tests run for 0.01s which is way too short to give accurate results. Other tests take over 40 seconds which is way too long. Significantly increase the iterations of the short running tests. Reduce number of alignment variations in the long running memcpy walk tests so they take less than 5 seconds. As a result most tests take at least 0.1s and all finish within 5 seconds. * benchtests/bench-memcpy-random.c (do_one_test): Use medium iterations. * benchtests/bench-memcpy-walk.c (test_main): Reduce alignment tests. * benchtests/bench-memmem.c (do_one_test): Use small iterations. * benchtests/bench-memmove-walk.c (test_main): Reduce alignment tests. * benchtests/bench-memset-walk.c (test_main): Reduce alignment tests. * benchtests/bench-strcasestr.c (do_one_test): Use small iterations. * benchtests/bench-string.h (INNER_LOOP_ITERS): Increase iterations. (INNER_LOOP_ITERS_MEDIUM): New define. (INNER_LOOP_ITERS_SMALL): New define. * benchtests/bench-strpbrk.c (do_one_test): Use medium iterations. * benchtests/bench-strsep.c (do_one_test): Use small iterations. * benchtests/bench-strspn.c (do_one_test): Use medium iterations. * benchtests/bench-strstr.c (do_one_test): Use small iterations. * benchtests/bench-strtok.c (do_one_test): Use small iterations.
2019-05-21sysvipc: Add missing bit of semtimedop s390 consolidationAdhemerval Zanella
This patch add the missing SEMTIMEDOP_IPC_ARGS definions on powerpc and sparc ipc_priv.h. Checked on powerpc64le-linux-gnu and with a build for sparc64-linux-gnu. * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New define. * sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): Likewise.
2019-05-21wcsmbs: Fix data race in __wcsmbs_clone_conv [BZ #24584]Florian Weimer
This also adds an overflow check and documents the synchronization requirement in <gconv.h>.
2019-05-21libio: Fix gconv-related memory leak [BZ #24583]Florian Weimer
struct gconv_fcts for the C locale is statically allocated, and __gconv_close_transform deallocates the steps object. Therefore this commit introduces __wcsmbs_close_conv to avoid freeing the statically allocated steps objects.
2019-05-20libio: Remove codecvt vtable [BZ #24588]Florian Weimer
The codecvt vtable is not a real vtable because it also contains the conversion state data. Furthermore, wide stream support was added to GCC 3.0, after a C++ ABI bump, so there is no compatibility requirement with libstdc++. This change removes several unmangled function pointers which could be used with a corrupted FILE object to redirect execution. (libio vtable verification did not cover the codecvt vtable.) Reviewed-by: Yann Droneaud <ydroneaud@opteya.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-05-20support: Expose sbindir as support_sbindir_prefixFlorian Weimer
2019-05-20support: Add missing EOL terminators on timespecMike Crowe
The original implementations of test_timespec_before_impl and test_timespec_equal_or_after in 519839965197291924895a3988804e325035beee were missing the backslash required for a newline. Checked on x86_64-linux-gnu. * support/timespec.c: Add backslash to correct newline in failure message. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-05-20support: Correct confusing commentMike Crowe
* support/timespec.h: Correct confusing comment. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-05-20sysvipc: Consolidate semtimedop s390Adhemerval Zanella
This patch consolidates the s390-32 semtimedop implementation by defining a arch-specific SEMTIMEDOP_IPC_ARGS to rearrange the arguments expected by s390 Linux kABI. The idea is to avoid have multiples semtimedop implementation changes for Linux v5.1 change to enable wire-up sysvipc support. Checked with a s390-linux-gnu and s390x-linux-gnu and checking that resulting semtimedop objects did not change. * sysdeps/unix/sysv/linux/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New define. * sysdpes/unix/sysv/linux/s390/ipc_priv.h: New file. * sysdeps/unix/sysv/linux/s390/semtimedop.c: Remove file. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use SEMTIMEDOP_IPC_ARGS for calls with __NR_ipc.
2019-05-20sysvipc: Fix compat msgctl (BZ#24570)Adhemerval Zanella
The __IPC64 flags is meant to be used to enable the new sysv struct format when the architectures supports it (ARCH_WANT_IPC_PARSE_VERSION config flag on Linux kernel). This currently issue only affects alpha. [BZ #24570] * sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Remove __IPC_64 usage.
2019-05-20Add NT_ARM_PACA_KEYS and NT_ARM_PACG_KEYS from Linux 5.1 to elf.h.Joseph Myers
This patch adds the new NT_ARM_PACA_KEYS and NT_ARM_PACG_KEYS from Linux 5.1 to glibc's elf.h. Tested for x86_64. * elf/elf.h (NT_ARM_PACA_KEYS): New macro. (NT_ARM_PACG_KEYS): Likewise.
2019-05-17Small tcache improvementsWilco Dijkstra
Change the tcache->counts[] entries to uint16_t - this removes the limit set by char and allows a larger tcache. Remove a few redundant asserts. bench-malloc-thread with 4 threads is ~15% faster on Cortex-A72. Reviewed-by: DJ Delorie <dj@redhat.com> * malloc/malloc.c (MAX_TCACHE_COUNT): Increase to UINT16_MAX. (tcache_put): Remove redundant assert. (tcache_get): Remove redundant asserts. (__libc_malloc): Check tcache count is not zero. * manual/tunables.texi (glibc.malloc.tcache_count): Update maximum.
2019-05-17manual: Document O_DIRECTORYFlorian Weimer
2019-05-16Update kernel-features.h files for Linux 5.1.Joseph Myers
Linux 5.1 adds missing syscalls to the syscall table for many Linux kernel architectures. This patch updates the kernel-features.h headers accordingly. __ASSUME_DIRECT_SYSVIPC_SYSCALLS is not updated because of the differences between new and old syscalls described in <https://sourceware.org/ml/libc-alpha/2019-05/msg00235.html>. The statfs64 structure used by alpha matches what the new kernel syscalls use. Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__ASSUME_STATFS64): Only undefine if [__LINUX_KERNEL_VERSION < 0x050100]. * sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_STATX): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_STATX): Likewise.
2019-05-16nss_nis, nss_nisplus: Remove RES_USE_INET6 handlingFlorian Weimer
Since commit 3f8b44be0a658266adff5ece1e4bc3ce097a5dbe ("resolv: Remove support for RES_USE_INET6 and the inet6 option"), res_use_inet6 () always evaluates to false.
2019-05-16nss_files: Remove RES_USE_INET6 from hosts processingFlorian Weimer
Since commit 3f8b44be0a658266adff5ece1e4bc3ce097a5dbe ("resolv: Remove support for RES_USE_INET6 and the inet6 option"), res_use_inet6 () always evaluates to false.
2019-05-16support: Report NULL blobs explicitly in TEST_COMPAREFlorian Weimer
Provide an explicit diagnostic if the length is positive, and do not just crash with a null pointer dereference. Null pointers are only valid if the length is zero, so this can only happen with a faulty test.
2019-05-15dlfcn: Guard __dlerror_main_freeres with __libc_once_get (once) [BZ# 24476]Mark Wielaard
dlerror.c (__dlerror_main_freeres) will try to free resources which only have been initialized when init () has been called. That function is called when resources are needed using __libc_once (once, init) where once is a __libc_once_define (static, once) in the dlerror.c file. Trying to free those resources if init () hasn't been called will produce errors under valgrind memcheck. So guard the freeing of those resources using __libc_once_get (once) and make sure we have a valid key. Also add a similar guard to __dlerror (). * dlfcn/dlerror.c (__dlerror_main_freeres): Guard using __libc_once_get (once) and static_bug == NULL. (__dlerror): Check we have a valid key, set result to static_buf otherwise. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-05-15Add missing Changelog entryDJ Delorie
For 5b06f538c5aee0389ed034f60d90a8884d6d54de
2019-05-15Fix crash in _IO_wfile_sync (bug 20568)Andreas Schwab
When computing the length of the converted part of the stdio buffer, use the number of consumed wide characters, not the (negative) distance to the end of the wide buffer.