aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
AgeCommit message (Collapse)Author
2022-08-22Add AGROUP from Linux 5.19 to sys/acct.h, remove Alpha version (bug 29502)Joseph Myers
Linux 5.19 adds a new accounting flag AGROUP; add it to the enumeration in sys/acct.h. This shows up that the Alpha-specific variant of this header has a different set of constants and struct acct, which appear to be the constants and structure layout from Linux 2.0. These were changed some time between Linux 2.0 and Linux 2.2; I see no evidence of an Alpha-specific layout or set of constants, but haven't checked the detailed Linux kernel history between those versions. Rather, it looks like tha Alpha-specific header was originally needed because of the use of types in the kernel structure (such as uid_t and gid_t) that had different sizes on Alpha, and when glibc was updated for changes to the structure and constants in the kernel 1998-10-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/sys/acct.h: Bring in sync with current linux 2.1 version. that simply omitted to do anything about the Alpha version. Thus, remove the Alpha version in order to get the updated definitions into use on Alpha, as I don't think the interfaces are actually different for Alpha with any kernel version supported by glibc. Tested for x86_64, and with build-many-glibcs.py for alpha-linux-gnu.
2022-08-22alpha: Fix generic brk system call emulation in __brk_call (bug 29490)Florian Weimer
The kernel special-cases the zero argument for alpha brk, and we can use that to restore the generic Linux error handling behavior. Fixes commit b57ab258c1140bc45464b4b9908713e3e0ee35aa ("Linux: Introduce __brk_call for invoking the brk system call").
2022-08-19hurd: Assume non-suid during bootstrapSamuel Thibault
We do not have a hurd data block only when bootstrapping the system, in which case we don't have a notion of suid yet anyway. This is needed, otherwise init_standard_fds would check that standard file descriptors are allocated, which is meaningless during bootstrap.
2022-08-18S390: Fix werror=unused-variable in ifunc-impl-list.c.Stefan Liebler
If the architecture level set is high enough, no IFUNCs are used at all and the variable i would be unused. Then the build fails with: ../sysdeps/s390/multiarch/ifunc-impl-list.c: In function ‘__libc_ifunc_impl_list’: ../sysdeps/s390/multiarch/ifunc-impl-list.c:76:10: error: unused variable ‘i’ [-Werror=unused-variable] 76 | size_t i = max; | ^ cc1: all warnings being treated as errors
2022-08-18Ensure calculations happen with desired rounding mode in y1lf128Michael Hudson-Doyle
math/test-float128-y1 fails on x86_64 and ppc64el with gcc 12 and -O3, because code inside a block guarded by SET_RESTORE_ROUNDL is being moved after the rounding mode has been restored. Use math_force_eval to prevent this (and insert some math_opt_barrier calls to prevent code from being moved before the rounding mode is set). Fixes #29463 Reviewed-By: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2022-08-16Linux: Fix enum fsconfig_command detection in <sys/mount.h>Florian Weimer
The #ifdef FSOPEN_CLOEXEC check did not work because the macro was always defined in this header prior to the check, so that the <linux/mount.h> contents did not matter. Fixes commit 774058d72942249f71d74e7f2b639f77184160a6 ("linux: Fix sys/mount.h usage with kernel headers").
2022-08-15Move ip_mreqn structure from Linux to genericSamuel Thibault
I.e. from sysdeps/unix/sysv/linux/bits/in.h to netinet/in.h It is following both the BSD and Linux definitions. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-15Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485)Florian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-12arm: Remove nested functionf rom relocate_pc24Adhemerval Zanella
Checked on arm-linux-gnueabihf.
2022-08-12linux: Fix sys/mount.h usage with kernel headersAdhemerval Zanella
Now that kernel exports linux/mount.h and includes it on linux/fs.h, its definitions might clash with glibc exports sys/mount.h. To avoid the need to rearrange the Linux header to be always after glibc one, the glibc sys/mount.h is changed to: 1. Undefine the macros also used as enum constants. This covers prior inclusion of <linux/mount.h> (for instance MS_RDONLY). 2. Include <linux/mount.h> based on the usual __has_include check (needs to use __has_include ("linux/mount.h") to paper over GCC bugs. 3. Define enum fsconfig_command only if FSOPEN_CLOEXEC is not defined. (FSOPEN_CLOEXEC should be a very close proxy.) 4. Define struct mount_attr if MOUNT_ATTR_SIZE_VER0 is not defined. (Added in the same commit on the Linux side.) This patch also adds some tests to check if including linux/fs.h and linux/mount.h after and before sys/mount.h does work. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12linux: Use compile_c_snippet to check linux/mount.h availabilityAdhemerval Zanella
Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12linux: Mimic kernel defition for BLOCK_SIZEAdhemerval Zanella
To avoid possible warnings if the kernel header is included before sys/mount.h. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12linux: Use compile_c_snippet to check linux/pidfd.h availabilityAdhemerval Zanella
Instead of tying to a specific kernel version. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12LoongArch: Add pointer mangling support.caiyinyu
2022-08-11AArch64: Fix typo in sve configure check (BZ# 29394)Wilco Dijkstra
Fix a typo in the SVE configure check. This fixes [BZ# 29394].
2022-08-11libio: Improve performance of IO locksWilco Dijkstra
Improve performance of recursive IO locks by adding a fast path for the single-threaded case. To reduce the number of memory accesses for locking/unlocking, only increment the recursion counter if the lock is already taken. On Neoverse V1, a microbenchmark with many small freads improved by 2.9x. Multithreaded performance improved by 2%. Reviewed-by: Cristian Rodríguez <crrodriguez@opensuse.org>
2022-08-11tst-process_madvise: Check process_madvise-syscall support.Stefan Liebler
So far this test checks if pidfd_open-syscall is supported, which was introduced with linux 5.3. The process_madvise-syscall was introduced with linux 5.10. Thus you'll get FAILs if you are running a kernel in between. This patch adds a check if the first process_madvise-syscall returns ENOSYS and in this case will fail with UNSUPPORTED. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-09x86: Fix `#define STRCPY` guard in strcpy-sse2.SNoah Goldstein
`#ifndef STPCPY` is incorrect for checking if `STRCPY` is already defined. It doesn't end up mattering as the whole check is guarded by `#if IS_IN (libc)` but is incorrect none the less.
2022-08-05i386: Use cmpl instead of cmpAdhemerval Zanella
Clang cannot assemble cmp in the AT&T dialect mode.
2022-08-05i386: Use fldt instead of fld on e_logl.SAdhemerval Zanella
Clang cannot assemble fldt in the AT&T dialect mode.
2022-08-04i386: Replace movzx with movzblFangrui Song
Similar to 6720d36b6623c5e48c070d86acf61198b33e144e for x86-64. Clang cannot assemble movzx in the AT&T dialect mode. Change movzx to movzbl, which follows the AT&T dialect and is used elsewhere in the file.
2022-08-04i386: Remove RELA supportAdhemerval Zanella
Now that prelink is not support, there is no need to keep supporting rela for non bootstrap.
2022-08-04arm: Remove RELA supportAdhemerval Zanella
Now that prelink is not support, there is no need to keep supporting rela for non bootstrap.
2022-08-04Remove ldd libc4 supportAdhemerval Zanella
The older libc versions are obsolete for over twenty years now.
2022-08-04Assume only FLAG_ELF_LIBC6 suportLucas A. M. Magalhaes
The older libc versions are obsolete for over twenty years now. This patch removes the special flags for libc5 and libc4 and assumes that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6. Checked with a build for all affected architectures. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-08-04Remove left over LD_LIBRARY_VERSION usagesAdhemerval Zanella
The environment variable was removed by d2db60d8d830ef68c8d20a77ac3572d610aa40b1.
2022-08-04Linux: Remove exit system call from _exitFlorian Weimer
exit only terminates the current thread, not the whole process, so it is the wrong fallback system call in this context. All supported Linux versions implement the exit_group system call anyway.
2022-08-04LoongArch: Add vdso support for gettimeofday.caiyinyu
2022-08-03Update kernel version to 5.19 in header constant testsJoseph Myers
This patch updates the kernel version in the tests tst-mman-consts.py, tst-mount-consts.py and tst-pidfd-consts.py to 5.18. (There are no new constants covered by these tests in 5.19, or in 5.17 or 5.18 in the case of tst-mount-consts.py that previously used version 5.16, that need any other header changes.) Tested with build-many-glibcs.py.
2022-08-03nptl: Remove uses of assert_perrorFlorian Weimer
__pthread_sigmask cannot actually fail with valid pointer arguments (it would need a really broken seccomp filter), and we do not check for errors elsewhere. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-08-03stdio: Clean up __libc_message after unconditional abortFlorian Weimer
Since commit ec2c1fcefb200c6cb7e09553f3c6af8815013d83 ("malloc: Abort on heap corruption, without a backtrace [BZ #21754]"), __libc_message always terminates the process. Since commit a289ea09ea843ced6e5277c2f2e63c357bc7f9a3 ("Do not print backtraces on fatal glibc errors"), the backtrace facility has been removed. Therefore, remove enum __libc_message_action and the action argument of __libc_message, and mark __libc_message as _No_return. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-08-02Update syscall lists for Linux 5.19Joseph Myers
Linux 5.19 has no new syscalls, but enables memfd_secret in the uapi headers for RISC-V. Update the version number in syscall-names.list to reflect that it is still current for 5.19 and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
2022-08-02socket: Check lengths before advancing pointer in CMSG_NXTHDRArjun Shankar
The inline and library functions that the CMSG_NXTHDR macro may expand to increment the pointer to the header before checking the stride of the increment against available space. Since C only allows incrementing pointers to one past the end of an array, the increment must be done after a length check. This commit fixes that and includes a regression test for CMSG_FIRSTHDR and CMSG_NXTHDR. The Linux, Hurd, and generic headers are all changed. Tested on Linux on armv7hl, i686, x86_64, aarch64, ppc64le, and s390x. [BZ #28846] Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-07-29tst-pidfd.c: UNSUPPORTED if we get EPERM on valid pidfd_getfd callMark Wielaard
pidfd_getfd can fail for a valid pidfd with errno EPERM for various reasons in a restricted environment. Use FAIL_UNSUPPORTED in that case. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-07-29LoongArch: Add greg_t and gregset_t.caiyinyu
2022-07-29LoongArch: Fix VDSO_HASH and VDSO_NAME.caiyinyu
2022-07-27riscv: Update rv64 libm test ulpsDarius Rad
Generated on a Microsemi Polarfire Icicle Kit running Linux version 5.15.32. Same ULPs were also produced on QEMU 5.2.0 running Linux 5.18.0.
2022-07-27riscv: Update nofpu libm test ulpsDarius Rad
2022-07-27arc4random: simplify design for better safetyJason A. Donenfeld
Rather than buffering 16 MiB of entropy in userspace (by way of chacha20), simply call getrandom() every time. This approach is doubtlessly slower, for now, but trying to prematurely optimize arc4random appears to be leading toward all sorts of nasty properties and gotchas. Instead, this patch takes a much more conservative approach. The interface is added as a basic loop wrapper around getrandom(), and then later, the kernel and libc together can work together on optimizing that. This prevents numerous issues in which userspace is unaware of when it really must throw away its buffer, since we avoid buffering all together. Future improvements may include userspace learning more from the kernel about when to do that, which might make these sorts of chacha20-based optimizations more possible. The current heuristic of 16 MiB is meaningless garbage that doesn't correspond to anything the kernel might know about. So for now, let's just do something conservative that we know is correct and won't lead to cryptographic issues for users of this function. This patch might be considered along the lines of, "optimization is the root of all evil," in that the much more complex implementation it replaces moves too fast without considering security implications, whereas the incremental approach done here is a much safer way of going about things. Once this lands, we can take our time in optimizing this properly using new interplay between the kernel and userspace. getrandom(0) is used, since that's the one that ensures the bytes returned are cryptographically secure. But on systems without it, we fallback to using /dev/urandom. This is unfortunate because it means opening a file descriptor, but there's not much of a choice. Secondly, as part of the fallback, in order to get more or less the same properties of getrandom(0), we poll on /dev/random, and if the poll succeeds at least once, then we assume the RNG is initialized. This is a rough approximation, as the ancient "non-blocking pool" initialized after the "blocking pool", not before, and it may not port back to all ancient kernels, though it does to all kernels supported by glibc (≥3.2), so generally it's the best approximation we can do. The motivation for including arc4random, in the first place, is to have source-level compatibility with existing code. That means this patch doesn't attempt to litigate the interface itself. It does, however, choose a conservative approach for implementing it. Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Cc: Florian Weimer <fweimer@redhat.com> Cc: Cristian Rodríguez <crrodriguez@opensuse.org> Cc: Paul Eggert <eggert@cs.ucla.edu> Cc: Mark Harris <mark.hsj@gmail.com> Cc: Eric Biggers <ebiggers@kernel.org> Cc: linux-crypto@vger.kernel.org Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-07-26LoongArch: Hard Float Supportcaiyinyu
2022-07-26LoongArch: Build Infrastructurecaiyinyu
2022-07-26LoongArch: Add ABI Listscaiyinyu
2022-07-26LoongArch: Linux ABIcaiyinyu
2022-07-26LoongArch: Linux Syscall Interfacecaiyinyu
2022-07-26LoongArch: Atomic and Locking Routinescaiyinyu
2022-07-26LoongArch: Generic <math.h> and soft-fp Routinescaiyinyu
2022-07-26LoongArch: Thread-Local Storage Supportcaiyinyu
2022-07-26LoongArch: ABI Implementationcaiyinyu
2022-07-25struct stat is not posix conformant on microblaze with __USE_FILE_OFFSET64Arnout Vandecappelle (Essensium/Mind)
Commit a06b40cdf5ba0d2ab4f9b4c77d21e45ff284fac7 updated stat.h to use __USE_XOPEN2K8 instead of __USE_MISC to add the st_atim, st_mtim and st_ctim members to struct stat. However, for microblaze, there are two definitions of struct stat, depending on the __USE_FILE_OFFSET64 macro. The second one was not updated. Change __USE_MISC to __USE_XOPEN2K8 in the __USE_FILE_OFFSET64 version of struct stat for microblaze.
2022-07-25Linux: dirent/tst-readdir64-compat needs to use TEST_COMPAT (bug 27654)Florian Weimer
The hppa port starts libc at GLIBC_2.2, but has earlier symbol versions in other shared objects. This means that the compat symbol for readdir64 is not actually present in libc even though have-GLIBC_2.1.3 is defined as yes at the make level. Fixes commit 15e50e6c966fa0f26612602a95f0129543d9f9d5 ("Linux: dirent/tst-readdir64-compat can be a regular test") by mostly reverting it.