summaryrefslogtreecommitdiff
path: root/lib/libc
AgeCommit message (Collapse)Author
2023-04-05Introduce variation in location of junked bytes; ok tb@Otto Moerbeek
2023-04-01Check all chunks in the delayed free list for write-after-free.Otto Moerbeek
Should catch more of them and closer (in time) to the WAF. ok tb@
2023-03-31Since all arm64 assembly code in libc uses the ENTRY* macros fromMark Kettenis
<machine/asm.h> they are already get the necessary "bti c" instructions. Passi the -mmark-bti-property option to mark the corresponding object files as having BTI support. ok deraadt@
2023-03-25Last arg is also a pointer, so pass NULL instead of 0; ok deraadt@Otto Moerbeek
2023-03-25Change malloc chunk sizes to be fine grained.Otto Moerbeek
The basic idea is simple: one of the reasons the recent sshd bug is potentially exploitable is that a (erroneously) freed malloc chunk gets re-used in a different role. malloc has power of two chunk sizes and so one page of chunks holds many different types of allocations. Userland malloc has no knowledge of types, we only know about sizes. So I changed that to use finer-grained chunk sizes. This has some performance impact as we need to allocate chunk pages in more cases. Gain it back by allocation chunk_info pages in a bundle, and use less buckets is !malloc option S. The chunk sizes used are 16, 32, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048 (and a few more for sparc64 with its 8k sized pages and loongson with its 16k pages). If malloc option S (or rather cache size 0) is used we use strict multiple of 16 sized chunks, to get as many buckets as possible. ssh(d) enabled malloc option S, in general security sensitive programs should. See the find_bucket() and bin_of() functions. Thanks to Tony Finch for pointing me to code to compute nice bucket sizes. ok tb@
2023-03-15Fix a number of out of bound reads in DNS response parsing.Todd C. Miller
Originally from djm@. OK deraadt@ florian@ bluhm@
2023-03-02When parsing %s, the result should be in the local time zone.Todd C. Miller
Based on a patch from enh@google. OK tb@
2023-02-27use the correct size of the execve syscall stubTheo de Raadt
2023-02-27Calculate the size of the static (and profiled static) execve syscall stubTheo de Raadt
and store it in a const variable for use by crt0. help from kettenis and miod
2023-02-27There is no reason to-be-cleared chunks cannot participate in delayedOtto Moerbeek
freeing; ok tb@
2023-02-24Try to warn about syscall() possibly being deleted from libc in theTheo de Raadt
future. The ports team is already running around with axes and mops, but don't worry such an action won't happen quickly. with tb
2023-02-23adjust documentation for ktrace.h changes. utrace() is now easier to useTheo de Raadt
ok guenther
2023-02-22remove .Pp before .Sh;Jason McIntyre
2023-02-22Point to <signal.h> and not <sys/signal.h>: the latter isPhilip Guenther
an implementation detail for the kernel, libc, and libkvm, and should not be a concern for others.
2023-02-22Prefer 'argument' over 'parameter' when refering to the valuePhilip Guenther
passed in a specific call. From discussion with schwarze@ and jmc@ ok jmc@
2023-02-22Prefer "get or set" over "get/set" or "get and set".Philip Guenther
From discussion with schwarze@ and jmc@ ok jmc@
2023-02-21adress -> address;Jason McIntyre
2023-02-21hppa does some weird callgate stuff, so the pinsyscall() provides theTheo de Raadt
wrong address to the kernel. disable for now.
2023-02-21dlfcn/init.cTheo de Raadt
2023-02-21Do pinsyscall() after static libc is configured for errno storage.Theo de Raadt
2023-02-21pinsyscall(2) is not just for dynamic binaries anymore, so make theTheo de Raadt
text more generic
2023-02-21In static binaries, if WEAK execve can be found, use pinsyscall(2) toTheo de Raadt
tell the kernel where the execve stub is found. With this mechanism we cannot tell the size, so use 128 as an estimate for the most we expect from any architecture. discussed with kettenis, ok guenther
2023-02-21create a stub for pinsyscall(2)Theo de Raadt
ok guenther
2023-02-21correct parameter typeTheo de Raadt
2023-02-19auth_getchallenge does not exist anymoreaisha
2023-02-18missing dot before macro; from josiah frentsosJason McIntyre
2023-02-17Only compile _ng_print() #ifdef DEBUG_NG; ok millert@Miod Vallat
2023-02-17Remove unused variables; ok millert@Miod Vallat
2023-02-16Document pinsyscall(2). The ld.so and kernel enforcement code is notTheo de Raadt
commited ye -- waiting for enough people to run kernels which support the system call. ok jmc
2023-02-11crank major because __syscall is goneTheo de Raadt
2023-02-11__syscall() is no longer neccessary since the system calls which neededTheo de Raadt
it are now unpadded ok kettenis guenther
2023-02-11Use a consistent comment to explain why 32bit archs set their secondPhilip Guenther
return register to -1 in the syscall error path ("for lseek"). removal of the misleading __syscall() mention requested by deraadt@ ok deraadt@
2023-02-07remove seatbeltTheo de Raadt
2023-02-05remove --no-execute-only seatbeltTheo de Raadt
2023-02-05Implement usertc corresponding to the Allwinner A64 agtimer(4) errata.Mark Kettenis
ok cheloha@, semarie@
2023-02-05writev() appeared in 4.1c before 4.2Jonathan Gray
2023-02-05getpagesize() appeared in 4.1c before 4.2Jonathan Gray
2023-01-27Use stricter constraints in the assembly statements in fpset{mask,round,sticky}Miod Vallat
and make them behave as intended again. The existing constraints are too weak; this used to work in older days, but got broken when the system compiler was updated to gcc 4 (or maybe even gcc 3).
2023-01-20The locale is ignored on OpenBSD, match the wording used in isalpha.3.Todd C. Miller
OK schwarze@
2023-01-16Currently we disable kbind(2) for static program from libc.a'sPhilip Guenther
preinit hook. Delete that and instead have the kernel disable kbind at exec-time if the program doesn't have an ELF interpreter. For now, permit userland calls to disable it when already disabled so existing static programs continue to work. prompted by deraadt@ questioning about the call in libc.a ok deraadt@ miod@
2023-01-13Move all data from .text section to .rodata, and update the code toMiod Vallat
fetch them correctly when building PIC. ok kettenis@
2023-01-12remove outdated "expected to be compliant"Jonathan Gray
ok miod@ kn@ deraadt@
2023-01-11block --execute-only on mips64 & sparc64 during the upcoming transition.Theo de Raadt
a seatbelt, because libc build corruption is too painful.
2023-01-11do not need --execute-only anymore, it is now the defaultTheo de Raadt
2023-01-11Add retguard to amd64 syscalls.Todd Mortimer
Since we got rid of padded syscalls we have enough registers to do this. ok deraadt@ ok kettenis@
2023-01-08Add getthrname(2) manpagePhilip Guenther
ok jmc@ schwarze@
2023-01-07Add {get,set}thrname(2) for putting thread names in the kernel andPhilip Guenther
exposed in a new field returned by sysctl(KERN_PROC). Update pthread_{get,set}_name_np(3) to use the syscalls. Show them, when set, in ps -H and top -H output. libc and libpthread minor bumps ok mpi@, mvs@, deraadt@
2023-01-04Christos Zoulas agreed to rescind clause 3 and 4 inJonathan Gray
NetBSD fsck.8 rev 1.35 fsutil.h rev 1.14 pathnames.h rev 1.2 netgroup_mkdb.8 rev 1.9 netgroup_mkdb.c rev 1.18 str.c rev 1.7 str.h rev 1.4 rdate.8 rev 1.11 rdate.c rev 1.19 extern.h rev 1.14 getnetgrent.c rev 1.41 netgroup.h rev 1.10 fparseln.3 rev 1.4 fparseln.c rev 1.10 our stringlist.c/stringlist.h are derived from getnetgrent.c rfc868time.c from rdate.c newfs/pathnames.h from fsck/pathnames.h https://mail-index.netbsd.org/source-changes/2009/10/21/msg002182.html Not all files are covered as some had copyright assigned to TNF in 1998.
2022-12-30add history for getpid(2) and getppid(2)Jonathan Gray
getpid() appeared (undocumented) in v5. Between v6 and v7 there is an extra return value for the parent process ID. getppid() did not appear in v7, it appeared in 32v libc. But getppid() predates 32v. It seems to have been in earlier USG releases such as Generic 3 (PG-1C300 Issue 3) as the MERT Release 0 manual references it. getppid() didn't become a system call until 4.3BSD-Reno omit most of these details and just mention v5 and 32v with and ok schwarze@
2022-12-30pause.3: miscellaneous rewrites, cleanupScott Soule Cheloha
Eliminate some redundant or extraneous pieces from the pause.3 page. Say the "thread" "blocks", don't say the "process" "pauses". No need to enumerate the ways a signal can be delivered. Add a few relevant cross-references. With input from millert@ and schwarze@. Link: https://marc.info/?l=openbsd-tech&m=166801212316670&w=2 ok millert@ schwarze@