about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* regexec: remove alloca usage in build_trtableAdhemerval Zanella2021-02-091-62/+13
| | | | | | | | | | | | It syncs with gnulib version 1731fef3d. On build_trtable prevent inlining, so that it doesn't bloat the caller's stack and use auto variables instead of alloca/malloc. After these changes, build_trtable's total stack allocation is only 20 KiB on a 64-bit machine, and this is less than glibc's 64 KiB cutoff so there's little point to using alloca to shrink it. Checked on x86_64-linux-gnu.
* regex: remove alloca usage on regex set_regsAdhemerval Zanella2021-02-091-22/+18
| | | | | | | It syncs with gnulib version b6207ab38. It replaces the regmatch_t with a dynarray list. Checked on x86_64-linux-gnu.
* malloc: Sync dynarray with gnulibAdhemerval Zanella2021-02-099-84/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It syncs with gnulib version a8bac4d49. The main changes are: - Remove the usage of anonymous union within DYNARRAY_STRUCT. - Use DYNARRAY_FREE instead of DYNARRAY_NAME (free) so that Gnulib does not change 'free' to 'rpl_free'. - Use __nonnull instead of __attribute__ ((nonnull ())). - Use __attribute_maybe_unused__ instead of __attribute__ ((unused, nonnull (1))). - Use of _Noreturn instead of _attribute__ ((noreturn)). The only difference with gnulib is: --- glibc +++ gnulib @@ -18,6 +18,7 @@ #include <dynarray.h> #include <stdio.h> +#include <stdlib.h> void __libc_dynarray_at_failure (size_t size, size_t index) @@ -27,7 +28,6 @@ __snprintf (buf, sizeof (buf), "Fatal glibc error: " "array index %zu not less than array length %zu\n", index, size); - __libc_fatal (buf); #else abort (); #endif It seems a wrong sync from gnulib (the code is used on loader and thus it requires __libc_fatal instead of abort). Checked on x86_64-linux-gnu.
* misc: Sync cdefs.h with gnulibAdhemerval Zanella2021-02-091-57/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It adds __glibc_has_builtin, __glibc_has_extension, and __attribute_maybe_unused__ alongsize with some fixes. The differences are: --- glibc +++ gnulib @@ -259,7 +259,9 @@ # define __attribute_const__ /* Ignore */ #endif -#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) +#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ +# define __attribute_maybe_unused__ [[__maybe_unused__]] +#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) # define __attribute_maybe_unused__ __attribute__ ((__unused__)) #else # define __attribute_maybe_unused__ /* Ignore */ @@ -485,7 +487,7 @@ /* The #ifndef lets Gnulib avoid including these on non-glibc platforms, where the includes typically do not exist. */ -#ifdef __GLIBC__ +#ifndef __WORDSIZE # include <bits/wordsize.h> # include <bits/long-double.h> #endif The [[__attribute_maybe_unused__]] attribute removal __ is due Joseph questioning gcc support with -std=c2x or -std=gnu2x [1]. The _WORDSIZE replacement by __GLIBC__ is because it does not play well with internal cdefs.h that also uses __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI. Checked on x86_64-linux-gnu. [1] https://sourceware.org/pipermail/libc-alpha/2021-January/121600.html
* linux: Fix __sem_check_add_mapping search_semAdhemerval Zanella2021-02-091-1/+1
| | | | | | | Similar to __sem_check_add_mapping fix, take in consideration the trailling NULL. Checked x86_64-linux-gnu.
* linux: Fix __sem_check_add_mapping name lengthAdhemerval Zanella2021-02-091-0/+1
| | | | | | | | Take in consideration the trailling NULL since sem_search uses strcmp to compare entries. Checked on x86_64-linux-gnu and powerpc-linux-gnu (where it triggered a nptl/tst-sem7 regression).
* Add more ptrace constants for AArch64 and PowerPC.Joseph Myers2021-02-082-0/+26
| | | | | | | | | | | | Linux 5.10 adds PTRACE_PEEKMTETAGS and PTRACE_POKEMTETAGS for AArch64. Adding those shows up that glibc is also missing PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP, for AArch64 (where they were added to Linux in 5.3) and for PowerPC (where they were added in Linux 4.20); it already has those two defines for x86. Add all those defines to glibc's headers. Tested with build-many-glibcs.py for aarch64-linux-gnu and powerpc-linux-gnu.
* strchr: Add additional benchmarks and testsnoah2021-02-082-2/+50
| | | | | | This patch adds additional benchmarks and tests for string size of 4096 and several benchmarks for string size 256 with different alignments.
* x86-64: Refactor and improve performance of strchr-avx2.Snoah2021-02-082-113/+113
| | | | | | | | No bug. Just seemed the performance could be improved a bit. Observed and expected behavior are unchanged. Optimized body of main loop. Updated page cross logic and optimized accordingly. Made a few minor instruction selection modifications. No regressions in test suite. Both test-strchrnul and test-strchr passed.
* pthread: Remove alloca usage from __sem_check_add_mappingAdhemerval Zanella2021-02-081-6/+17
| | | | | | | sem_open already returns EINVAL for input names larger than NAME_MAX, so it can assume the largest name length with tfind. Checked on x86_64-linux-gnu.
* pthread: Refactor semaphore codeAdhemerval Zanella2021-02-088-208/+223
| | | | | | | | | | | The internal semaphore list code is moved to a specific file, sem_routine.c, and the internal usage is simplified to only two functions (one to insert a new semaphore and one to remove it from the internal list). There is no need to expose the internal locking, neither how the semaphore mapping is implemented. No functional or semantic change is expected, tested on x86_64-linux-gnu.
* linux: Require /dev/shm as the shared memory file systemFlorian Weimer2021-02-0819-303/+89
| | | | | | | | | | | | | | | | | | | | | Previously, glibc would pick an arbitrary tmpfs file system from /proc/mounts if /dev/shm was not available. This could lead to an unsuitable file system being picked for the backing storage for shm_open, sem_open, and related functions. This patch introduces a new function, __shm_get_name, which builds the file name under the appropriate (now hard-coded) directory. It is called from the various shm_* and sem_* function. Unlike the SHM_GET_NAME macro it replaces, the callers handle the return values and errno updates. shm-directory.c is moved directly into the posix subdirectory because it can be implemented directly using POSIX functionality. It resides in libc because it is needed by both librt and nptl/htl. In the sem_open implementation, tmpfname is initialized directly from a string constant. This happens to remove one alloca call. Checked on x86_64-linux-gnu.
* sunrpc: Fix typo in xdr_string commentPaul Zimmermann2021-02-081-1/+1
|
* tst: Provide test for ppollLukasz Majewski2021-02-082-1/+57
| | | | | | | | | | | This change adds new test to assess ppoll()'s timeout related functionality (the struct pollfd does not provide valid fd to wait for - just wait for timeout). To be more specific - two use cases are checked: - if ppoll() times out immediately when passed struct timespec has zero values of tv_nsec and tv_sec. - if ppoll() times out after timeout specified in passed argument
* tst: Provide test for timerfd related functionsLukasz Majewski2021-02-082-1/+67
| | | | | | | This change adds new test to assess functionality of timerfd_* functions. It creates new timer (operates on its file descriptor) and checks if time before and after sleep is between expected values.
* x86: Add PTWRITE feature detection [BZ #27346]H.J. Lu2021-02-0710-5/+47
| | | | | | | 1. Add CPUID_INDEX_14_ECX_0 for CPUID leaf 0x14 to detect PTWRITE feature in EBX of CPUID leaf 0x14 with ECX == 0. 2. Add PTWRITE detection to CPU feature tests. 3. Add 2 static CPU feature tests.
* nsswitch: return result when nss database is locked [BZ #27343]Sergei Trofimovich2021-02-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Before the change nss_database_check_reload_and_get() did not populate the '*result' value when it returned success in a case of chroot detection. This caused initgroups() to use garage pointer in the following test (extracted from unbound): ``` int main() { // load some NSS modules struct passwd * pw = getpwnam("root"); chdir("/tmp"); chroot("/tmp"); chdir("/"); // access nsswitch.conf in a chroot initgroups("root", 0); } ``` Reviewed-by: DJ Delorie <dj@redhat.com>
* printf: Add smoke tests for long doubleSiddhesh Poyarekar2021-02-052-28/+103
| | | | | | | The printf tests have no coverage for long double. Duplicate the double tests so that we have some basic coverage. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add NT_ARM_TAGGED_ADDR_CTRL from Linux 5.10 to elf.h.Joseph Myers2021-02-051-0/+2
| | | | | | | This patch adds the new NT_ARM_TAGGED_ADDR_CTRL constant from Linux 5.10 to glibc's elf.h. Tested for x86_64.
* argp: Avoid undefined behaviour when invoking qsort().Bruno Haible2021-02-041-81/+173
| | | | | | | | | | | | | | | This fixes a Gnulib test-argp-2.sh test failure on macOS and FreeBSD. Reported by Jeffrey Walton <noloader@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00085.html>. * argp/argp-help.c (group_cmp): Remove third argument. (hol_sibling_cluster_cmp, hol_cousin_cluster_cmp): New functions, based upon hol_cluster_cmp. (hol_cluster_cmp): Use hol_cousin_cluster_cmp. (hol_entry_cmp): Rewritten to implement a total order. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* argp: Improve comments.Bruno Haible2021-02-041-43/+65
| | | | | | | | | | | * argp/argp-help.c: Add sectioning comments. Write NULL to designate a null pointer. (struct hol_entry): Fix comment regarding sort order of group. (hol_entry_short_iterate, hol_entry_long_iterate): Add comment. (until_short, canon_doc_option, hol_entry_qcmp): Improve comment. (hol_cluster_is_child, argp_hol): Move functions. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* argp: Don't pass invalid arguments to isspace, isalnum, isalpha, isdigit.Bruno Haible2021-02-041-7/+7
| | | | | | | | | * lib/argp-help.c (SKIPWS): Cast character to 'unsigned char' before passing it to isspace(). (fill_in_uparams): Likewise for isalpha(), isalnum(), isdigit(). (canon_doc_option): Likewise for isspace(), isalnum(). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* argp: Don't rely on undefined behaviour of _tolower().Bruno Haible2021-02-041-6/+4
| | | | | | | | | | Patch by Eric Blake <https://lists.gnu.org/archive/html/bug-gnulib/2009-09/msg00287.html>. * argp/argp-help.c (hol_entry_cmp): Don't use _tolower on values that are not upper-case. Pass correct range to tolower. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* argp: fix pointer-subtraction bugPaul Eggert2021-02-041-1/+2
| | | | | | | | | * argp/argp-help.c (hol_append): Don't subtract pointers to different arrays, as this can run afoul of -fcheck-pointer-bounds. See the thread containing Bruno Haible's report in: http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00171.html Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use binutils 2.36 branch in build-many-glibcs.py.Joseph Myers2021-02-041-1/+1
| | | | | | This patch makes build-many-glibcs.py use binutils 2.36 branch. Tested with build-many-glibcs.py (compilers and glibcs builds).
* manual: Correct description of ENTRY [BZ #17183]Florian Weimer2021-02-041-11/+15
| | | | | | | | The struct tag is actually entry (not ENTRY). The data member has type void *, and it can point to binary data. Only the key member is required to be a null-terminated string. Reviewed-by: Arjun Shankar <arjun@redhat.com>
* nptl: Remove private futex optimization [BZ #27304]Florian Weimer2021-02-041-13/+1
| | | | | | | | | | | It is effectively used, unexcept for pthread_cond_destroy, where we do not want it; see bug 27304. The internal locks do not support a process-shared mode. This fixes commit dc6cfdc934db9997c33728082d63552b9eee4563 ("nptl: Move pthread_cond_destroy implementation into libc"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* stdio-common: Add a few double formatting tests [BZ #27245]Mike Hommey2021-02-031-1/+29
| | | | | | Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* posix/tst-rfc3484: Fix compile failure linking to local __stat64Stafford Horne2021-02-033-0/+3
| | | | | | | | | | | | | | | | | After 04986243d1 ("Remove internal usage of extensible stat functions") linking the __stat64 symbol in getaddrinfo for this test fails with the below error: [...] or1k-smh-linux-gnu/bin/ld: [...]/posix/tst-rfc3484.o: in function `gaiconf_reload': [...]/sysdeps/posix/getaddrinfo.c:2136: undefined reference to `__stat64' collect2: error: ld returned 1 exit status This is because __stat64 is a local symbol, the test includes the getaddrinfo directly and fails to link against the local symbol. Fix this by setting up an alias to the global stat64 symbol name like is done for other local symbol usage. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* i686: Regenerate ULPsSiddhesh Poyarekar2021-02-031-5/+5
|
* tst-rtld-list-tunables.sh: Unset glibc tunablesH.J. Lu2021-02-021-0/+11
| | | | Unset glibc tunables and their aliases for --list-tunables test.
* linux: Remove shmmax check from tst-sysvshm-linuxAdhemerval Zanella2021-02-021-12/+14
| | | | | | | | | | | | | | | | | | | | The shmmax expected value is tricky to check because kernel clamps it to INT_MAX in two cases: 1. Compat symbols with IPC_64, i.e, 32-bit binaries running on 64-bit kernels. 2. Default symbol without IPC_64 (defined as IPC_OLD within Linux) and glibc always use IPC_64 for 32-bit ABIs (to support 64-bit time_t). It means that 32-bit binaries running on 32-bit kernels will not see shmmax being clamped. And finding out whether the compat symbol is used would require checking the underlying kernel against the current ABI. The shmall and shmmni already provided enough coverage. Checked on x86_64-linux-gnu and i686-linux-gnu. It should fix the tst-sysvshm-linux failures on 32-bit kernels.
* x86: Adding an upper bound for Enhanced REP MOVSB.Sajan Karumanchi2021-02-024-3/+25
| | | | | | | | | | | | | | | In the process of optimizing memcpy for AMD machines, we have found the vector move operations are outperforming enhanced REP MOVSB for data transfers above the L2 cache size on Zen3 architectures. To handle this use case, we are adding an upper bound parameter on enhanced REP MOVSB:'__x86_rep_movsb_stop_threshold'. As per large-bench results, we are configuring this parameter to the L2 cache size for AMD machines and applicable from Zen3 architecture supporting the ERMS feature. For architectures other than AMD, it is the computed value of non-temporal threshold parameter. Reviewed-by: Premachandra Mallappa <premachandra.mallappa@amd.com>
* Fix version.h for glibc 2.34 developmentAdhemerval Zanella2021-02-021-1/+1
|
* Add MS_NOSYMFOLLOW from Linux 5.10 to <sys/mount.h>.Joseph Myers2021-02-021-0/+2
| | | | | | | This patch adds the new constant MS_NOSYMFOLLOW from Linux 5.10 to <sys/mount.h>. Tested for x86_64.
* Move _SC_MINSIGSTKSZ/_SC_SIGSTKSZ entry in NEWSH.J. Lu2021-02-011-6/+4
| | | | Move _SC_MINSIGSTKSZ/_SC_SIGSTKSZ entry to 2.34 section.
* libSegFault: Fix printing signal number [BZ #27249]Vitaly Chikunov2021-02-011-1/+1
| | | | | | | | | Signal number is written into the tail of buf, but printed from the beginning, outputting garbage on the screen. Fix this by printing from the correct position. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
* hurd TIOCFLUSH: fix fixing argumentSamuel Thibault2021-02-011-2/+2
| | | | The argument actually used inside send_rpc is argptr, not arg.
* sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305]H.J. Lu2021-02-0123-3/+416
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add _SC_MINSIGSTKSZ for the minimum signal stack size derived from AT_MINSIGSTKSZ, which is the minimum number of bytes of free stack space required in order to gurantee successful, non-nested handling of a single signal whose handler is an empty function, and _SC_SIGSTKSZ which is the suggested minimum number of bytes of stack space required for a signal stack. If AT_MINSIGSTKSZ isn't available, sysconf (_SC_MINSIGSTKSZ) returns MINSIGSTKSZ. On Linux/x86 with XSAVE, the signal frame used by kernel is composed of the following areas and laid out as: ------------------------------ | alignment padding | ------------------------------ | xsave buffer | ------------------------------ | fsave header (32-bit only) | ------------------------------ | siginfo + ucontext | ------------------------------ Compute AT_MINSIGSTKSZ value as size of xsave buffer + size of fsave header (32-bit only) + size of siginfo and ucontext + alignment padding. If _SC_SIGSTKSZ_SOURCE or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ are redefined as /* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ). */ # undef SIGSTKSZ # define SIGSTKSZ sysconf (_SC_SIGSTKSZ) /* Minimum stack size for a signal handler: SIGSTKSZ. */ # undef MINSIGSTKSZ # define MINSIGSTKSZ SIGSTKSZ Compilation will fail if the source assumes constant MINSIGSTKSZ or SIGSTKSZ. The reason for not simply increasing the kernel's MINSIGSTKSZ #define (apart from the fact that it is rarely used, due to glibc's shadowing definitions) was that userspace binaries will have baked in the old value of the constant and may be making assumptions about it. For example, the type (char [MINSIGSTKSZ]) changes if this #define changes. This could be a problem if an newly built library tries to memcpy() or dump such an object defined by and old binary. Bounds-checking and the stack sizes passed to things like sigaltstack() and makecontext() could similarly go wrong.
* hurd TIOCFLUSH: Cope BSD 4.1 semanticSamuel Thibault2021-02-011-0/+4
| | | | | | BSD 4.1 did not have an argument for TIOCFLUSH, BSD 4.2 added it. There are still a lot of applications out there that pass a NULL argument to TIOCFLUSH, so we should rather cope with it.
* tst-mallinfo2.c: Remove useless trailing semicolon for macroYang Xu2021-02-011-1/+1
| | | | | | Macros should not use a trailing semicolon, so remove it. Reviewed-by: DJ Delorie <dj@redhat.com>
* elf: Replace a --defsym trick with an object file to be compatible with LLDFangrui Song2021-02-011-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing code specifies -Wl,--defsym=malloc=0 and other malloc.os definitions before libc_pic.a so that libc_pic.a(malloc.os) is not fetched. This trick is used to avoid multiple definition errors which would happen as a chain result: dl-allobjs.os has an undefined __libc_scratch_buffer_set_array_size __libc_scratch_buffer_set_array_size fetches libc_pic.a(scratch_buffer_set_array_size.os) libc_pic.a(scratch_buffer_set_array_size.os) has an undefined free free fetches libc_pic.a(malloc.os) libc_pic.a(malloc.os) has an undefined __libc_message __libc_message fetches libc_pic.a(libc_fatal.os) libc_fatal.os will cause a multiple definition error (__GI___libc_fatal) >>> defined at dl-fxstatat64.c >>> /tmp/p/glibc/Release/elf/dl-allobjs.os:(__GI___libc_fatal) >>> defined at libc_fatal.c >>> libc_fatal.os:(.text+0x240) in archive /tmp/p/glibc/Release/libc_pic.a LLD processes --defsym after all input files, so this trick does not suppress multiple definition errors with LLD. Split the step into two and use an object file to make the intention more obvious and make LLD work. This is conceptually more appropriate because --defsym defines a SHN_ABS symbol while a normal definition is relative to the image base. See https://sourceware.org/pipermail/libc-alpha/2020-March/111910.html for discussions about the --defsym semantics. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* Open master branch for glibc 2.34 development glibc-2.33.9000Adhemerval Zanella2021-02-012-2/+26
|
* Prepare for glibc 2.33 release glibc-2.33Adhemerval Zanella2021-02-013-3/+12849
| | | | Update version.h, features.h, and ChangeLog.old/ChangeLog.22.
* Update NEWS with bugsAdhemerval Zanella2021-02-011-2/+118
|
* Update translationsAdhemerval Zanella2021-02-011-0/+6965
| | | | Add missing Serbian translation.
* NEWS: Fix typo in CVE-2021-3326 entryFlorian Weimer2021-01-291-1/+1
|
* elf: Fix tests that rely on ld.so.cache for cross-compilingAdhemerval Zanella2021-01-293-0/+26
| | | | | | | | | | | | | | | | For configurations with cross-compiling equal to 'maybe' or 'no', ldconfig will not run and thus the ld.so.cache will not be created on the container testroot.pristine. This lead to failures on both tst-glibc-hwcaps-prepend-cache and tst-ldconfig-ld_so_conf-update on environments where the same compiler can be used to build different ABIs (powerpc and x86 for instance). This patch addas a new test-container hook, ldconfig.run, that triggers a ldconfig execution prior the test execution. Checked on x86_64-linux-gnu and i686-linux-gnu.
* NEWS: Mention CVE-2021-3326 (iconv assertion with ISO-20220-JP-3)Florian Weimer2021-01-291-0/+6
|
* NEWS: Add entry for glibc-hwcaps and deprecate legacy hwcapsFlorian Weimer2021-01-291-0/+21
|