about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Hurd: Define ARCH_MIN_GUARD_SIZE in internal <pthread.h>Florian Weimer2021-05-201-0/+3
| | | | | | This macro is always defined on Linux. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* elf: Initialize GLRO (dl_minsigstacksize) after static dlopenFlorian Weimer2021-05-201-0/+3
| | | | | | | This is another field of _rtld_global_ro that benefits from initialization in __rtld_static_init. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* nptl: Add missing __pthread_cond_wait alias in static buildsFlorian Weimer2021-05-191-0/+3
| | | | | | | Fixes commit cf3fff1c195f859ba949a7ad86d4fca70bd99740 ("nptl: Move cnd_wait into libc"). Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
* Remove --enable-stackguard-randomization (BZ #27872)Adhemerval Zanella2021-05-193-28/+0
| | | | Last ENABLE_STACKGUARD_RANDOMIZE usage was removed by 4a103975c4.
* s390x: Check HWCAP bits against compiler flagsFlorian Weimer2021-05-191-0/+40
| | | | | | | | | | When compiled with GCC 11.1 and -march=z14 -O3 build flags, running ld.so (or any dynamically linked program) prints: Fatal glibc error: CPU lacks VXE support (z14 or later required) Co-Authored-By: Stefan Liebler <stli@linux.ibm.com> Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
* powerpc64le: Check HWCAP bits against compiler build flagsFlorian Weimer2021-05-191-0/+52
| | | | | | | When built with GCC 11.1 and -mcpu=power9, ld.so prints this error message when running on POWER8: Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)
* elf: Add hook for checking HWCAP bits after auxiliary vector parsingFlorian Weimer2021-05-192-0/+31
| | | | Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
* x86: Optimize memcmp-evex-movbe.SNoah Goldstein2021-05-181-302/+408
| | | | | | | | | | | | No bug. This commit optimizes memcmp-evex.S. The optimizations include adding a new vec compare path for small sizes, reorganizing the entry control flow, removing some unnecissary ALU instructions from the main loop, and most importantly replacing the heavy use of vpcmp + kand logic with vpxor + vptern. test-memcmp and test-wmemcmp are both passing. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Optimize memcmp-avx2-movbe.SNoah Goldstein2021-05-183-281/+402
| | | | | | | | | | No bug. This commit optimizes memcmp-avx2.S. The optimizations include adding a new vec compare path for small sizes, reorganizing the entry control flow, and removing some unnecissary ALU instructions from the main loop. test-memcmp and test-wmemcmp are both passing. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Expand bench-memcmp.c and test-memcmp.cNoah Goldstein2021-05-182-12/+60
| | | | | | | | | | | No bug. This commit adds some additional performance test cases to bench-memcmp.c and test-memcmp.c. The new benchtests include some medium range sizes, as well as small sizes near page cross. The new correctness tests correspond with the new benchtests though add some additional cases for checking the page cross logic. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* linux: Fix clock_getres fallbackAdhemerval Zanella2021-05-181-1/+1
| | | | | | | | The tst-timespec_getres (e5ac7bd679de5) triggers an issue on 32-bit architecture on Linux older than 5.1, where the fallback syscall is used. Checked on powerpc-linux-gnu.
* Do not declare asctime_r and ctime_r for C2XJoseph Myers2021-05-181-2/+2
| | | | | | | | | | | | | | | | | ISO C2X added the asctime_r, ctime_r, gmtime_r and localtime_r functions from POSIX. It's now removed asctime_r and ctime_r again, reflecting that they are marked obsolescent in POSIX; update glibc's time.h accordingly. The same change that removed those two functions from C2X also marked asctime and ctime as deprecated (reflecting how POSIX shows them as obsolescent), i.e. using the [[deprecated]] attribute in the prototypes shown in C2X. It's less clear if we should explicitly deprecate those functions like that in the glibc headers; this patch does nothing regarding such a deprecation (there's no normative requirement from C2X showing the functions as deprecated). Tested for x86_64 and x86.
* htl: Add __libpthread_freeresSamuel Thibault2021-05-182-1/+25
|
* hurd: Add execveatSamuel Thibault2021-05-184-43/+123
|
* Fix stringop-overflow warning in bug-regex19.c.Stefan Liebler2021-05-181-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with commit 26492c0a14966c32c43cd6ca1d0dca5e62c6cfef "Annotate additional APIs with GCC attribute access.", gcc emits this warning on s390x: In function 'do_one_test', inlined from 'do_mb_tests' at bug-regex19.c:385:11: bug-regex19.c:271:9: error: 're_search' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] 271 | res = re_search (&regbuf, test->string, strlen (test->string), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | test->start, strlen (test->string) - test->start, NULL); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../include/regex.h:2, from bug-regex19.c:22: bug-regex19.c: In function 'do_mb_tests': ../posix/regex.h:554:17: note: in a call to function 're_search' declared with attribute 'read_only (2, 3)' 554 | extern regoff_t re_search (struct re_pattern_buffer *__buffer, | ^~~~~~~~~ ... The function do_one_test is inlined into do_mb_tests on s390x (at least with gcc 10). If do_one_test is marked with __attribute__ ((noinline)), there are no warnings on s390x. If do_one_test is marked with __attribute__ ((always_inline)), there are the same warnings on x86_64. test->string points to a variable length array on stack of do_mb_tests and the content is generated based on the passed test struct. According to Martin Sebor, this is a false positive caused by the same bug as the one in nss/makedb.c. It's fixed in GCC 11 and will also be available in the next GCC 10.4 release.
* localedata: Use U+00AF MACRON in more EBCDIC charsets [BZ #27882]Florian Weimer2021-05-1812-12/+12
| | | | | | | | | | This updates IBM256, IBM277, IBM278, IBM280, IBM284, IBM297, IBM424 in the same way that IBM273 was updated for bug 23290. IBM256 and IBM424 still have holes after this change, so HAS_HOLES is not updated. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* ldconfig: Avoid boolean coercion of opt_chrootSiddhesh Poyarekar2021-05-181-17/+17
| | | | Generated code is unchanged.
* ldconfig: Fix memory leaksSiddhesh Poyarekar2021-05-181-6/+14
| | | | | | | Coverity discovered that paths allocated by chroot_canon are not freed in a couple of routines in ldconfig. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* charmap_conversion: Free conversion table on exitSiddhesh Poyarekar2021-05-181-0/+7
| | | | | | The conversion table is allocated using xcalloc but never freed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf/cache.c: Fix resource leaks identified by static analyzersSiddhesh Poyarekar2021-05-181-4/+12
| | | | | | | | | | A coverity run identified a number of resource leaks in cache.c. There are a couple of simple memory leaks where a local allocation is not freed before function return. Then there is a mmap leak and a file descriptor leak where a map is not unmapped in the error case and a file descriptor remains open respectively. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* show_archive_content: Fix trivial memory leakSiddhesh Poyarekar2021-05-181-0/+1
| | | | | | | | Fix trivial leak identified by coverity. The program runs to exit and the leak doesn't grow, but it's just cleaner to free the allocated memory. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add C2X timespec_getresJoseph Myers2021-05-1744-2/+189
| | | | | | | | | | | | | | | | | | | ISO C2X adds a timespec_getres function alongside the C11 timespec_get, with functionality similar to that of POSIX clock_getres (including allowing a NULL pointer to be passed to the function). Implement this function for glibc, similarly to the implementation of timespec_get. This includes a basic test like that of timespec_get, but no documentation in the manual, given that TIME_UTC and timespec_get aren't documented in the manual at all. The handling of 64-bit time follows that in timespec_get; people maintaining patch series for 64-bit time will need to update them accordingly (to export __timespec_getres64, redirect calls in time.h and run the test for _TIME_BITS=64). Tested for x86_64 and x86, and (previous version; only testcase differs) with build-many-glibcs.py.
* Missing ENOMEM in realloc_check wrapper (bug 27870)Andreas Schwab2021-05-172-2/+5
| | | | | | When MALLOC_CHECK_ is non-zero, the realloc hook missed to set errno to ENOMEM when called with too big size. Run the test tst-malloc-too-large also with MALLOC_CHECK_=3 to catch that.
* benchtests: Use JSON for bench-rawmemchr outputMatheus Castanho2021-05-171-15/+39
| | | | | | | | Convert the output of benchtests/bench-rawmemchr to JSON like other string benchmarks. This makes the output more parseable and allows usage of compare_strings.py, for example. Reviewed-by: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
* powerpc: Add optimized rawmemchr for POWER10Matheus Castanho2021-05-176-27/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reuse code for optimized strlen to implement a faster version of rawmemchr. This takes advantage of the same benefits provided by the strlen implementation, but needs some extra steps. __strlen_power10 code should be unchanged after this change. rawmemchr returns a pointer to the char found, while strlen returns only the length, so we have to take that into account when preparing the return value. To quickly check 64B, the loop on __strlen_power10 merges the whole block into 16B by using unsigned minimum vector operations (vminub) and checks if there are any \0 on the resulting vector. The same code is used by rawmemchr if the char c is 0. However, this approach does not work when c != 0. We first need to subtract each byte by c, so that the value we are looking for is converted to a 0, then taking the minimum and checking for nulls works again. The new code branches after it has compared ~256 bytes and chooses which of the two strategies above will be used in the main loop, based on the char c. This extra branch adds some overhead (~5%) for length ~256, but is quickly amortized by the faster loop for larger sizes. Compared to __rawmemchr_power9, this version is ~20% faster for length < 256. Because of the optimized main loop, the improvement becomes ~35% for c != 0 and ~50% for c = 0 for strings longer than 256. Reviewed-by: Lucas A. M. Magalhaes <lamm@linux.ibm.com> Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
* nptl: Move pthread_sigqueue into libcFlorian Weimer2021-05-1765-34/+102
| | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. The GLIBC_2.11 version is now empty, so add a placeholder symbol. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setschedprio into libcFlorian Weimer2021-05-1765-35/+99
| | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. The GLIBC_2.3.4 version is now empty, so add a placeholder symbol. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setname_np into libcFlorian Weimer2021-05-1765-33/+104
| | | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. Add __libpthread_version_placeholder@@GLIBC_2.12 for the targets that need it. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setaffinity_np into libcFlorian Weimer2021-05-1765-51/+115
| | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_getname_np into libcFlorian Weimer2021-05-1764-35/+77
| | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_getcpuclockid into libcFlorian Weimer2021-05-1765-36/+93
| | | | | | | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. __libpthread_version_placeholder@@GLIBC_2.2 is needed by this change; the Versions entry for GLIBC_2.2 in libpthread had leftover symbols due to an error in a previous conflict resolution. The condition for the placeholder symbol is complicated because some architectures have earlier symbols at the GLIBC_2.2 symbol versions, so the placeholder is not required there (yet). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Replace pthread_getcpuclockid with Linux implementationFlorian Weimer2021-05-172-60/+6
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_getattr_default_np into libcFlorian Weimer2021-05-1766-35/+112
| | | | | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. A new placeholder symbol __libpthread_version_placeholder@GLIBC_2.18 is needed to keep the GLIBC_2.18 symbol version in libpthread. The __pthread_getattr_default_np@@GLIBC_PRIVATE export is used from pthread_create. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Move static TLS size and alignment into _rtld_global_roFlorian Weimer2021-05-174-18/+26
| | | | | | | This helps to clarify that the caching of these fields in libpthread (in __static_tls_size, __static_tls_align_m1) is unnecessary. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Remove DL_STATIC_INITFlorian Weimer2021-05-172-10/+0
| | | | | | All users have been converted to the __rtld_static_init mechanism. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc: Remove _dl_var_initFlorian Weimer2021-05-174-122/+10
| | | | | | | | | The generic __rtld_static_init code handles GLRO (dl_pagesize), GLRO (dl_auxv), GLRO (dl_hwcap), GLRO (dl_hwcap2). GLRO (dl_cache_line_size) is handled in an __rtld_static_init_arch override. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* mips: Remove _dl_var_initFlorian Weimer2021-05-174-100/+0
| | | | | | The generic __rtld_static_init code handles GLRO (dl_pagesize). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* m68k: Remove _dl_var_initFlorian Weimer2021-05-174-122/+0
| | | | | | The generic __rtld_static_init code handles GLRO (dl_pagesize). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ia64: Remove _dl_var_initFlorian Weimer2021-05-174-102/+0
| | | | | | | The generic __rtld_static_init code handles GLRO (dl_pagesize) and GLRO (dl_clktck). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* arc: Remove _dl_var_initFlorian Weimer2021-05-174-129/+0
| | | | | | The generic __rtld_static_init code handles GLRO (dl_pagesize). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* aarch64: Remove _dl_var_initFlorian Weimer2021-05-174-130/+0
| | | | | | The generic __rtld_static_init code handles GLRO (dl_pagesize). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Partially initialize ld.so after static dlopen (bug 20802)Florian Weimer2021-05-178-13/+208
| | | | | | | | | | | | | | After static dlopen, a copy of ld.so is loaded into the inner namespace, but that copy is not initialized at all. Some architectures run into serious problems as result, which is why the _dl_var_init mechanism was invented. With libpthread moving into libc and parts into ld.so, more architectures impacted, so it makes sense to switch to a generic mechanism which performs the partial initialization. As a result, getauxval now works after static dlopen (bug 20802). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __nptl_create_event, __nptl_death_event into libcFlorian Weimer2021-05-176-9/+15
| | | | | | | | In libthread_db, use the exported GLIBC_PRIVATE symbols directly instead of relying on _thread_db_* variables in libpthread (which used to be created by the DB_FUNCTION macros). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __nptl_initial_report_events into ld.so/startup codeFlorian Weimer2021-05-177-18/+24
| | | | | | | | | | | | The initialization of the report_events TCB field is now performed in __tls_init_tp instead of __pthread_initialize_minimal_internal (in libpthread). The events interface is difficult to test because GDB stopped using it in 2015. The td_thr_get_info change to ignore lookup issues is enough to support GDB with this change. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Enable support for GCC 11 -Wmismatched-dealloc.Martin Sebor2021-05-1613-41/+308
| | | | | | | | | | | | | | | | | | | | | | | To help detect common kinds of memory (and other resource) management bugs, GCC 11 adds support for the detection of mismatched calls to allocation and deallocation functions. At each call site to a known deallocation function GCC checks the set of allocation functions the former can be paired with and, if the two don't match, issues a -Wmismatched-dealloc warning (something similar happens in C++ for mismatched calls to new and delete). GCC also uses the same mechanism to detect attempts to deallocate objects not allocated by any allocation function (or pointers past the first byte into allocated objects) by -Wfree-nonheap-object. This support is enabled for built-in functions like malloc and free. To extend it beyond those, GCC extends attribute malloc to designate a deallocation function to which pointers returned from the allocation function may be passed to deallocate the allocated objects. Another, optional argument designates the positional argument to which the pointer must be passed. This change is the first step in enabling this extended support for Glibc.
* nptl: Fix tst-pthread-gdb-attach for ptrace_scope equal 1Adhemerval Zanella2021-05-141-17/+39
| | | | | | | | | This is similar to the fix for elf/tst-pldd (2f9046fb059e94fe25): it checks ptrace_scope value (values higher than 2 are too restrictive to allow the test to run) and it rearranges the spawned processes to make the target process the gdb child. Checked on x86_64-linux-gnu with ptrace_scope set to 1.
* stdlib: Fix data race in __run_exit_handlers [BZ #27749]Vitaly Buka2021-05-143-17/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep __exit_funcs_lock almost all the time and unlock it only to execute callbacks. This fixed two issues. 1. f->func.cxa was modified outside the lock with rare data race like: thread 0: __run_exit_handlers unlock __exit_funcs_lock thread 1: __internal_atexit locks __exit_funcs_lock thread 0: f->flavor = ef_free; thread 1: sees ef_free and use it as new thread 1: new->func.cxa.fn = (void (*) (void *, int)) func; thread 1: new->func.cxa.arg = arg; thread 1: new->flavor = ef_cxa; thread 0: cxafct = f->func.cxa.fn; // it's wrong fn! thread 0: cxafct (f->func.cxa.arg, status); // it's wrong arg! thread 0: goto restart; thread 0: call the same exit_function again as it's ef_cxa 2. Don't unlock in main while loop after *listp = cur->next. If *listp is NULL and __exit_funcs_done is false another thread may fail in __new_exitfn on assert (l != NULL): thread 0: *listp = cur->next; // It can be the last: *listp = NULL. thread 0: __libc_lock_unlock thread 1: __libc_lock_lock in __on_exit thread 1: __new_exitfn thread 1: if (__exit_funcs_done) // false: thread 0 isn't there yet. thread 1: l = *listp thread 1: moves one and crashes on assert (l != NULL); The test needs multiple iterations to consistently fail without the fix. Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27749 Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Make sysdeps/generic/libc.abilist emptyJoseph Myers2021-05-131-1/+0
| | | | | The __libc_single_threaded symbol was accidentally added to this file in commit 706ad1e7af37be1d25fc2359bda006d31fe0d11b.
* support: Free gdb_script_nameSiddhesh Poyarekar2021-05-131-0/+1
| | | | Identified by static analysis.
* support: Close fds in copy_funcSiddhesh Poyarekar2021-05-131-8/+13
| | | | | copy_func may leave file descriptors open on error, so close them on function exit.