summaryrefslogtreecommitdiff
path: root/lib/libc
AgeCommit message (Collapse)Author
2024-01-10pthread_cond_timedwait(3): accept negative absolute timeoutsScott Soule Cheloha
Negative absolute timeouts are valid inputs. With input from kettenis@. Thread: https://marc.info/?l=openbsd-tech&m=170467558006767&w=2 ok guenther@
2024-01-07libc, librthread: _twait: subtraction is not comparisonScott Soule Cheloha
Compare the current time with the absolute timeout before computing the relative timeout to avoid arithmetic overflow. Fixes a bug where large negative absolute timeouts are subtracted into large positive relative timeouts and incorrectly cause the caller to block. While here, use timespeccmp(3) and timespecsub(3) to simplify the code. Thread: https://marc.info/?l=openbsd-tech&m=169945962503129&w=2
2023-12-19static binary setting a table, or dynamic binary trying to do whatTheo de Raadt
ld.so already did, will both be EPERM
2023-12-19- new sentence, new lineJason McIntyre
- zap an unused Pp
2023-12-19A small cleanup of malloc_bytes(), getting rid of a goto and a tinyOtto Moerbeek
bit of optimization; ok tb@ asou@
2023-12-19pinsyscalls(2) has changed a little bit, and I can provide more adviceTheo de Raadt
for how it is used (in ld.so, it's not like anyone else can call it). Also document the errors..
2023-12-13Move a large part of SYS.h defines to DEFS.h to match where other platformsMiod Vallat
put their macros, and also turn a few "EXIT" into "END" for consistency with other platforms. NFCI ok kettenis@ deraadt@
2023-12-13actually remove it, pointed out by jsgTheo de Raadt
2023-12-12crank libc major because syscall(2) was removedTheo de Raadt
2023-12-12remove support for syscall(2) -- the "indirection system call" becauseTheo de Raadt
it is a dangerous alternative entry point for all system calls, and thus incompatible with the precision system call entry point scheme we are heading towards. This has been a 3-year mission: First perl needed a code-generated wrapper to fake syscall(2) as a giant switch table, then all the ports were cleaned with relatively minor fixes, except for "go". "go" required two fixes -- 1) a framework issue with old library versions, and 2) like perl, a fake syscall(2) wrapper to handle ioctl(2) and sysctl(2) because "syscall(SYS_ioctl" occurs all over the place in the "go" ecosystem because the "go developers" are plan9-loving unix-hating folk who tried to build an ecosystem without allowing "ioctl". ok kettenis, jsing, afresh1, sthen
2023-12-11Make sure the syscall table entries are aligned on a 4-byte boundary.Mark Kettenis
Required for strict-alignment architectures and a good idea on others. ok deraadt@
2023-12-11arm just had to be different and change the syntax for .pushsectionTheo de Raadt
arguments, so we have to cope.
2023-12-11Oops, wrong argument to macroTheo de Raadt
2023-12-11document upcoming pinsyscalls(2) system callTheo de Raadt
ok kettenis, some tweaks from jmc
2023-12-10Populate the non-LOAD openbsd.syscalls section (and PT_OPENBSD_SYSCALL)Theo de Raadt
with {uint offset, uint syscall#} entries in libc & ld.so. In libc a few syscall# entries (break, sigprocmask, _tfork, _threxit) are duplicated because additional or inline uses occur (that situation is handled elsewhere) ok kettenis
2023-12-06Move CALLSYS_NOERROR macro from <machine/asm.h> to libc, and expand it forMiod Vallat
non-libc users. This is a two-liner macro anyway, and this will make deraadt@'s future changes in this area easier to make. NFC
2023-12-04zap trailing whitespaceTheo Buehler
2023-12-04Save backtraces to show in leak dump. Depth of backtrace set byOtto Moerbeek
malloc option D (aka 1), 2, 3 or 4. No performance impact if not used. ok asou@
2023-11-22Set correct errno field in struct asr_result.Florian Obser
Otherwise gethostbyname(3) returns stack garbage when it is called with an invalid host name, indicating success. Problem observed in segfaulting ifconfig(8) by bluhm.
2023-11-21Do not short-circuit localhost resolution when AI_NUMERICHOST is set.Florian Obser
localhost is not a valid IP address and so getaddrinfo(3) has to fail. Found by anton in pfctl & ipsecctl regress. OK anton
2023-11-20localhost is either 127.0.0.1 or ::1, nothing else.Florian Obser
RFC 6761, 6.3 Domain Name Reservation Considerations for "localhost.": 3. Name resolution APIs and libraries SHOULD recognize localhost names as special and SHOULD always return the IP loopback address for address queries and negative responses for all other query types. Name resolution APIs SHOULD NOT send queries for localhost names to their configured caching DNS server(s). This makes sure that the getaddrinfo(3) and gethostbyname(3) family of functions always return the loopback address and do not send queries to name servers. This includes "localhost", "localhost." and everything under ".localhost" and ".localhost.". For example, a host underneath the .com.ar zone will per default have a search list of "com.ar.". resolv.conf(5) has a default of "lookup bind file". Both combined will result in lookups for "localhost" to not return 127.0.0.1 because localhost.com.ar is registered in DNS. It has been known for decades that this is a problem, especially for localhost. Problem recently spotted by gonzalo@ and debugged by sthen@ Testing sthen, gonzalo Input & OK phessler, eric, millert OK sthen, kn, deraadt
2023-11-14Add break to error out on weird characters in gethostbyname().Florian Obser
Missed in previous some time ago; while here remove confusing else. Input & OK eric
2023-11-11Delete the useless .\" ----- comments before .Sh.Ingo Schwarze
Wo don't have them anywhere else, so we don't need them here. No text change.
2023-11-11more details about error recoveryIngo Schwarze
OK millert@ jmc@ triggered by a question from cheloha@
2023-11-10MNT_SOFTDEP and mount -o softdep no longer have any effectIngo Schwarze
OK kn@ jmc@
2023-11-09missing full stopJasper Lievisse Adriaanse
2023-11-08libc, librthread: _twait: fully validate absolute timeoutScott Soule Cheloha
Use timespecisvalid(3) to check both bounds for tv_nsec. Link: https://marc.info/?l=openbsd-tech&m=169913314230496&w=2 ok miod@
2023-11-04KNF plus fixed a few signed vs unsigned compares (that we actuallyOtto Moerbeek
not real problems)
2023-10-30seperate -> separate;Jason McIntyre
2023-10-30make special note, right at the start, that DNS is handled seperatelyTheo de Raadt
from regular network. All the crummy pledge clones don't do that. ok millert
2023-10-29libc: Makefile.inc: remove "sparc" from quad support list; ok deraadt@Scott Soule Cheloha
2023-10-29Enable ISO C11 APIs when building libc, even with an older compiler.Todd C. Miller
Otherwise, the prototypes for timespec_get() and aligned_alloc() are not visible. OK guenther@
2023-10-26A few micro-optimizations; ok asou@Otto Moerbeek
2023-10-22correct Va in previous;Jason McIntyre
2023-10-22When option D is active, store callers for all chunks; this avoidsOtto Moerbeek
the 0x0 call sites for leak reports. Also display more info on detected write of free chunks: print the info about where the chunk was allocated, and for the preceding chunk as well. ok asou@
2023-10-14Document the hw.battery sysctls.Mark Kettenis
ok benno@, jmc@, schwarze@
2023-10-12Static binaries which do not call execve() were not callingTheo de Raadt
pinsyscall(SYS_execve, ...). Upon review, this is a fairly small set of programs which either pledge() aggressively or don't usually operate in a risky operating environment. We now point at a location which is definately not a "syscall" instruction. ok kettenis
2023-10-12for a few sysctl nodes, mention standard or at least more widelyIngo Schwarze
available libc API functions and utility programs that produce equivalent output on OpenBSD; OK deraadt@
2023-10-09Mention that the strings are OS-specific.Ingo Schwarze
In part based on input from deraadt@, OK millert@.
2023-10-06__swsetup: set error flag and errno on error.Todd C. Miller
Previously, we set errno to EBADF if the cantwrite() macro (which calls __swsetup()) returns true for POSIX compliance. However, we neglected to also set the error flag, __SERR. Rather than set the error flag in all callers of cantwrite(), set both errno and the error flag in __swsetup(). This matches what FreeBSD does and makes it possible to choose a proper errno value for the second error condition in __swsetup(). OK deraadt@
2023-10-02Add 'host root port' information to hw.ucomnames.Kenneth R Westerback
usbN.X.Y becomes usbN.Z.X.Y Display the usb<blah> string in ucom attach messages so grepping dmesg can be used to find the path to a ucom. More USB cluebats from kettenis@. Deep hub depths testing from drahn@. ok deraadt@ drahn@ kettenis@
2023-10-02DV -> Dv;Jason McIntyre
2023-10-01Add sysctl hw.ucomnames to list 'fixed' paths to USB serialKenneth R Westerback
ports. Suggested by deraadt@, USB route idea from kettenis@. Feedback from anton@, man page improvements from deraadt@, jmc@, schwarze@. ok deraadt@ kettenis@
2023-09-28don't mention what language functions are implemented inJonathan Gray
remove a line relating to the 2BSD libNS ok schwarze@
2023-09-14use Fn notation instead of Nm, as the rest of the page does;Jason McIntyre
from josiah frentsos
2023-09-12since since -> sinceJonathan Gray
2023-09-09Print waring message when not allocated memory in putleakinfo().ASOU Masato
ok otto.
2023-09-06remove unused variableJonathan Gray
2023-08-25new manual page MB_CUR_MAX(3) written from scratch;Ingo Schwarze
OK guenther@ stsp@ jmc@
2023-08-20remove "flag" from the Dv line;Jason McIntyre