about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* tests: replace fgets by xfgetsFrederic Berat2023-06-131-1/+2
| | | | | | With fortification enabled, fgets calls return result needs to be checked, has it gets the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* posix: Handle success in gai_strerror()Dridi Boukelmoune2023-06-131-0/+1
| | | | | Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com> Reviewed-by: Arjun Shankar <arjun@redhat.com>
* LoongArch: Add support for dl_runtime_profilecaiyinyu2023-06-135-4/+220
| | | | This commit can fix the FAIL item: elf/tst-sprof-basic.
* x86: Make the divisor in setting `non_temporal_threshold` cpu specificNoah Goldstein2023-06-124-26/+51
| | | | | | | | | | | | | | | | Different systems prefer a different divisors. From benchmarks[1] so far the following divisors have been found: ICX : 2 SKX : 2 BWD : 8 For Intel, we are generalizing that BWD and older prefers 8 as a divisor, and SKL and newer prefers 2. This number can be further tuned as benchmarks are run. [1]: https://github.com/goldsteinn/memcpy-nt-benchmarks Reviewed-by: DJ Delorie <dj@redhat.com>
* x86: Refactor Intel `init_cpu_features`Noah Goldstein2023-06-121-81/+309
| | | | | | | | | | | | | | | This patch should have no affect on existing functionality. The current code, which has a single switch for model detection and setting prefered features, is difficult to follow/extend. The cases use magic numbers and many microarchitectures are missing. This makes it difficult to reason about what is implemented so far and/or how/where to add support for new features. This patch splits the model detection and preference setting stages so that CPU preferences can be set based on a complete list of available microarchitectures, rather than based on model magic numbers. Reviewed-by: DJ Delorie <dj@redhat.com>
* x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4`Noah Goldstein2023-06-121-27/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current `non_temporal_threshold` set to roughly '3/4 * sizeof_L3 / ncores_per_socket'. This patch updates that value to roughly 'sizeof_L3 / 4` The original value (specifically dividing the `ncores_per_socket`) was done to limit the amount of other threads' data a `memcpy`/`memset` could evict. Dividing by 'ncores_per_socket', however leads to exceedingly low non-temporal thresholds and leads to using non-temporal stores in cases where REP MOVSB is multiple times faster. Furthermore, non-temporal stores are written directly to main memory so using it at a size much smaller than L3 can place soon to be accessed data much further away than it otherwise could be. As well, modern machines are able to detect streaming patterns (especially if REP MOVSB is used) and provide LRU hints to the memory subsystem. This in affect caps the total amount of eviction at 1/cache_associativity, far below meaningfully thrashing the entire cache. As best I can tell, the benchmarks that lead this small threshold where done comparing non-temporal stores versus standard cacheable stores. A better comparison (linked below) is to be REP MOVSB which, on the measure systems, is nearly 2x faster than non-temporal stores at the low-end of the previous threshold, and within 10% for over 100MB copies (well past even the current threshold). In cases with a low number of threads competing for bandwidth, REP MOVSB is ~2x faster up to `sizeof_L3`. The divisor of `4` is a somewhat arbitrary value. From benchmarks it seems Skylake and Icelake both prefer a divisor of `2`, but older CPUs such as Broadwell prefer something closer to `8`. This patch is meant to be followed up by another one to make the divisor cpu-specific, but in the meantime (and for easier backporting), this patch settles on `4` as a middle-ground. Benchmarks comparing non-temporal stores, REP MOVSB, and cacheable stores where done using: https://github.com/goldsteinn/memcpy-nt-benchmarks Sheets results (also available in pdf on the github): https://docs.google.com/spreadsheets/d/e/2PACX-1vS183r0rW_jRX6tG_E90m9qVuFiMbRIJvi5VAE8yYOvEOIEEc3aSNuEsrFbuXw5c3nGboxMmrupZD7K/pubhtml Reviewed-by: DJ Delorie <dj@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* pthreads: Use _exit to terminate the tst-stdio1 testFlorian Weimer2023-06-061-1/+1
| | | | | | Previously, the exit function was used, but this causes the test to block (until the timeout) once exit is changed to lock stdio streams during flush.
* linux: Fail as unsupported if personality call is filteredAdhemerval Zanella2023-06-051-12/+21
| | | | | | | | | | | | | | | | | | | | | Container management default seccomp filter [1] only accepts personality(2) with PER_LINUX, (0x0), UNAME26 (0x20000), PER_LINUX32 (0x8), UNAME26 | PER_LINUX32, and 0xffffffff (to query current personality) Although the documentation only state it is blocked to prevent 'enabling BSD emulation' (PER_BSD, not implemented by Linux), checking on repository log the real reason is to block ASLR disable flag (ADDR_NO_RANDOMIZE) and other poorly support emulations. So handle EPERM and fail as UNSUPPORTED if we can really check for BZ#19408. Checked on aarch64-linux-gnu. [1] https://github.com/moby/moby/blob/master/profiles/seccomp/default.json Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Remove MAP_VARIABLE from hppa bits/mman.hJoseph Myers2023-06-051-1/+0
| | | | | | | | | As suggested in <https://sourceware.org/pipermail/libc-alpha/2023-February/145890.html>, remove the MAP_VARIABLE define from the hppa bits/mman.h, for consistency with Linux 6.2 which removed the define there. Tested with build-many-glibcs.py for hppa-linux-gnu.
* hurd: Fix x86_64 sigreturn restoring bogus reply_portSergey Bugaev2023-06-041-38/+46
| | | | | | | | | | Since the area of the user's stack we use for the registers dump (and otherwise as __sigreturn2's stack) can and does overlap the sigcontext, we have to be very careful about the order of loads and stores that we do. In particular we have to load sc_reply_port before we start clobbering the sigcontext. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* Fix a few more typos I missed in previous round -- BZ 25337Paul Pluzhnikov2023-06-025-5/+5
|
* Use __nonnull for the epoll_wait(2) family of syscallsAlejandro Colomar2023-06-011-4/+4
| | | | | Signed-off-by: Alejandro Colomar <alx@kernel.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix invalid use of NULL in epoll_pwait2(2) testAlejandro Colomar2023-06-011-1/+3
| | | | | | | | | epoll_pwait2(2)'s second argument should be nonnull. We're going to add __nonnull to the prototype, so let's fix the test accordingly. We can use a dummy variable to avoid passing NULL. Reported-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
* getipv4sourcefilter: Get rid of allocaJoe Simmons-Talbott2023-06-011-17/+7
| | | | | | Use a scratch_buffer rather than alloca to avoid potential stack overflows. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* getsourcefilter: Get rid of alloca.Joe Simmons-Talbott2023-06-011-17/+7
| | | | | | Use a scratch_buffer rather than alloca to avoid potential stack overflows. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tests: fix warn unused resultsFrédéric Bérat2023-06-012-3/+9
| | | | | | With fortification enabled, few function calls return result need to be checked, has they get the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* tests: replace write by xwriteFrédéric Bérat2023-06-017-11/+19
| | | | | | | Using write without cheks leads to warn unused result when __wur is enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* x86-64: Use YMM registers in memcmpeq-evex.SH.J. Lu2023-06-011-1/+1
| | | | | | | Since the assembly source file with -evex suffix should use YMM registers, not ZMM registers, include x86-evex256-vecs.h by default to use YMM registers in memcmpeq-evex.S Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
* io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64Adhemerval Zanella2023-05-311-0/+6
| | | | | | | | | | | | | | | | | | Different than other 64 bit architectures, powerpc64 defines the LFS POSIX lock constants with values similar to 32 ABI, which are meant to be used with fcntl64 syscall. Since powerpc64 kABI does not have fcntl, the constants are adjusted with the FCNTL_ADJUST_CMD macro. The 4d0fe291aed3a476a changed the logic of generic constants LFS value are equal to the default values; which is now wrong for powerpc64. Fix the value by explicit define the previous glibc constants (powerpc64 does not need to use the 32 kABI value, but it simplifies the FCNTL_ADJUST_CMD which should be kept as compatibility). Checked on powerpc64-linux-gnu and powerpc-linux-gnu.
* Fix misspellings in sysdeps/ -- BZ 25337Paul Pluzhnikov2023-05-30153-214/+214
|
* io: Fix record locking contants on 32 bit arch with 64 bit default time_t ↵Adhemerval Zanella2023-05-301-1/+1
| | | | | | | | | | | | | | | | | | (BZ#30477) For architecture with default 64 bit time_t support, the kernel does not provide LFS and non-LFS values for F_GETLK, F_GETLK, and F_GETLK (the default value used for 64 bit architecture are used). This is might be considered an ABI break, but the currenct exported values is bogus anyway. The POSIX lockf is not affected since it is aliased to lockf64, which already uses the LFS values. Checked on i686-linux-gnu and the new tests on a riscv32. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* LoongArch: Fix inconsistency in SHMLBA macro values between glibc and kernelcaiyinyu2023-05-301-0/+24
| | | | | | | | | The LoongArch glibc was using the value of the SHMLBA macro from common code, which is __getpagesize() (16k), but this was inconsistent with the value of the SHMLBA macro in the kernel, which is SZ_64K (64k). This caused several shmat-related tests in LTP (Linux Test Project) to fail. This commit fixes the issue by ensuring that the glibc's SHMLBA macro value matches the value used in the kernel like other architectures.
* riscv: Add the clone3 wrapperAdhemerval Zanella2023-05-292-0/+80
| | | | | | | | | | | It follows the internal signature: extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); Checked on riscv64-linux-gnu-rv64imafdc-lp64d. Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
* posix: Add error message for EAI_OVERFLOWDridi Boukelmoune2023-05-291-0/+1
| | | | | Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com> Reviewed-by: Arjun Shankar <arjun@redhat.com>
* setsourcefilter: Replace alloca with a scratch_buffer.Joe Simmons-Talbott2023-05-291-20/+7
| | | | | | | | Use a scratch_buffer rather than either alloca or malloc to reduce the possibility of a stack overflow. Suggested-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86: Use 64MB as nt-store threshold if no cacheinfo [BZ #30429]Noah Goldstein2023-05-271-1/+9
| | | | | | | | | | | | If `non_temporal_threshold` is below `minimum_non_temporal_threshold`, it almost certainly means we failed to read the systems cache info. In this case, rather than defaulting the minimum correct value, we should default to a value that gets at least reasonable performance. 64MB is chosen conservatively to be at the very high end. This should never cause non-temporal stores when, if we had read cache info, we wouldn't have otherwise. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* hurd: Fix setting up signal thread stack alignmentSamuel Thibault2023-05-281-7/+5
| | | | | x86_64 needs special alignment when calling functions, so we have to use MACHINE_THREAD_STATE_SETUP_CALL for the signal thread when forking.
* Add MFD_NOEXEC_SEAL, MFD_EXEC from Linux 6.3 to bits/mman-shared.hJoseph Myers2023-05-261-0/+4
| | | | | | | | | Linux 6.3 adds new constants MFD_NOEXEC_SEAL and MFD_EXEC. Add these to bits/mman-shared.h (conditional on MFD_NOEXEC_SEAL not already being defined, similar to the existing conditional on the older MFD_* macros). Tested for x86_64.
* Add IP_LOCAL_PORT_RANGE from Linux 6.3 to bits/in.hJoseph Myers2023-05-261-0/+1
| | | | | | | Linux 6.3 adds a new constant IP_LOCAL_PORT_RANGE. Add it to the corresponding bits/in.h in glibc. Tested for x86_64.
* setipv4sourcefilter: Avoid using alloca.Joe Simmons-Talbott2023-05-261-17/+7
| | | | | | | Use a scratch_buffer rather than alloca/malloc to avoid potential stack overflow. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* sysdeps/pthread/eintr.c: fix warn unused resultFrédéric Bérat2023-05-241-2/+4
| | | | | | | Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in glibc. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Regenerate configure fragment -- BZ 25337.Paul Pluzhnikov2023-05-231-1/+1
| | | | | | | In commit 0b25c28e028b63c95108c442d8112811107e4c13 I updated congure.ac but neglected to regenerate updated configure. Fix this here.
* Fix misspellings in sysdeps/powerpc -- BZ 25337Paul Pluzhnikov2023-05-2323-34/+34
| | | | | | | All fixes are in comments, so the binaries should be identical before/after this commit, but I can't verify this. Reviewed-by: Rajalakshmi Srinivasaraghavan <rajis@linux.ibm.com>
* Fix misspellings in sysdeps/unix -- BZ 25337Paul Pluzhnikov2023-05-2369-87/+87
| | | | | | | Applying this commit results in bit-identical rebuild of libc.so.6 math/libm.so.6 elf/ld-linux-x86-64.so.2 mathvec/libmvec.so.1 Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Fix misspellings in sysdeps/x86_64 -- BZ 25337.Paul Pluzhnikov2023-05-2337-105/+105
| | | | | | | Applying this commit results in bit-identical rebuild of libc.so.6 math/libm.so.6 elf/ld-linux-x86-64.so.2 mathvec/libmvec.so.1 Reviewed-by: Florian Weimer <fweimer@redhat.com>
* mach: Fix accessing mach_i386.hSamuel Thibault2023-05-234-4/+8
| | | | Fixes: 196358ae26aa ("mach: Fix installing mach_i386.h")
* Fix misspellings in sysdeps/x86_64/fpu/multiarch -- BZ 25337.Paul Pluzhnikov2023-05-23112-169/+169
| | | | | | | Applying this commit results in a bit-identical rebuild of mathvec/libmvec.so.1 (which is the only binary that gets rebuilt). Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
* mach: Fix installing mach_i386.hSamuel Thibault2023-05-232-2/+2
| | | | | | We do not want mach_i386.h to get installed into machine/, but into i386/ or x86_64/ depending where mach_i386.defs was found, i.e. according to 32/64 bitness.
* hurd: Fix making ld.so run static binaries with retrySamuel Thibault2023-05-231-1/+1
| | | | We need O_EXEC for __rtld_execve
* Add voice-admit DSCP code point from RFC-5865Ronan Pigott2023-05-221-0/+5
|
* Remove last remnants of have-protectedAndreas Schwab2023-05-223-9/+1
|
* S390: Use compile-only instead of also link-tests in configure.Stefan Liebler2023-05-222-177/+109
| | | | | | | | | | | | | | | | | Some of the s390-specific configure checks are using compile and link configure tests. Now use only compile tests as the link tests fails when e.g. bootstrapping a cross-toolchain due to missing crt-files/libc.so. This is achieved by using AC_COMPILE_IFELSE in configure.ac file. This is observable e.g. when using buildroot which builds glibc only once or the build-many-glibcs.py script. Note that the latter one is building glibc twice in the compilers-step (configure-checks fails) and in the glibcs-step (configure-checks succeed). Note, that the s390 specific configure tests for static PIE have to link an executable to test binutils support. Thus we can't fix those tests.
* htl: Use __hurd_fail () instead of assigning errnoSergey Bugaev2023-05-204-18/+9
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230520115531.3911877-2-bugaevc@gmail.com>
* hurd: Use __hurd_fail () instead of assigning errnoSergey Bugaev2023-05-2044-242/+95
| | | | | | | | | | | | | | The __hurd_fail () inline function is the dedicated, idiomatic way of reporting errors in the Hurd part of glibc. Not only is it more concise than '{ errno = err; return -1; }', it is since commit 6639cc10029e24e06b34e169712b21c31b8cf213 "hurd: Mark error functions as __COLD" marked with the cold attribute, telling the compiler that this codepath is unlikely to be executed. In one case, use __hurd_dfail () over the plain __hurd_fail (). Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230520115531.3911877-1-bugaevc@gmail.com>
* powerpc:GCC(<10) doesn't allow -mlong-double-64 after -mabi=ieeelongdoubleMahesh Bodapati2023-05-191-0/+17
| | | | | Removed -mabi=ieeelongdouble on failing tests. It resolves the error. error: ‘-mabi=ieeelongdouble’ requires ‘-mlong-double-128’
* hurd: Fix using interposable hurd_thread_selfSergey Bugaev2023-05-194-4/+10
| | | | | | | | | | | | Create a private hidden __hurd_thread_self alias, and use that one. Fixes 2f8ecb58a59eb82c43214d000842d99644a662d1 "hurd: Fix x86_64 _hurd_tls_fork" and c7fcce38c83a2bb665ef5dc4981bf20c7e586123 "hurd: Make sure to not use tcb->self" Reported-by: Joseph Myers <joseph@codesourcery.com> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Fix __TIMESIZE on x86_64Sergey Bugaev2023-05-192-1/+5
| | | | | | | We had sizeof (time_t) == 8, but __TIMESIZE == 32. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230519171516.3698754-1-bugaevc@gmail.com>
* hurd: Fix expected c++ typesSamuel Thibault2023-05-191-19/+19
| | | | | 90604f670c10 ("hurd 64bit: Add data for check-c++-types") actually added the 32bit version. This fixes it into a 64bit version.
* Add HWCAP2_SME* from Linux 6.3 to AArch64 bits/hwcap.hJoseph Myers2023-05-181-0/+6
| | | | | | | Linux 6.3 adds six HWCAP2_SME* constants for AArch64; add them to the corresponding bits/hwcap.h in glibc. Tested with build-many-glibcs.py for aarch64-linux-gnu.
* hurd: Also make it possible to call strlen very earlySergey Bugaev2023-05-171-0/+3
| | | | | | | | | | | | strlen, which is another ifunc-selected function, is invoked during early static executable startup if the argv arrives from the exec server. Make it not crash. Checked on x86_64-gnu: statically linked executables launched after the exec server is up now start up successfully. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-10-bugaevc@gmail.com>