about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* configure: enable riscv32 portStefan O'Rear2024-02-291-1/+2
|
* 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 thread supportStefan O'Rear2024-02-294-0/+76
| | | | Identical to riscv64 except for stack offsets in clone.
* riscv32: add setjmp/longjmp and sigreturnStefan O'Rear2024-02-294-0/+114
| | | | Largely copied from riscv64 but required recalculation of offsets.
* riscv32: add dlsymStefan O'Rear2024-02-291-0/+6
| | | | Identical to riscv64.
* riscv32: add fenv and mathStefan O'Rear2024-02-2914-0/+239
| | | | These are identical to riscv64.
* 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.
* getnameinfo: fix calling __dns_parse with potentially too large rlenAlexey Izbyshev2024-02-291-1/+3
| | | | | | | | | __res_send returns the full answer length even if it didn't fit the buffer, but __dns_parse expects the length of the filled part of the buffer. This is analogous to commit 77327ed064bd57b0e1865cd0e0364057ff4a53b4, which fixed the only other __dns_parse call site.
* posix_spawn: fix child spinning on write to a broken pipeAlexey Izbyshev2024-02-291-1/+6
| | | | | | | | | A child process created by posix_spawn reports errors to its parent via a pipe, retrying infinitely on any write error to prevent falsely reporting success. If the (original) parent dies before write is attempted, there is nobody to report to, but the child will remain stuck in the write loop forever if SIGPIPE is blocked or ignored. Fix this by not retrying write if it fails with EPIPE.
* loongarch64 __clone: align stack pointer mod 16wanghongliang2024-02-261-0/+1
| | | | | According to LoongArch ABI Specs, stack need to be 16 align to improve performance and compiler layout of stack frames.
* 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
|
* switch __STDC_UTF_{16,32}__ macro definitions from #undef to #ifndefRich Felker2024-02-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | originally, compilers did not provide these macros and we had to provide them ourselves. this meant we were redefining them, which was technically invalid unless the token sequence of the original definition matched exactly. the original patch proposed by Jules Maselbas to fix this made the definitions conditional on them not already being defined; however I suggested using #undef to avoid any possibly-wrong definitions already in place and ensure that the definitions are 1. the version adopted as commit 8b7048680731707d135ea231f81eb3eaf52378ee made this change. unfortunately, gcc is loud about not liking #undef of any __STDC_* macro name, and while warnings are suppressed in the system include path, there is apparently no way to suppress this warning if the system include dir has also been provided via -I. while normally we don't go out of our way to satisfy warnings over style in the public headers, in this case, it seems to be a matter of disagreement over contract of which part of "the implementation" is entitled to define or undefine macros belonging to the implementation, and it's quite reasonable to conclude that the compiler may reject attempts to undefine them. this commit reverts to the originally-submitted version of the patch making the definitions conditional.
* riscv: fall back to syscall __riscv_flush_icacheStefan O'Rear2024-02-251-0/+1
| | | | | Matches glibc behavior and fixes a case where we could fall off the function without returning a value.
* sh dlsym: fix passing of return address for RTLD_NEXT useRich Felker2024-02-251-1/+1
| | | | | | | this code dates back to the original commit of the sh port, with no real clue as to how the bug was introduced. it looks like it was written to assume the return address was pushed to the stack like on x86, rather than arriving in the pr special register.
* add statx interface using syscall, fallback to fstatatDuncan Bellamy2024-02-242-0/+97
|
* use new SYS_fchmodat2 syscall to implement fchmodat with flagsGaël PORTAY2024-02-221-1/+4
| | | | | | | | | | | commit 0dc4824479e357a3e23a02d35527e23fca920343 worked around for lack of flags argument in syscall for fchmodat. linux 6.6 introduced a new syscall, SYS_fchmodat2, fixing this deficiency. use it if any flags are passed, and fallback to the old strategy on ENOSYS. continue using the old syscall when there are no flags. this is the exact same strategy used when SYS_faccessat2 was used to implement faccessat with flags.
* 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
* remove flag argument from fchmodat syscallGaël PORTAY2024-02-221-1/+1
| | | | linux's does not have the flag argument for fchmodat syscall.
* 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 framework to support archs without a native wait4 syscallRich Felker2024-02-226-4/+71
| | | | | | | | | | this commit should make no codegen change for existing archs, but is a prerequisite for new archs including riscv32. the wait4 emulation backend provides both cancellable and non-cancellable variants because waitpid is required to be a cancellation point, but all of our other uses are not, and most of them cannot be. based on patch by Stefan O'Rear.
* sh: fix sigsetjmp corrupting call-saved register r8Rich Felker2024-02-171-1/+1
| | | | | due to incorrect base address register when attempting to reload the saved value of r8, the caller's value of r8 was not preserved.
* add loongarch64 portHongliang Wang2024-02-1629-1/+1116
| | | | | | | | | | | | | 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>
* strftime: fix breakage in last change (uninitialized pointer access)Rich Felker2024-02-161-1/+6
| | | | | | | | | | commit f47a5d400b8ffa26cfc5b345dbff52fec94ac7f3 overlooked that strtoul was responsible for setting p to a const-laundered copy of the format string pointer f, even in the case where there was no number to parse. by making the call conditional on isdigit, that copy was lost. the logic here is a mess and should be cleaned up, but for now, this seems to be the least invasive change that undoes the breakage.
* fix erroneous feature test macro check for ppollRich Felker2024-02-081-2/+2
| | | | | | | | | commit f247462b0831cbf163e976ee9a909748c674b88b incorrectly hid ppoll in the presence of _GNU_SOURCE due to an oversight that defining _BSD_SOURCE does not implicitly define _GNU_SOURCE. at present, headers still have to explicitly check for each feature profile level; this may be changed at some point in the future via features.h, but has not been changed yet.
* syslog: use C locale for timestamp generationRich Felker2024-02-071-1/+2
| | | | | | | | | | | | | depending on contents of the LC_TIME locale, log messages could be malformatted (especially if the ABMON strings contain non-alphabetic characters) or the subsequent code could invoke undefined behavior, via passing a timebuf[] with unspecified contents to snprintf, if the translated ABMON string did not fit in the 16-byte timebuf. this does not appear to be a security-relevant bug, as locale loading functionality is intentionally not available to set*id programs -- the MUSL_LOCPATH environment variable is ignored when libc.secure is true, and custom locales are not loadable without it.
* stdc-predef.h: prevent redefining __STDC_UTF_{16,32}__ macrosJules Maselbas2024-02-031-0/+3
| | | | | | | | Undefine any previous __STDC_UTF_{16,32}__ macros before defining them to prenvent any warnings of redefining macros. This happens as a result of some compiler versions defining the macros themselves.
* riscv: add TLSDESC supportRich Felker2024-02-032-0/+33
|
* install.sh: avoid creating symlinks with restricted permissionsTim Cuthbertson2024-02-031-0/+2
| | | | | | | | Linux and most systems do not have symlink permissions, but some systems, including MacOS, do, and creation of the symlink with umask set to 0777 makes the symlink inaccessible on such systems. clear umask when making a symlink so that the behavior is uniform.
* sqrtl: fix invalid use of a non-constant-expression as static initializerRich Felker2024-02-031-2/+2
| | | | | | | | | having these constants be static was unnecessary, so just remove the static. this error should have been caught by compilers, but recent versions of both gcc and clang accept these as "other forms of constant expressions" which the C standard allows.
* riscv: correct symbol version of __vdso_flush_icachegns2024-02-031-1/+1
| | | | | | | | Previously, __riscv_flush_icache would not work correctly as __vdso_flush_icache had a wrong symbol version. Fix this by correcting symbol version. Fixes: 0a48860c27a8 ("add riscv64 architecture support")
* elf.h: add NT_RISCV_CSR and NT_RISCV_VECTOR constantsElliott Hughes2024-02-031-0/+2
| | | | | See Linux commit 9300f00439743c4a34d735e1a27118eb68a1504e ("RISC-V: Add ptrace support for vectors").
* elf.h: update RISC-V relocation typesFangrui Song2024-02-031-6/+10
| | | | | | Note: Some relocation types were only used by binutils and accidentally exposed to previous versions of psABI. One of the values has been reused by GOT32_PCREL.
* add preadv2 and pwritev2 syscall wrappers, flag value macrosRich Felker2024-01-253-0/+41
|
* expose ppoll in default feature profileRich Felker2024-01-212-3/+3
| | | | | | | the ppoll function has been accepted as a future part of the standard as the outcome of Austin Group tracker issue 1263. at some point it should be exposed unconditionally, but for now, expose it in the default feature profile.
* move ppoll from src/linux to src/select reflecting future standardizationRich Felker2024-01-211-0/+0
| | | | | | the ppoll function has been accepted as a future part of the standard as the outcome of Austin Group tracker issue 1263. move the source file to reflect this.
* remove INT_MAX limit on the n argument to snprintf/swprintfRich Felker2024-01-172-8/+0
| | | | | | | | | | | | | | | | this was a POSIX requirement that was always in conflict with ISO C, which specified a well-defined behavior for snprintf and swprintf so long as the actual number of bytes/characters produced did not exceed INT_MAX. I originally raised this conflict for snprintf with the Austin Group as tracker issue 761, which was never resolved. it was later reported again as issue 1219, and as a result the conflicting requirement has been removed. the corresponding issue with swprintf does not seem to have been addressed, but as the same reasoning applies to it, I am removing the limitation on n for swprintf as well.
* strftime: don't attempt to parse field width without seeing a digitRich Felker2023-11-211-1/+2
| | | | | | strtoul will consume leading whitespace or sign characters, which are not valid in this context, thereby accepting invalid field specifiers. so, avoid calling it unless there is a number to parse as the width.
* mntent: fields are delimited only by tabs or spaces, not general whitespaceRich Felker2023-11-161-1/+1
| | | | | | this matters because the kernel-provided mtab only escapes tabs, spaces, newlines, and backslashes. it leaves carriage returns, form feeds, and vertical tabs literal.
* mntent: unescape octal sequencesq662023-11-161-4/+40
| | | | | | As entries in mtab are delimited by spaces, whitespace characters are escaped as octal sequences. When reading them out, we have to unescape these sequences to get the proper string.
* ldso: fix TLSDESC addend processing on archs with backwards descriptorsRich Felker2023-11-061-1/+1
| | | | | | | | | | presently this only affects 32-bit arm. despite correctly reversing the function pointer and argument fields based on the TLSDESC_BACKWARDS macro, we did not read the addend from the swapped-order argument field, so nonzero addends were lost, producing wrong runtime addresses for TLS objects needing an addend. based on report and patch by Rui Ueyama.
* ldso: convert TLSDESC_BACKWARDS from "#ifdef" to "if" logicRich Felker2023-11-063-6/+10
| | | | | this style is preferred because it allows the code to be compile-checked even on archs where it is not used.
* byte-based printf family: emit a nul byte for %lc with argument zeroRich Felker2023-11-061-0/+2
| | | | | | | | this is contrary to the spec as written, which requires %lc to behave as if it were %ls on a 2-wchar_t buffer containing the argument and zero. however, apparently no other implementations conform to the spec as written, and in response to Austin Group issue #1647, WG14 chose to align with existing practice and have %lc produce output for this case.
* remove arbitrary limit from dns result parsingQuentin Rameau2023-11-061-1/+0
| | | | | | | | | | The name resolution would abort when getting more than 63 records per request, due to what seems to be a left-over from the original code. This check was non-breaking but spurious prior to TCP fallback support, since any 512-byte packet with more than 63 records was necessarily malformed. But now, it wrongly rejects valid results. Reported by Daniel Stefanik in Alpine Linux aports issue 15320.