summaryrefslogtreecommitdiff
path: root/lib/libc
AgeCommit message (Collapse)Author
2006-10-10Preliminary userland bits for OpenBSD/landisk, many things coming fromMiod Vallat
NetBSD.
2024-04-14Zap trailing whitespace.Florian Obser
OK tb
2024-04-04tzset_basic: only call issetugid(2) if TZ has changedTodd C. Miller
If we are just going to return without parsing TZ, there is no need to call issetugid(2) first. We only need to call issetugid(2) the first time TZ is checked or when the value of TZ has changed. Previously, we called issetugid(2) for every call to the functions described by localtime(3). OK deraadt@
2024-04-03Reading https://github.com/Geal/rust-syslog/issues/79, I came to aTheo de Raadt
related conclusion that our syslog_r should not stomp on errno. The errno being returned from sendsyslog() isn't exactly compatible with the what a legacy syslog_r() would do here anyways, and it is better to just be void and non-stomping; ok millert bluhm
2024-04-02Implement SO_ACCEPTCONN in getsockopt(2)Claudio Jeker
Requested by robert@ OK mvs@ millert@ deraadt@
2024-04-02fix unintended sizeof(pointer) introduced in rev 1.41Jonathan Gray
found with noderef.cocci, ok deraadt@
2024-04-01pinsyscalls appeared in 7.5Sebastian Benoit
ok deraadt
2024-03-30In _malloc_init(), round up the region being mprotected RW to the mallocMiod Vallat
page size, rather than relying upon mprotect to round up to the actual mmu page size. This repairs malloc operation on systems where the malloc page size (1 << _MAX_PAGE_SHIFT) is larger than the mmu page size. ok otto@
2024-03-29Do not include <machine/frame.h> in libc sparc64 fpu routines, they don'tMiod Vallat
need any of its contents. ok claudio@ kettenis@
2024-03-29the msyscall(2) manual page can be deleted.Theo de Raadt
Also, the details described in sigaltstack(2) are no longer true. ok jmc
2024-03-28Delete pinsyscall(2) [which was specific only to SYS_execve] nowTheo de Raadt
that it has been replaced with pinsyscalls(2) [which tells the kernel the location of all system calls in libc.so] floated to various people before release, but it was prudent to wait.
2024-03-27When the syscall number has to be loaded from a pc-relative location,Miod Vallat
abuse END macros to place the number at the end of the syscall wrapper rather than in the middle of it, so that there is no need to branch around it; this saves two instructions per syscall number >= 128. While there, also tweak the error return (SET_ERRNO_AND_RETURN) to only return a 64-bit value for lseek; this saves another instruction for all other syscalls. With input from guenther@; "Anything that makes the machine faster" deraadt@
2024-03-25Move the "no (hard) linking directories" and "no cross-mount links"Philip Guenther
checks from all the filesystems that support hardlinks at all into the VFS layer. Simplify, EPERM description in link(2). ok miod@ mpi@
2024-03-23readdir_r(3) was never necessary and has been deprecated by POSIX.Philip Guenther
Document that in the manpage and stop using it internally. ok deraadt@ millert@ jmc@
2024-03-18fix markup of _PATH_DEFPATH (Li -> Dv); ok jmcOmar Polo
2024-03-06POSIX defines inet_ntoa, not inet_aton.Anthony J. Bentley
ok deraadt@ jmc@
2024-03-02Shorter and simpler version which does not need to use the stack.Miod Vallat
2024-03-02Provide the missing fabsl alias to fabs.Miod Vallat
No shlib_version change needed, jumping on the version bump of the mkdtems addition.
2024-03-01Add mkdtemps(3), like mkdtemp(3) but with a suffix.Todd C. Miller
OK deraadt@ tb@
2024-02-04Move ctype.h defines to the _CTYPE_ prefix, avoids clashes with identifiers ↵Jeremie Courreges-Anglas
in ports Even if those _[BCNLPSUX] defines are in the reserved namespace, some ports make use of those identifiers and thus need pointless headscratching and patches. Just use a longer reserved prefix. We can't just #undef those defines as they are used in libc. Change similar to what NetBSD did around 2010. Went through base builds and an amd64 bulk build, the only fallout was lib(e)stdc++ base_ctype.h. "make includes" will install the latest ctype.h and libstdc++ ctype_base.h. "makes sense" deraadt@, ok sthen@ tb@
2024-02-04Change rune-specific #defines from _CTYPE_ prefix to _RUNETYPE_ prefixJeremie Courreges-Anglas
Similar to what NetBSD did around 2010, this lets us move some defines in ctype.h to the _CTYPE_ prefix. No functional change. "makes sense" deraadt, ok sthen@ tb@
2024-01-22I forgot that chpass(1) and passwd(1) reach-around into libc forTheo de Raadt
getpwent.c (isn't it horrible), and therefore lack visibility of the the libc-internal __hash_open() function. Use -DFORCE_DBOPEN in chpass/Makefile and passwd/Makefile and adjust getpwent.c to use the external visible interface. Is there a better way?
2024-01-22make login.conf(5) and crypt_newhash(3) and the underlying codeTheo de Raadt
consistant regarding bcrypt,a instead of blowfish,a. "blowfish" is a historical alias which we don't need to document as firmly as "bcrypt". report about difficult manual page discovery from ataraxia937 ok millert
2024-01-22Similar to getpwnam(3) and getnetgrent(3), it is better to callTheo de Raadt
libc-private __hash_open() than the generic dbopen(3) which pulls in all 3 database backends. ok millert
2024-01-22getpwnam(3) uses dbopen(3), which pulls all 3 database backends intoTheo de Raadt
static binaries. If we call libc-private __hash_open() instead, it results in a ~40K reduction in many static binaries. ok millert
2024-01-22When getpwnam(3) reaches out to YP, it calls clntudp_create(3) with aTheo de Raadt
pre-initialized ypconnect(2) socket. That calls clntudp_bufcreate(), which contains code checking if the socket and address are configured.. If not, socket(2) is called, or an address allocation is performed via the portmapper (which calls a whole lot more code). Split clnt_udp.c into two .c files (which will compile as seperate .o files), and create a new libc-private clntudp_bufcreate_simple() function which skips the socket and address work. Result: In most static binaries, this reduces the text segment by ~100K, and removes 5-7 system call stubs -- which might matter for non-pledged binaries with otherwise lack socket(2). ok millert jmatthew
2024-01-21update docs on madvise/msync/minherit behaviour in relation to immutable ↵Theo de Raadt
memory; ok kettenis
2024-01-21Static non-PIE binaries always have a base address of 0 (even if the ELFMark Kettenis
headers start at a higher address). Using the wrong base address meant that we were protecting the wrong address range for the malloc internals which made the code error out now that mimmutable(2) no longer allows an RW->R transition. Issue found by gkoehler@ who got most of the way towards a proper fix. ok deraadt@
2024-01-21Add Xr mimmutable to manual pages which discuss immutable memory.Theo de Raadt
prodding from kettenis
2024-01-20Early during mimmutable(2) development, we had a big problem with theTheo de Raadt
chrome v8_flags variable's placement in bss, and as a workaround made it possible to demote a mimmutable mapping's permissions from RW to R. Further mimmutable-related work in libc's malloc created the same problem, which led to a better design: objects could be placed into .openbsd.mutable region, and then at runtime their permission and immutability could be manipulated better. So the RW to R demotion logic is no longer being used, and now this semantic is being deleted. ok kettenis
2024-01-19Make our mktemp(3) callback-driven and split into multiple files.Todd C. Miller
Previously, calling any of the mktemp(3) family would pull in lstat(2), open(2) and mkdir(2). Now, only the necessary system calls will be reachable from the binary. OK deraadt@ guenther@
2024-01-19_execvesize.c is no longer generated to support pinsyscall(SYS_execveTheo de Raadt
2024-01-19Move mktemp.c to stdlib where it belongs.Todd C. Miller
OK deraadt@
2024-01-19Stop initializing pinsyscall(SYS_execve in static binaries that containTheo de Raadt
an execve(2) stub. The new pinsyscalls(2) that applies to all system calls has made this redundant.
2024-01-18the warning about syscall going away is a bit dated now.Theo de Raadt
ok miod tb
2024-01-15Make sure to return a proper string in ai_canonname.Florian Obser
When we made sure that getaddrinfo(3) always resolves "localhost" to the loopback address we forgot to set ai_canonname if AI_CANONNAME or AI_FQDN is set. On a successful call ai_canonname has to be a NUL-terminated string if either of those flags are set. Problem observed by a@alexis-fouilhe.fr in smtpd(8) with a hostname of "localhost". OK millert
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