about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* ensure distinct query id for parallel A and AAAA queries in resolverRich Felker2022-06-031-0/+3
| | | | | | | | | | | | | | assuming a reasonable realtime clock, res_mkquery is highly unlikely to generate the same query id twice in a row, but it's possible with a very low-resolution system clock or under extreme delay of forward progress. when it happens, res_msend fails to wait for both answers, and instead stops listening after getting two answers to the same query (A or AAAA). to avoid this, increment one byte of the second query's id if it matches the first query's. don't bother checking if the second byte is also equal, since it doesn't matter; we just need to ensure that at least one byte is distinct.
* mntent: fix potential mishandling of extremely long linesRich Felker2022-05-151-0/+2
| | | | | | | | | | | commit 05973dc3bbc1aca9b3c8347de6879ed72147ab3b made it so that lines longer than INT_MAX can in theory be read, but did not use a suitable type for the positions determined by sscanf. we could change to using size_t, but since the signature for getmntent_r does not admit lines longer than INT_MAX, it does not make sense to support them in the legacy thread-unsafe form either -- the principle here is that there should not be an incentive to use the unsafe function to get added functionality.
* mntent: fix parsing lines with optional fieldsAlyssa Ross2022-05-151-3/+7
| | | | | | | | | | | | | | According to fstab(5), the last two fields are optional, but this wasn't accepted. After this change, only the first field is required, which matches glibc's behaviour. Using sscanf as before, it would have been impossible to differentiate between 0 fields and 4 fields, because sscanf would have returned 0 in both cases due to the use of assignment suppression and %n for the string fields (which is important to avoid copying any strings). So instead, before calling sscanf, initialize every string to the empty string, and then we can check which strings are empty afterwards to know how many fields were matched.
* fix constraint violation in qsort wrapper around qsort_rRich Felker2022-05-061-1/+1
| | | | | function pointer types do not implicitly convert to void *. a cast is required here.
* use __fstat instead of __fstatat with AT_EMPTY_PATH in __map_fileRich Felker2022-05-041-2/+1
| | | | | this isolates knowledge of the nonstandard AT_EMPTY_PATH extension to one place and returns __map_file to its prior simplicity.
* provide an internal namespace-safe __fstatRich Felker2022-05-042-2/+5
| | | | | | this avoids the need for implementation-internal callers to depend on the nonstandard AT_EMPTY_PATH extension to use __fstatat and isolates knowledge of that extension to the implementation of __fstat.
* only use fstatat and others legacy stat syscalls if they existRich Felker2022-05-011-1/+9
| | | | riscv32 and future architectures only provide statx.
* drop direct use of stat syscalls in internal __map_fileRich Felker2022-05-011-3/+3
| | | | | | this function is used to implement some baseline ISO C interfaces, so it cannot call any of the stat functions by their public names. use the namespace-safe __fstatat instead.
* provide an internal namespace-safe __fstatatRich Felker2022-05-012-1/+11
| | | | | this makes it so we can drop direct stat syscall use in interfaces that can't use the POSIX namespace.
* drop direct use of stat syscalls in fchmodatRich Felker2022-05-011-8/+7
| | | | | | | | | | | | | | | | instead, use the fstatat/stat functions, so that the logic for which syscalls are present and usable is all in fstatat. this results in a slight increase in cost for old kernels on 32-bit archs: now statx will be attempted first rather than just using the legacy time32 syscalls, despite us not caring about timestamps. however, it's not even clear that the legacy syscalls *should* succeed if the timestamps are out of range; arguably they should fail with EOVERFLOW. as such, paying a small cost here on old kernels seems well-motivated. with this change, fchmodat itself is no longer blocking ports to new archs that lack the legacy syscalls.
* drop use of stat operation in temporary file name generationRich Felker2022-05-012-10/+6
| | | | | | | | | | | | | | | | | this change serves two purposes: 1. it eliminates one of the few remaining uses of the kernel stat structure which will not be present in future archs, avoiding the need for growing ifdef logic here. 2. it potentially makes the operations less expensive when the candidate exists as a non-symlink by avoiding the need to read the inode (assuming the directory tables suffice to distinguish symlinks). this uses the idiom I discovered while rewriting realpath for commit 29ff7599a448232f2527841c2362643d246cee36 of being able to use the readlink operation as an inexpensive probe for file existence that doesn't following symlinks.
* only fallback to gettimeofday/settimeofday syscalls if they existStefan O'Rear2022-05-011-0/+4
| | | | riscv32 and future architectures only provide the clock_ functions.
* only use getrlimit/setrlimit syscalls if they existStefan O'Rear2022-05-012-1/+11
| | | | riscv32 and future architectures only provide prlimit64.
* don't remap internal-use syscall macros to nonexistent time32 syscallsStefan O'Rear2022-04-271-10/+10
| | | | | | riscv32 and future architectures lack the _time32 variants entirely, so don't try to use their numbers. instead, reflect that they're not present.
* remove ARMSUBARCH relic from configureStefan O'Rear2022-04-271-5/+0
| | | | commit 0f814a4e57e80d2512934820b878211e9d71c93e removed its use.
* add missing POSIX confstr keys for pthread CFLAGS/LDFLAGSRich Felker2022-04-202-1/+3
| | | | | | | | | | _CS_POSIX_V7_THREADS_CFLAGS and _CS_POSIX_V7_THREADS_LDFLAGS have been missing for a long time, which is a conformance defect. we were waiting on glibc to add them or at least agree on the numeric values they will have so as to keep the numbering aligned. it looks like they will be added to glibc with these numbers, and in any case, this list does not have any significant churn that would result in the numbers getting taken.
* fix incorrect parameter name in internal netlink.h RTA_OK macroOndrej Jirman2022-04-101-1/+1
| | | | the wrong name works only by accident.
* release 1.2.3 v1.2.3Rich Felker2022-04-072-1/+41
|
* accept null pointer as message argument to gettext functionspsykose2022-03-271-0/+3
| | | | | | | | | | the change to support passing null was rejected in the past on the grounds that GNU gettext documented it as undefined, on an assumption that only glibc accepted it and that the standalone GNU gettext did not. but it turned out that both explicitly accept it. in light of this, since some software assumes null can be passed safely, allow it.
* fix invalid free of duplocale object when malloc has been replacedIsaiah Poston2022-03-161-0/+5
| | | | | | | | | | | | newlocale and freelocale use __libc_malloc and __libc_free, but duplocale used malloc. If malloc was replaced, this resulted in invalid free using the wrong allocator when passing the result of duplocale to freelocale. Instead, use libc-internal malloc for duplocale. This bug was introduced by commit 1e4204d522670a1d8b8ab85f1cfefa960547e8af.
* 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.
* sys/ptrace.h: add PTRACE_GET_RSEQ_CONFIGURATION from linux v5.13Szabolcs Nagy2022-03-081-0/+9
| | | | | | | | | see linux commit 90f093fa8ea48e5d991332cee160b761423d55c1 rseq, ptrace: Add PTRACE_GET_RSEQ_CONFIGURATION request the struct type got __ prefix to follow existing practice.
* sys/prctl.h: add PR_PAC_{SET,GET}_ENABLED_KEYS from linux v5.13Szabolcs Nagy2022-03-081-0/+3
| | | | | | | see linux commit 201698626fbca1cf1a3b686ba14cf2a056500716 arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)
* elf.h: add NT_ARM_PAC_ENABLED_KEYS from linux v5.13Szabolcs Nagy2022-03-081-0/+1
| | | | | | | see linux commit 201698626fbca1cf1a3b686ba14cf2a056500716 arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)
* netinet/in.h: add INADDR_DUMMY from linux v5.13Szabolcs Nagy2022-03-081-0/+1
| | | | | | | | | | | | see linux commit 321827477360934dc040e9d3c626bf1de6c3ab3c icmp: don't send out ICMP messages with a source address of 0.0.0.0 "RFC7600 reserves a dummy address to be used as a source for ICMP messages (192.0.0.8/32), so let's teach the kernel to substitute that address as a last resort if the regular source address selection procedure fails."
* 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.
* netinet/tcp.h: add tcp_zerocopy_receive fields from linux v5.12Szabolcs Nagy2022-03-081-0/+4
| | | | | | | | | | see linux commit 7eeba1706eba6def15f6cb2fc7b3c3b9a2651edc tcp: Add receive timestamp support for receive zerocopy. linux commit 3c5a2fd042d0bfac71a2dfb99515723d318df47b tcp: Sanitize CMSG flags and reserved args in tcp_zerocopy_receive.
* netinet/tcp.h: add TCP_NLA_* values up to linux v5.12Szabolcs Nagy2022-03-081-0/+2
| | | | | | | | | | | | TCP_NLA_EDT was new in v5.9, see linux commit 48040793fa6003d211f021c6ad273477bcd90d91 tcp: add earliest departure time to SCM_TIMESTAMPING_OPT_STATS TCP_NLA_TTL is new in v5.12, see linux commit e7ed11ee945438b737e2ae2370e35591e16ec371 tcp: add TTL to SCM_TIMESTAMPING_OPT_STATS
* 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()
* signal.h: add new sa_flags from linux v5.11Szabolcs Nagy2022-03-081-0/+3
| | | | | | | | | | | | | see linux commit a54f0dfda754c5cecc89a14dab68a3edc1e497b5 signal: define the SA_UNSUPPORTED bit in sa_flags linux commit 6ac05e832a9e96f9b1c42a8917cdd317d7b6c8fa signal: define the SA_EXPOSE_TAGBITS bit in sa_flags Note: SA_ is in the posix reserved namespace so these linux specific flags can be exposed when compiling for posix.
* signal.h: add SYS_USER_DISPATCH si_code value from linux v5.11Szabolcs Nagy2022-03-081-0/+1
| | | | | | | see linux commit 1d7637d89cfce54a4f4a41c2325288c2f47470e8 signal: Expose SYS_USER_DISPATCH si_code type
* signal.h: add si_code values for SIGSYSSzabolcs Nagy2022-03-081-0/+2
| | | | | | unlike other si_code defines, SYS_ is not in the posix reserved namespace which is likely the reason why SYS_SECCOMP was previously missing (was new in linux v3.5).
* netinet/tcp.h: add tcp zerocopy related changes from linux v5.11Szabolcs Nagy2022-03-081-0/+5
| | | | | | | | | | see linux commit 18fb76ed53865c1b5d5f0157b1b825704590beb5 net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy. linux commit 94ab9eb9b234ddf23af04a4bc7e8db68e67b8778 net-zerocopy: Defer vm zap unless actually needed.
* netinet/if_ether.h: add ETH_P_CFM from linux v5.11Szabolcs Nagy2022-03-081-0/+1
| | | | | | | see linux commit fbaedb4129838252570410c65abb2036b5505cbd bridge: uapi: cfm: Added EtherType used by the CFM protocol.
* sys/socket.h: add new SO_ socket options from linux v5.11Szabolcs Nagy2022-03-081-0/+2
| | | | | | | | | | see linux commit 7fd3253a7de6a317a0683f83739479fb880bffc8 net: Introduce preferred busy-polling linux commit 7c951cafc0cb2e575f1d58677b95ac387ac0a5bd net: Add SO_BUSY_POLL_BUDGET socket option
* sys/prctl.h: add PR_SET_SYSCALL_USER_DISPATCH from linux v5.11Szabolcs Nagy2022-03-081-0/+6
| | | | | | | | | | | | | | see linux commit 1446e1df9eb183fdf81c3f0715402f1d7595d4cb kernel: Implement selective syscall userspace redirection linux commit 36a6c843fd0d8e02506681577e96dabd203dd8e8 entry: Use different define for selector variable in SUD redirect syscalls to a userspace handler via SIGSYS, except for a specific range of code. can be toggled via a memory write to a selector variable. mainly for wine.
* 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.
* nice: return EPERM instead of EACCESAlexey Kodanev2022-03-081-1/+8
| | | | | To comply with POSIX, change errno from EACCES to EPERM when the caller did not have the required privilege.
* protect stack canary from leak via read-as-string by zeroing second bytejvoisin2022-03-081-0/+9
| | | | | | | | | This reduces entropy of the canary from 64-bit to 56-bit in exchange for mitigating non-terminated C string overflows by setting the second byte of the canary to nul, so that off-by-one write overflow with a nul byte can still be detected. Idea from GrapheneOS bionic commit 7024d880b51f03a796ff8832f1298f2f1531fd7b
* math: avoid runtime conversions of floating-point constantsSzabolcs Nagy2022-03-082-2/+6
| | | | | | | | | | | | | | | gcc-12 with -frounding-mode will do inexact constant conversions at runtime according to the runtime rounding mode. in the math library we want constants to be rounding mode independent so this patch fixes cases where new runtime conversions happen with gcc-12. fortunately this only affects two minor cases, the fix uses global initializers where rounding mode does not apply. after the patch the same amount of conversions happen with gcc-12 as with gcc-11.
* fix spurious failures by fgetws when buffer ends with partial characterRich Felker2022-02-201-6/+1
| | | | | | | | | | | | | | | | | | | | commit a90d9da1d1b14d81c4f93e1a6d1a686c3312e4ba made fgetws look for changes to errno by fgetwc to detect encoding errors, since ISO C did not allow the implementation to set the stream's error flag in this case, and the fgetwc interface did not admit any other way to detect the error. however, the possibility of fgetwc setting errno to EILSEQ in the success path was overlooked, and in fact this can happen if the buffer ends with a partial character, causing mbtowc to be called with only part of the character available. since that change was made, the C standard was amended to specify that fgetwc set the stream error flag on encoding errors, and commit 511d70738bce11a67219d0132ce725c323d00e4e made it do so. thus, there is no longer any need for fgetws to poke at errno to handle encoding errors. this commit reverts commit a90d9da1d1b14d81c4f93e1a6d1a686c3312e4ba and thereby fixes the problem.
* add missing strerror text for key managementpelco2022-02-191-0/+4
|
* fix out-of-bound read processing time zone data with distant-past datesRich Felker2022-02-091-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this bug goes back to commit 1cc81f5cb0df2b66a795ff0c26d7bbc4d16e13c6 where zoneinfo file support was first added. in scan_trans, which searches for the appropriate local time/dst rule in effect at a given time, times prior to the second transition time caused the -1 slot of the index to be read to determine the previous rule in effect. this memory was always valid (part of another zoneinfo table in the mapped file) but the byte value read was then used to index another table, possibly going outside the bounds of the mmap. most of the time, the result was limited to misinterpretation of the rule in effect at that time (pre-1900s), but it could produce a crash if adjacent memory was not readable. the root cause of the problem, however, was that the logic for this code path was all wrong. as documented in the comment, times before the first transition should be treated as using the lowest-numbered non-dst rule, or rule 0 if no non-dst rules exist. if the argument is in units of local time, however, the rule prior to the first transition is needed to determine if it falls before or after it, and that's where the -1 index was wrongly used. instead, use the documented logic to find out what rule would be in effect before the first transition, and apply it as the offset if the argument was given in local time. the new code has not been heavily tested, but no longer performs potentially out-of-bounds accesses, and successfully handles the 1883 transition from local mean time to central standard time in the test case the error was reported for.
* fix potentially wrong-sign zero in cproj functions at infinityRich Felker2022-01-183-3/+3
| | | | | | these are specified to use the sign of the imaginary part of the input as the sign of zero in the result, but wrongly copied the sign of the real part.
* make fseek detect and produce an error for invalid whence argumentsRich Felker2022-01-091-0/+7
| | | | | | | | this is a POSIX requirement. we previously relied on the underlying fd (or other backend) seek operation to produce the error, but since linux lseek now supports other seek modes (SEEK_DATA and SEEK_HOLE) which do not interact well with stdio buffering, this is insufficient. instead, explicitly check whence before performing any operations.
* add SEEK_DATA and SEEK_HOLE to unistd.hÉrico Nogueira2022-01-091-0/+2
| | | | | | | | these are linux specific constants. glibc exposes them behind _GNU_SOURCE, but, since SEEK_* is reserved for the implementation, we can simply define them. furthermore, since they can't be used with fseek() and other functions that deal with FILE, we don't add them to stdio.h.
* fix failure to use add-cfi scripts on asm when building out-of-treeWesley Wiser2022-01-071-1/+1
| | | | use $srcdir in configure test for add-cfi script.
* fix wcwidth of hangul combining (vowel/final) lettersRich Felker2021-12-271-58/+60
| | | | | | | | | | these characters combine onto a base character (initial) and therefore need to have width 0. the original binary-search implementation of wcwidth handled them correctly, but a regression was introduced in commit 1b0ce9af6d2aa7b92edaf3e9c631cb635bae22bd by generating the new tables from unicode without noticing that the classification logic in use (unicode character category Mn/Me/Cf) was insufficient to catch these characters.
* fix mismatched signatures for strtod_l familyRich Felker2021-12-092-7/+22
| | | | | | | | | | | | | strtod_l, strtof_l, and strtold_l originally existed only as glibc-ABI-compat symbols. as noted in the commit which added them, 17a60f9d327c6f8b5707a06f9497d846e75c01f2, making them aliases for the non-_l functions was a hack and not appropriate if they ever became public API. unfortunately, commit 35eb1a1a9b97577e113240cd65bf9fc44b8df030 did make them public without undoing the hack. fix that now by moving the the _l functions to their own file as wrappers that just throw away the locale_t argument.