aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
AgeCommit message (Collapse)Author
2022-11-22aarch64: morello: bump min linux version to 5.18.0Szabolcs Nagy
2022-11-17cheri: Fix pselect signal mask argumentSzabolcs Nagy
The signal mask argument is passed as a struct with a pointer and size in the linux syscall abi, but the types used in glibc were wrong for CHERI due to an x32 specific hack.
2022-10-27cheri: Update libc.abilist for getauxptrCarlos Eduardo Seo
Updates libc.abilist files for getauxptr to version 2.37.
2022-10-27cheri: Fix sigevent ABISzabolcs Nagy
Adjust padding to accommodate pointer size and alignment increase.
2022-10-27cheri: fix posix timersSzabolcs Nagy
We need to distinguish timerids that are small integers returned by the kernel and timerids that are pointers to struct timer. The existing pointer tagging does not work for CHERI because of the pointer shift. Simply use the top bit without shift to tag pointers. This still relies on the top byte ignore of aarch64 (the top byte does not affect the capability representation) and that pointers are not tagged for other reasons (like HWASAN). Note: this is morello specific and does not work for generic cheri.
2022-10-27cheri: elf: change l_entry to be elfptr_tSzabolcs Nagy
It is simpler and more consistent to make l_entry a capability throughout instead of leaving it as an address and converting before use: The AT_ENTRY auxv entry is specified to be a capability and a number if internal l_entry usage is simpler if it is elfptr_t. Functions returning a pointer to the user entry are also changed to use elfptr_t.
2022-10-27aarch64: morello: fix ldconfig for purecap abiSzabolcs Nagy
Add purecap ld cache flag. Add the purecap ld.so name to known names. Handle lib64c system library paths. And set the purecap abi flag on cache entries.
2022-10-27aarch64: morello: add purecap ucontext supportCarlos Eduardo Seo
Adjust ucontext layout for purecap ABI and add make/get/set/swapcontext implementations accordingly. Note: mcontext layout follows the linux sigcontext struct, in userspace *context functions rely on the c registers stored in the extension area and ignore the mcontext fields for x registers.
2022-10-27cheri: Fix capability permissions of PROT_NONE maps in test codeSzabolcs Nagy
2022-10-27cheri: Setup RX, RW capabilities for static linkingSzabolcs Nagy
At least tls image access requires RX capability of the main link_map.
2022-10-27cheri: fix static linking early allocationSzabolcs Nagy
Store mmap result to intptr_t instead of long.
2022-10-27cheri: don't use dl_random for pointer manglingSzabolcs Nagy
Pointer mangling cannot be supported on capability architectures. And there is not enough bytes in dl_random for 128 bit pointers. Stack guard is still loaded from dl_random: stack protection is unlikely to be useful on a capability architecture, but it works.
2022-10-27cheri: change __libc_start_main prototypeSzabolcs Nagy
The prototype of __libc_start_main is changed to void __libc_start_main (int main (int, char **, char **, void *), int argc, char **argv, char **envp, void *auxv, void rtld_fini (void), void *sp); so envp is passed down separately and the unused init, fini args are dropped.
2022-10-27cheri: elf: use elfptr_t for auxv parsingSzabolcs Nagy
2022-10-27TODO(uapi): narrow capability in mmap and mremapSzabolcs Nagy
This is a temporary workaround. length is rounded up to pagesize and don't use exact bound (bounds will be larger if exact value is not representable). capability permissions are roughly emulated too. TODO: kernel should do this
2022-10-27TODO(uapi): aarch64: morello: add HWCAP2_MORELLOSzabolcs Nagy
TODO: this is the value in the 5.18 kernel, will change later.
2022-10-27TODO(uapi): aarch64: morello: use non-ifunc gettimeofdaySzabolcs Nagy
TODO: Remove this once morello has vdso gettimeofday.
2022-10-27TODO(uapi): aarch64: morello: make brk always failSzabolcs Nagy
TODO: drop this once linux brk always fails.
2022-10-27TODO(uapi): cheri: fix clone_argsSzabolcs Nagy
Current clone_args does not support 128 bit pointers. TODO: the fix is incomplete (missing clone3 abi checks) and has to be aligned with purecap clone3 struct layout.
2022-10-27aarch64: morello: define PROT_MAXSzabolcs Nagy
Specifies the prot flags a mapping may gain via mprotect or MAP_FIXED. On CHERI targets this is used to get capability with more permissions than the original mmap protection would imply.
2022-10-27aarch64: morello: fix missing variadic argument in fcntlSzabolcs Nagy
In fcntl va_arg is currently used even if the caller did not pass any variadic arguments. This is undefined behaviour and does not work with the Morello purecap ABI, so use a helper macro. When the argument is missing, the result of the helper macro is arbitrary as it will be ignored by the kernel, we just have to ensure it does not cause a runtime crash.
2022-10-27aarch64: morello: add prctl with correct vararg handlingSzabolcs Nagy
prctl is a variadic function and on morello args that were not passed cannot be accessed so the generic code does not work.
2022-10-27aarch64: morello: fix vforkSzabolcs Nagy
No need to set the child stack to sp, 0 means the parent stack is used. This avoids purecap specific ifdefs in vfork.
2022-10-27aarch64: morello: add purecap syscall supportCarlos Eduardo Seo
Support the Morello Linux purecap syscall ABI. The macro definitions are moved to a morello specific sysdep.h to avoid cluttering the aarch64 one.
2022-10-27aarch64: fix VDSO setup to only apply to known ABIsSzabolcs Nagy
New syscall ABI requires different VDSO support code.
2022-10-27TODO(api): cheri: fix syscall return typeSzabolcs Nagy
TODO: this affects API (syscall return type is long) so breaks portability and requires doc updates.
2022-10-27TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guardSzabolcs Nagy
morello purecap gcc in some cases inlines 16byte memcpy as a capability load, which is wrong if the source or dest may be unaligned. stack guard only needs random for the address portion since only that part is compared, so 8 byte is enough with 64 bit addresses, but the current code is only right on little endian systems. TODO: drop when gcc is fixed
2022-10-27cheri: __LP64__ is not defined for purecap ABICarlos Eduardo Seo
There is no ideal ABI macro, so we assume __CHERI_PURE_CAPABILITY__ implies 64 bit long, 64 bit address and 128 bit pointer.
2022-10-27aarch64: morello: use separate c++-types.dataSzabolcs Nagy
The c++ mangling ABI for intptr_t and pthread_t are different on morello.
2022-10-27aarch64: morello: use separate localplt data for morelloSzabolcs Nagy
There is no longer PLT reference to matherr in libm.
2022-10-27aarch64: morello: Add separate lp64 and morello linux abilistsSzabolcs Nagy
The base symbol version is 2.36.
2022-10-27aarch64: morello: Add purecap abi-variants on linuxSzabolcs Nagy
2022-10-27aarch64: Use fewer ifdefs in bits/fcntl.hSzabolcs Nagy
This simplifies adding the Morello purecap abi target.
2022-10-27aarch64: Fix the extension header write in getcontext and swapcontextSzabolcs Nagy
The extension header is two 32bit words and in the last header both should be 0. There is plenty space in the __reserved area, but it's better not to write more than we mean to.
2022-10-25linux: Fix generic struct_stat for 64 bit time (BZ# 29657)Adhemerval Zanella
The generic Linux struct_stat misses the conditionals to use bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for architecture that uses __TIMESIZE == 32 (currently csky and nios2). Since newer ports should not support 32 bit time_t, the generic implementation should be used as default. For arm, hppa, and sh a copy of default struct_stat is added, while for csky and nios a new one based on generic is used, along with conditionals to use bits/struct_stat_time64_helper.h. The default struct_stat is also replaced with the generic one. Checked on aarch64-linux-gnu and arm-linux-gnueabihf. (cherry picked from commit 7a6ca82f8007ddbd43e2b8fce806ba7101ee47f5)
2022-10-01hppa: undef __ASSUME_SET_ROBUST_LISTJohn David Anglin
QEMU does not support support set_robust_list. Thus, we need to enable detection of set_robust_list system call. Signed-off-by: John David Anglin <dave.anglin@bell.net>
2022-09-30stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)Adhemerval Zanella
Using an unsigned type prevents the fallback to be used if kernel does not support getrandom syscall. Checked on x86_64-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com> (cherry picked from commit 13db9ee2cb3b77e25f852be7d6952882e1be6f00)
2022-09-21m68k: Enforce 4-byte alignment on internal locks (BZ #29537)Adhemerval Zanella
A new internal definition, __LIBC_LOCK_ALIGNMENT, is used to force the 4-byte alignment only for m68k, other architecture keep the natural alignment of the type used internally (and hppa does not require 16-byte alignment for kernel-assisted CAS). Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit aeb4d2e9815d459e2640a31f5abb8ef803830107)
2022-08-24Linux: 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"). (cherry picked from commit 2955ef4b7c9b56fcd7abfeddef7ee83c60abff98)
2022-08-24linux: 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> (cherry picked from commit 774058d72942249f71d74e7f2b639f77184160a6)
2022-08-24linux: Use compile_c_snippet to check linux/mount.h availabilityAdhemerval Zanella
Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit e1226cdc6b209539a92d32d5b620ba53fd35abf3)
2022-08-24linux: 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> (cherry picked from commit c68b6044bc7945716431f1adc091b17c39b80a06)
2022-08-24linux: 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> (cherry picked from commit 1542019b69b7ec7b2cd34357af035e406d153631)
2022-08-22socket: 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> (cherry picked from commit 9c443ac4559a47ed99859bd80d14dc4b6dd220a1)
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"). (cherry picked from commit e7ad26ee3cb74e61d0637c888f24dd478d77af58)
2022-08-16Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485)Florian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit f82e05ebb295cadd35f7372f652c72264da810ad)
2022-08-05Update 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. (cherry picked from commit fccadcdf5bed7ee67a6cef4714e0b477d6c8472c)
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