about summary refs log tree commit diff
path: root/arch
Commit message (Collapse)AuthorAgeFilesLines
* loongarch64: add new syscall numberswanghongliang2024-02-291-0/+15
|
* loongarch64: remove getrlimit/setrlimit syscall numbersRich Felker2024-02-291-2/+0
| | | | | these are not supported by the kernel for new archs; prlimit64 replaces them.
* loongarch64: remove ptrace.h macroswanghongliang2024-02-291-4/+0
|
* riscv: define REG_S1 and REG_S2Khem Raj2024-02-292-0/+4
| | | | | These are used by applications to access members of mcontext, and are also defined by other libcs on linux.
* riscv32: add new syscall numbersKhem Raj2024-02-291-1/+15
| | | | | | | | | | | | | | - add mount_setattr from linux v5.12 - add epoll_pwait2 from linux v5.11 - add process_madvise from linux v5.10 - add __NR_faccessat2 from linux v5.8 - add pidfd_getfd and openat2 syscall numbers from linux v5.6 - add clone3 syscall number from linux v5.3 - add process_mrelease from linux v5.15 - add futex_waitv from linux v5.16 - add set_mempolicy_home_node from linux v5.17 - add cachestat from linux v6.4 - add __NR_fchmodat2 from linux v6.6
* riscv32: add sysvipc msg/sem/shm bitsRich Felker2024-02-294-0/+68
| | | | | | | | | | despite riscv32 being natively time64, the IPC_TIME64 bit (0x100) is set in IPC_STAT and derived command macros, differentiating their values from the raw command values used to interface with the kernel. this reflects that the kernel ipc structure types are not natively time64, but have broken-down hi/lo fields that cannot be used in-place and require translation, and that the userspace struct types differ from the kernel types (relevant to things like strace).
* riscv32: add arch headersStefan O'Rear2024-02-2917-0/+659
| | | | | | | | | | | | | | | | | These are mostly copied from riscv64. _Addr and _Reg had to become int to match compiler-controlled parts of the ABI (result type of sizeof, etc.). There is no kernel stat struct; the userspace stat matches glibc in the sizes and offsets of all fields (including glibc's __dev_t __pad1). The jump buffer is 12 words larger to account for 12 saved double-precision floats; additionally it should be 64-bit aligned to save doubles. The syscall list was significantly revised by deleting all time32 and pre-statx syscalls, and renaming several syscalls that have different names depending on __BITS_PER_LONG, notably mmap2 and _llseek. futex was added as an alias to futex_time64 since it is widely used by software which does not pass time arguments.
* add loongarch64 user.h structs; adjust elf_fpreg_t and ELF_NFPREGHongliang Wang2024-02-261-2/+21
| | | | | | | | user_regs_struct and user_fp_struct were missing from the initial commit of the port. the union type for elf_fpreg_t and the new value of ELF_NFPREG are made consistent with glibc.
* add loongarch64 signal.h register index macroswanghongliang2024-02-261-0/+11
|
* bits/syscall.h: add __NR_fchmodat2 from linux v6.6Gaël PORTAY2024-02-2216-0/+16
| | | | | | | | | | | the linux fchmodat syscall lacks a flag argument that is necessary to implement the posix api, see linux commit 09da082b07bbae1c11d9560c8502800039aebcea fs: Add fchmodat2() linux commit 78252deb023cf0879256fcfbafe37022c390762b arch: Register fchmodat2, usually as syscall 452
* bits/syscall.h: add cachestat from linux v6.4Gaël PORTAY2024-02-2216-0/+16
| | | | | | | | | | see linux commit cf264e1329fb0307e044f7675849f9f38b44c11a cachestat: implement cachestat syscall linux commit 946e697c69ffeeefdd84dad90eac307284df46be cachestat: wire up cachestat for other architectures
* bits/syscall.h: add set_mempolicy_home_node from linux v5.17Gaël PORTAY2024-02-2216-0/+16
| | | | | | | | | | see linux commit c6018b4b254971863bd0ad36bb5e7d0fa0f0ddb0 mm/mempolicy: add set_mempolicy_home_node syscall linux commit 21b084fdf2a49ca1634e8e360e9ab6f9ff0dee11 mm/mempolicy: wire up syscall set_mempolicy_home_node
* bits/syscall.h: add futex_waitv from linux v5.16Gaël PORTAY2024-02-2216-0/+16
| | | | | | | | | | | | | | | | | | | see linux commit 039c0ec9bb77446d7ada7f55f90af9299b28ca49 futex,x86: Wire up sys_futex_waitv() linux commit ea7c45fde5aa3e761aaddb7902a31a95cb120e7b futex,arm: Wire up sys_futex_waitv() linux commit b3ff2881ba18b852f79f5476d7631940071f1adb MIPS: syscalls: Wire up futex_waitv syscall linux commit 6c122360cf2f4c5a856fcbd79b4485b7baec942a s390: wire up sys_futex_waitv system call linux commit a0eb2da92b715d0c97b96b09979689ea09faefe6 futex: Wireup futex_waitv syscall
* bits/syscall.h: add process_mrelease from linux v5.15Rich Felker2024-02-2216-0/+16
| | | | | | | | | | see linux commit 884a7e5964e06ed93c7771c0d7cf19c09a8946f1 mm: introduce process_mrelease system call linux commit dce49103962840dd61423d7627748d6c558d58c5 mm: wire up syscall process_mrelease
* bits/syscall.h: add memfd_secret from linux v5.14Gaël PORTAY2024-02-224-0/+4
| | | | | | | | | | | | | | see linux commit 7bb7f2ac24a028b20fca466b9633847b289b156a arch, mm: wire up memfd_secret system call where relevant linux commit 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49 mm: introduce memfd_secret system call to create "secret" memory areas linux commit b633896314c0f78f2b4eb7b19a530d68f2a35445 tools headers UAPI: Sync s390 syscall table file that wires up the memfd_secret syscall
* add loongarch64 portHongliang Wang2024-02-1617-0/+742
| | | | | | | | | | | | | Author: Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Author: Meidan Li <limeidan@loongson.cn> Author: Guoqi Chen <chenguoqi@loongson.cn> Author: Xiaolin Zhao <zhaoxiaolin@loongson.cn> Author: Fan peng <fanpeng@loongson.cn> Author: Jiantao Shan <shanjiantao@loongson.cn> Author: Xuhui Qiang <qiangxuhui@loongson.cn> Author: Jingyun Hua <huajingyun@loongson.cn> Author: Liu xue <liuxue@loongson.cn> Author: Hongliang Wang <wanghongliang@loongson.cn>
* riscv: add TLSDESC supportRich Felker2024-02-031-0/+1
|
* ldso: convert TLSDESC_BACKWARDS from "#ifdef" to "if" logicRich Felker2023-11-061-1/+1
| | | | | this style is preferred because it allows the code to be compile-checked even on archs where it is not used.
* fix wrong sigaction syscall ABI on mips*, or1k, microblaze, riscv64Rich Felker2023-02-099-12/+3
| | | | | | | | | | | | | | | | | | | | | we wrongly defined a dummy SA_RESTORER flag on these archs, despite the kernel interface not actually having such a feature. on archs which lack SA_RESTORER, the kernel sigaction structure also lacks the restorer function pointer member, which means the signal mask appears at a different offset. the kernel was thereby interpreting the bits of the code address as part of the signal set to be masked while handling the signal. this patch removes the erroneous SA_RESTORER definitions from archs which do not have it, makes access to the member conditional on whether SA_RESTORER is defined for the arch, and removes the now-unused asm for the affected archs. because there are reportedly versions of qemu-user which also use the wrong ABI here, the old ksigaction struct size is preserved with an unused member at the end. this is harmless and mitigates the risk of such a bug turning into a buffer overflow onto the sigaction function's stack.
* fix debugger tracking of shared libraries on mips with PIE main programRich Felker2023-01-183-0/+3
| | | | | | | | mips has its own mechanisms for DT_DEBUG because it makes _DYNAMIC read-only, and the original mechanism, DT_MIPS_RLD_MAP, was PIE-incompatible. DT_MIPS_RLD_MAP_REL was added to remedy this, but we never implemented support for it. add it now using the same idioms for mips-specific ldso logic.
* re-enable vdso clock_gettime on arm (32-bit) with workaroundRich Felker2022-09-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 4486c579cbf0d989080705f515d08cb48636ba88 disabled vdso clock_gettime on arm due to a Linux kernel bug that was not understood at the time, whereby the vdso function silently produced catastrophically wrong results on some systems. since then, the bug was tracked down to the way the arm kernel disabled use of vdso clock_gettime on kernels where the necessary timer was not available or was disabled. it simply patched out the symbols, but it only did this for the legacy time32 functions, and left the time64 function in place but non-operational. kernel commit 4405bdf3c57ec28d606bdf5325f1167505bfdcd4 (first present in 5.8) provided the fix. if this were a bug that impacted all users of the broken kernel versions, we could probably ignore it and assume it had been patched or replaced. however, it's very possible that these kernels appear in the wild in devices running time32 userspace (glibc, musl 1.1.x, or some other environment) where they appear to work fine, but where our new binaries would fail catastrophically if we used the time64 vdso function. since the kernel has not (yet?) given us a way to probe for the working time64 vdso function semantically, we work around the problem by refusing to use the time64 one unless the time32 one is also present. this will revert to not using vdso at all if the time32 one is ever removed, but at least that's safe against wrong results and is just a missed optimization.
* fix __WORDSIZE on x32 sys/user.hRich Felker2022-03-081-1/+1
| | | | | | sys/reg.h already had it right as 32, to which it was explicitly changed when commit 664cd341921007cea52c8891f27ce35927dca378 derived x32 from x86_64. but the copy exposed in sys/user.h was missed.
* bits/syscall.h: add landlock syscalls from linux v5.13Szabolcs Nagy2022-03-0816-0/+48
| | | | | | | | | | | | | | | | | see linux commit a49f4f81cb48925e8d7cbd9e59068f516e984144 arch: Wire up Landlock syscalls linuxcommit 17ae69aba89dbfa2139b7f8024b757ab3cc42f59 Merge tag 'landlock_v34' of ... jmorris/linux-security Landlock provides for unprivileged application sandboxing. The goal of Landlock is to enable to restrict ambient rights (e.g. global filesystem access) for a set of processes. Landlock is inspired by seccomp-bpf but instead of filtering syscalls and their raw arguments, a Landlock rule can restrict the use of kernel objects like file hierarchies, according to the kernel semantic.
* s390x: add ptrace requests from linux v5.12Szabolcs Nagy2022-03-081-0/+3
| | | | | | | | PTRACE_OLDSETOPTIONS is old, but it was missing, PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP are new, see linux commit 56e62a73702836017564eaacd5212e4d0fa1c01d s390: convert to generic entry
* bits/syscall.h: add mount_setattr from linux v5.12Szabolcs Nagy2022-03-0816-0/+16
| | | | | | | | new syscall to change the properties of a mount or a mount tree using file descriptors which the new mount api is based on, see linux commit 2a1867219c7b27f928e2545782b86daaf9ad50bd fs: add mount_setattr()
* bits/syscall.h: add epoll_pwait2 from linux v5.11Szabolcs Nagy2022-03-0816-0/+16
| | | | | | | | | | | | see linux commit b0a0c2615f6f199a656ed8549d7dce625d77aa77 epoll: wire up syscall epoll_pwait2 linux commit 58169a52ebc9a733aeb5bea857bc5daa71a301bb epoll: add syscall epoll_pwait2 epoll_wait with struct timespec timeout instead of int. no time32 variant.
* add SPE FPU support to powerpc-sfRich Felker2021-09-232-2/+2
| | | | | | | | | | | | | | | | | | | When the soft-float ABI for PowerPC was added in commit 5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb, with Freescale cpus using the alternative SPE FPU as the main use case, it was noted that we could probably support hard float on them, but that it would involve determining some difficult ABI constraints. This commit is the completion of that work. The Power-Arch-32 ABI supplement defines the ABI profiles, and indeed ATR-SPE is built on ATR-SOFT-FLOAT. But setjmp/longjmp compatibility are problematic for the same reason they're problematic on ARM, where optional float-related parts of the register file are "call-saved if present". This requires testing __hwcap, which is now done. In keeping with the existing powerpc-sf subarch definition, which did not have fenv, the fenv macros are not defined for SPE and the SPEFSCR control register is left (and assumed to start in) the default mode.
* fix excessively slow TLS performance on some mips modelsRich Felker2021-08-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | commit 6d99ad91e869aab35a4d76d34c3c9eaf29482bad introduced this regression as part of a larger change, based on an incorrect assumption that rdhwr being part of the mips r2 ISA level meant that the TLS register, known in the mips documentation as UserLocal, was unconditionally present on chips providing this ISA level and would not need trap-and-emulate. this turns out to be false. based on research by Stanislav Kljuhhin and Abilio Marques, who reported the problem as a performance regression on certain routers using OpenWRT vs older uclibc-based versions, it turns out the mips manuals document the UserLocal register as a feature that might or might not be implemented or enabled, reflected by a cpu capability bit in the CONFIG3 register, and that Linux checks for this and has to explicitly enable it on models that have it. thus, it's indeed possible that r2+ chips can lack the feature, bringing us back to the situation where Linux only has a fast trap-and-emulate path for the case where the destination register is $3. so, always read the thread pointer through $3. this may incur a gratuitous move to the desired final register on chips where it's not needed, but it really doesn't matter.
* fix broken struct shmid_ds on powerpc (32-bit)Rich Felker2021-07-061-1/+1
| | | | | | | | | | | | | | | | | the kernel structure has padding of the shm_segsz member up to 64 bits, as well as 2 unused longs at the end. somehow that was overlooked when the powerpc port was added, and it has been broken ever since; applications compiled with the wrong definition do not correctly see the shm_segsz, shm_cpid, and shm_lpid members. fixing the definition just by adding the missing padding would break the ABI size of the structure as well as the position of the time64 shm_atime and shm_dtime members we added at the end. instead, just move one of the unused padding members from the original end (before time64) of the structure to the position of the missing padding. this preserves size and preserves correct behavior of any compiled code that was already working. programs affected by the wrong definition need to be recompiled with the correct one.
* riscv: rename __NR_fstatat __NR_newfstatatKhem Raj2021-06-051-1/+1
| | | | | | on riscv64 this syscall is called __NR_newfstatat this helps the name match kernel UAPI for external programs
* aarch64/bits/mman.h: add PROT_MTE from linux v5.10Szabolcs Nagy2021-02-151-0/+1
| | | | | | | see linux commit 9f3419315f3cdc41a7318e4d50ba18a592b30c8c arm64: mte: Add PROT_MTE support to mmap() and mprotect()
* aarch64/bits/hwcap.h: add HWCAP2_MTE from linux v5.10Szabolcs Nagy2021-02-151-0/+1
| | | | | | | see linux commit 3b714d24ef173f81c78af16f73dcc9b40428c803 arm64: mte: CPU feature detection and initial sysreg configuration
* add aarch64/bits/mman.h with PROT_BTI from linux v5.8Szabolcs Nagy2021-02-151-0/+1
| | | | | | | this was missing, see linux commit 8ef8f360cf30be12382f89ff48a57fbbd9b31c14 arm64: Basic Branch Target Identification support
* aarch64/bits/hwcap.h: add HWCAP2_BTI from linux v5.8Szabolcs Nagy2021-02-151-0/+1
| | | | | | | hwcap for BTI was missing, see linux commit 8ef8f360cf30be12382f89ff48a57fbbd9b31c14 arm64: Basic Branch Target Identification support
* bits/syscall.h: add process_madvise from linux v5.10Szabolcs Nagy2021-02-1516-0/+16
| | | | | | | | | mainly added to linux to allow a central process management service in android to give MADV_COLD|PAGEOUT hints for other processes, see linux commit ecb8ac8b1f146915aa6b96449b66dd48984caacc mm/madvise: introduce process_madvise() syscall: an external memory hinting API
* riscv64: define ELF_NFPREGKhem Raj2021-02-121-0/+1
| | | | ELF_NFPREG is used by some userspace applications like gdb
* sh: fix incorrect mcontext_t member namingAriadne Conill2020-12-122-4/+13
| | | | | while the layouts match, the member member naming expected by software using mcontext_t omits the sc_ prefix.
* riscv64: fix inconsistent ucontext_t struct tagDrew DeVault2020-12-061-2/+2
| | | | | | ucontext.h depends on the internal struct tag name for namespacing reasons, and the intent was always for it to be consistent across archs anyway.
* s390x: derive float_t from compiler or default to floatMarius Hillenbrand2020-12-032-1/+9
| | | | | | | | | | | | | | | | | | | float_t should represent the type that is used to evaluate float expressions internally. On s390x, float_t is currently set to double. In contrast, the isa supports single-precision float operations and compilers by default evaluate float in single precision, which violates the C standard (sections 5.2.4.2.2 and 7.12 in C11/C17, to be precise). With -fexcess-precision=standard, gcc evaluates float in double precision, which aligns with the standard yet at the cost of added conversion instructions. gcc-11 will drop the special case to retrofit double precision behavior for -fexcess-precision=standard so that __FLT_EVAL_METHOD__ will be 0 on s390x in any scenario. To improve standards compliance and compatibility with future compiler direction, this patch changes the definition of float_t to be derived from the compiler's __FLT_EVAL_METHOD__.
* bits/syscall.h: add __NR_close_range from linux v5.9Szabolcs Nagy2020-11-2916-0/+16
| | | | | | | | | | see linux commit 9b4feb630e8e9801603f3cab3a36369e3c1cf88d arch: wire-up close_range() linux commit 278a5fbaed89dacd04e9d052f4594ffd0e0585de open: add close_range()
* fix vector types in aarch64 register file structuresRich Felker2020-11-112-3/+3
| | | | | | | | | | the ABI type for the vector registers in fpregset_t, struct fpsimd_context, and struct user_fpsimd_struct is __uint128_t, which was presumably originally not used because it's a nonstandard type, but its existence is mandated by the aarch64 psABI. use of the wrong type here broke software using these structures, and encouraged incorrect fixes with casts rather than reinterpretation of representation.
* bits/syscall.h: add __NR_faccessat2 from linux v5.8Szabolcs Nagy2020-09-0916-0/+16
| | | | | | | | the linux faccessat syscall lacks a flag argument that is necessary to implement the posix api, see linux commit c8ffd8bcdd28296a198f237cc595148a8d4adfbe vfs: add faccessat2 syscall
* aarch64: add new HWCAP2_ macros from linux v5.6Szabolcs Nagy2020-09-091-0/+8
| | | | | | | | | | added in linux commit 1a50ec0b3b2e9a83f1b1245ea37a853aac2f741c arm64: Implement archrandom.h for ARMv8.5-RNG linux commit d4209d8b717311d114b5d47ba7f8249fd44e97c2 arm64: cpufeature: Export matrix and other features to userspace
* aarch64: add HWCAP2_ macros from linux v5.3Szabolcs Nagy2020-09-091-0/+2
| | | | | | | | | | these were missed before, added in linux commit 1201937491822b61641c1878ebcd16a93aed4540 arm64: Expose ARMv8.5 CondM capability to userspace linux commit ca9503fc9e9812aa6258e55d44edb03eb30fc46f arm64: Expose FRINT capabilities to userspace
* add pidfd_getfd and openat2 syscall numbers from linux v5.6Szabolcs Nagy2020-09-0916-0/+34
| | | | | | | | | | | | | | | | | | | also added clone3 on sh and m68k, on sh it's still missing (not yet wired up), but reserved so safe to add. see linux commit fddb5d430ad9fa91b49b1d34d0202ffe2fa0e179 open: introduce openat2(2) syscall linux commit 9a2cef09c801de54feecd912303ace5c27237f12 arch: wire up pidfd_getfd syscall linux commit 8649c322f75c96e7ced2fec201e123b2b073bf09 pid: Implement pidfd_getfd syscall linux commit e8bb2a2a1d51511e6b3f7e08125d52ec73c11139 m68k: Wire up clone3() syscall
* use generic bits/fcntl.h for x86_64 and riscv64Rich Felker2020-09-032-78/+0
| | | | | these were only using a custom version because they needed the "non-64" variants of the file locking command macros.
* make generic bits/fcntl.h shareable with 64-bit archsRich Felker2020-09-031-0/+6
| | | | | | | | | | | the fcntl file locking command macro values in the existing generic bits/fcntl.h were the "64" variants, requiring 64-bit archs that use the "plain" variants to have their own bits/fcntl.h, even if they otherwise use the common definitions for everything. since commit 7cc79d10afd43811a486fd5e9fcdf8e45ac599e0 exposed __LONG_MAX to all bits headers, we can now make the generic one common between 32- and 64-bit archs.
* fix missing O_LARGEFILE values on x86_64, x32, and mips64Rich Felker2020-09-033-3/+3
| | | | | | | | | | | | | | | | | prior to commit 685e40bb09f5f24a2af54ea09c97328808f76990, x86_64 was correctly passing O_LARGEFILE to SYS_open; it was removed (defined to 0 in the public header, and changed to use the public definition) as part of that change, probably out of a mistaken belief that it's not needed. however, on a mixed system with 32-bit and 64-bit binaries, it's important that all files be opened with O_LARGEFILE, even if the opening process is 64-bit, in case a descriptor is passed to a 32-bit process. otherwise, attempts to access past 2GB in the 32-bit process could produce EOVERFLOW. most 64-bit archs added later got this right alread, except for mips64. x32 was also affected. there are now fixed.
* remove redundant pthread struct members repeated for layout purposesRich Felker2020-08-273-5/+1
| | | | | | | dtv_copy, canary2, and canary_at_end existed solely to match multiple ABI and asm-accessed layouts simultaneously. now that pthread_arch.h can be included before struct __pthread is defined, the struct layout can depend on macros defined by pthread_arch.h.
* deduplicate __pthread_self thread pointer adjustment out of each archRich Felker2020-08-2716-65/+63
| | | | | | | | | | | | | | | | the adjustment made is entirely a function of TLS_ABOVE_TP and TP_OFFSET. aside from avoiding repetition of the TP_OFFSET value and arithmetic, this change makes pthread_arch.h independent of the definition of struct __pthread from pthread_impl.h. this in turn will allow inclusion of pthread_arch.h to be moved to the top of pthread_impl.h so that it can influence the definition of the structure. previously, arch files were very inconsistent about the type used for the thread pointer. this change unifies the new __get_tp interface to always use uintptr_t, which is the most correct when performing arithmetic that may involve addresses outside the actual pointed-to object (due to TP_OFFSET).