about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* S390: Add new hwcap values.Stefan Liebler2021-02-163-3/+8
| | | | The new hwcap values indicate support for arch14 architecture.
* aarch64: Fix sys/ptrace.h if linux headers are includedSzabolcs Nagy2021-02-151-0/+34
| | | | | | If the linux asm/ptrace.h is included before sys/ptrace.h that breaks the newly added declarations there, so undef the names that may be defined as macros in the linux header.
* elf: Do not copy vDSO soname when setting up link mapFlorian Weimer2021-02-121-12/+5
| | | | | | | | | | | | The kernel does not put the vDSO at special addresses, so writev can write the name directly. Also remove the incorrect comment about not setting l_name. Andy Lutomirski confirmed in <https://lore.kernel.org/linux-api/442A16C0-AE5A-4A44-B261-FE6F817EAF3C@amacapital.net/> that this copy is not necessary. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86: Remove the extra space between "# endif"H.J. Lu2021-02-121-1/+1
| | | | | | | | | | Remove the extra space between "# endif" left over from commit f380868f6dcfdeae8d449d556298d9c41012ed8d Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Dec 24 15:43:34 2020 -0800 Remove _ISOMAC check from <cpu-features.h>
* hurd: Fix fstatfs build failureAdhemerval Zanella2021-02-111-1/+1
| | | | | | | It was added by 1bfbaf7130 where it added a libc_hidden_proto for __fstatfs but it didn't update the Hurd version as well. Checked with a build for i686-gnu.
* linux: Remove stat-check.cAdhemerval Zanella2021-02-113-30/+13
| | | | | | | The check is moved to LFS fstatat implementation (since it is the code that actually implements the syscall). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Remove overflow.hAdhemerval Zanella2021-02-111-69/+0
| | | | | | The header is not used anywhere. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Consolidate internal_statvfsAdhemerval Zanella2021-02-119-37/+56
| | | | | | | | | | | Remove the internal_statvfs64.c and open code the implementation on internal_statvfs.c. The alpha is now unrequired, the generic implementation also handles it. Also, remove unused includes on internal_statvfs.c, and remove unused arguments on __internal_statvfs{64}. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Consolidate statvfs implementationsAdhemerval Zanella2021-02-117-48/+26
| | | | | | | | | There is no need to handle ENOSYS on fstatfs64 call, required only for alpha (where is already fallbacks to fstatfs). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Consolidate fstatvfs implementationsAdhemerval Zanella2021-02-117-46/+25
| | | | | | | | | | | There is no need to handle ENOSYS on fstatfs64 call, required only for alpha (where is already fallbacks to fstatfs). The wordsize internal_statvfs64.c is removed, since how the LFS support is provided by fstatvfs64.c (used on 64-bit architectures as well). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Consolidate statfs implementationsAdhemerval Zanella2021-02-119-81/+125
| | | | | | | | | | | | | | | | | | | | | | | | The __NR_statfs64 syscall is supported on all architectures but aarch64, mips64, riscv64, and x86_64. And newer ABIs also uses the new statfs64 interface (where the struct size is used as second argument). So the default implementation now uses: 1. __NR_statfs64 for non-LFS call and handle overflow directly There is no need to handle __NR_statfs since all architectures that only support are LFS only. 2. __NR_statfs if defined or __NR_statfs64 otherwise for LFS call. Alpha is the only outlier, since it is a 64-bit architecture which provides non-LFS interface and only provides __NR_statfs64 on newer kernels (v5.1+). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Consolidate fstatfs implementationsAdhemerval Zanella2021-02-1110-77/+129
| | | | | | | | | | | | | | | | | | | | | | | | The __NR_fstatfs64 syscall is supported on all architectures but aarch64, mips64, riscv64, and x86_64. And newer ABIs also uses the new fstatfs64 interface (where the struct size is used as first argument). So the default implementation now uses: 1. __NR_fstatfs64 for non-LFS call and handle overflow directly There is no need to handle __NR_fstatfs since all architectures that only support are LFS only. 2. __NR_fstatfs if defined or __NR_fstatfs64 otherwise for LFS call. Alpha is the only outlier, it is a 64-bit architecture which provides non-LFS interface and only provides __NR_fstatfs64 on newer kernels (5.1+). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Set LFS statfs as defaultAdhemerval Zanella2021-02-112-11/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently glibc has three different struct statfs{64} definitions: 1. Non-LFS support where non-LFS and LFS struct have different size: alpha, arm, hppa, i686, m68k, microblaze, mips (all abis), powerpc32, s390, sh4, and sparc. 2. Non-LFS support where non-LFS and LFS struct have the same size: csky and nios2. 3. Only LFS support (where both struct have the same size): arc, ia64, powerpc64 (including LE), riscv (both 32 and 64 bits), s390x, sparc64, and x86 (including x32). The STATFS_IS_STATFS64/__STATFS_MATCHES_STATFS64 does not tell apart between 1. and 2. since for both the only difference is the struct size (for 2. both non-LFS and LFS uses the same syscall, where for 1. the old non-LFS is used for [f]statfs). This patch move the generic statfs.h for both csky and nios2, and make the default definitions for newer ABIs to assume that only LFS will be support (so there is no need to keep no-LFS and LFS struct statfs with the same size, it will be implicit). This patch does not change the code generation. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Set default kernel_stat.h to LFSAdhemerval Zanella2021-02-1115-200/+231
| | | | | | | | | | | | | | The XSTAT_IS_XSTAT64 and STAT_IS_KERNEL_STAT flags are now set to 1 and STATFS_IS_STATFS64 is set to __STATFS_MATCHES_STATFS64. This makes the default ABI for newer ports to provide only LFS calls. A copy of non-LFS support is provided to 32-bit ABIS with non-LFS support (arm, csky, i386, m68k, nios2, s390, and sh). Is also allows to remove the 64-bit ports, which already uses the default values. This patch does not change the code generation. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Fix STATFS_IS_STATFS64 definitionAdhemerval Zanella2021-02-118-8/+36
| | | | | | | | | | | | | | | aarch64, arc, ia64, mips64, powerpc64, riscv32, riscv64, s390x, sparc64, and x86_64 defines STATFS_IS_STATFS64 to 0, but all of them alias statfs to statfs64 and the struct statfs has the same and layout of struct statfs64. The correct definition will be used on the [f]statfs[64] consolidation. This patch does not change code generation since the symbols are implemented using the auto-generation syscall for all the aforementioned ABIs. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* tunables: Disallow negative values for some tunablesSiddhesh Poyarekar2021-02-102-1/+7
| | | | | | | | The glibc.malloc.mmap_max tunable as well as al of the INT_32 tunables don't have use for negative values, so pin the hardcoded limits in the non-negative range of INT. There's no real benefit in any of those use cases for the extended range of unsigned, so I have avoided added a new type to keep things simple.
* x86: Use SIZE_MAX instead of (long int)-1 for tunable range valueSiddhesh Poyarekar2021-02-101-5/+5
| | | | | The tunable types are SIZE_T, so set the ranges to the correct maximum value, i.e. SIZE_MAX.
* tunables: Simplify TUNABLE_SET interfaceSiddhesh Poyarekar2021-02-106-127/+75
| | | | | | | | | | | | | | | The TUNABLE_SET interface took a primitive C type argument, which resulted in inconsistent type conversions internally due to incorrect dereferencing of types, especialy on 32-bit architectures. This change simplifies the TUNABLE setting logic along with the interfaces. Now all numeric tunable values are stored as signed numbers in tunable_num_t, which is intmax_t. All calls to set tunables cast the input value to its primitive type and then to tunable_num_t for storage. This relies on gcc-specific (although I suspect other compilers woul also do the same) unsigned to signed integer conversion semantics, i.e. the bit pattern is conserved. The reverse conversion is guaranteed by the standard.
* setrlimit/getrlimit: Use __nonnull to avoid null pointerXiaoming Ni2021-02-102-8/+10
| | | | | | | | | | | | | | | | Add __nonnull((2)) to the setrlimit()/getrlimit() function declaration to avoid null pointer access. ----- v2 According to the suggestions of the Adhemerval Zanella and Zack Weinberg: use __nonnull() to check null pointers in the compilation phase. do not add pointer check code to setrlimit()/getrlimit(). The validity of the "resource" parameter is checked in the syscall. v1 https://public-inbox.org/libc-alpha/20201230114131.47589-1-nixiaoming@huawei.com/ ----- Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* benchtests: Updated json bench-variant attributeNaohiro Tamura2021-02-101-1/+1
| | | | | | | | | | This patch updates json "bench-variant" attribute of "bench-memset.c" to "default" so that the script "benchtests/scripts/plot_strings.py" can generate a file "memset_time_default_linear.png". Without this patch, the script "benchtests/scripts/plot_strings.py" generates a file "memset_time__linear.png" which has inconsistent form with "memcpy_time_default_linear.png" and "memmove_time_default_linear.png".
* regex: stop using allocaAdhemerval Zanella2021-02-091-19/+0
| | | | | | | It syncs with gnulib version 87ed1f9c4. No functional changes is expected. Checked on x86_64-linux-gnu.
* 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>