summaryrefslogtreecommitdiff
path: root/lib/libc/hidden
AgeCommit message (Collapse)Author
2019-01-12Move sigwait(3) from libpthread to libcJeremie Courreges-Anglas
POSIX wants it in libc, that's where the function can be found on other systems. Reported by naddy@, input from naddy@ and guenther@. "looks ok" guenther@, ok deraadt@ Note: riding the libc/libpthread major cranks earlier today.
2019-01-11mincore() is a relic from the past, exposing physical machine informationTheo de Raadt
about shared resources which no program should see. only a few pieces of software use it, generally poorly thought out. they are being fixed, so mincore() can be deleted. ok guenther tedu jca sthen, others
2018-11-21Introducing malloc_usable_size() was a mistake. While some otherOtto Moerbeek
libs have it, it is a function that is considered harmful, so: Delete malloc_usable_size(). It is a function that blurs the line between malloc managed memory and application managed memory and exposes some of the internal workings of malloc. If an application relies on that, it is likely to break using another implementation of malloc. If you want usable size x, just allocate x bytes. ok deraadt@ and other devs
2018-11-18Implement malloc_usable_size(); ok millert@ deraadt@ and jmc@ for the man pageOtto Moerbeek
2018-11-05Implement C11's aligned_alloc(3). ok guenther@Otto Moerbeek
2018-10-30Add C11's timespec_get(3); minor bump for libc.Philip Guenther
Tweaked diff from brad@ manpage tweaks florian@ and jmc@ ok deraadt@ millert@
2018-09-13Add uid_from_user() and gid_from_group(), derived from pax's cache.c.Todd C. Miller
It replaces the existing pwcache.c functions user_from_uid(3) and group_from_gid(3) with the pax equivalents. Adapted from NetBSD (mycroft) changes from our own pax's cache.c. OK guenther@
2018-07-13Unveiling unveil(2).Bob Beck
This brings unveil into the tree, disabled by default - Currently this will return EPERM on all attempts to use it until we are fully certain it is ready for people to start using, but this now allows for others to do more tweaking and experimentation. Still needs to send the unveil's across forks and execs before fully enabling. Many thanks to robert@ and deraadt@ for extensive testing. ok deraadt@
2018-03-31Mark pthread_equal() as unused inside libcPhilip Guenther
2018-01-18Instead of trying to handle ffs() with the normal rename-mark-hidden-and-aliasPhilip Guenther
dance, mark it protected. This works better for both gcc and clang: gcc blocks overriding of internal calls, while clang permits inlining again. ok otto@
2017-12-01Redo the calculation of the alignment and placement of static TLS data toPhilip Guenther
correctly take into account the segment p_align. Previously, anything with a size belong the natural alignment or with alignment larger than the natural one would either not be intialized correctly, be misaligned, or result in the TIB being misaligned. Problems reported by Charles Collicutt (charles (at) collicutt.co.uk) ok kettenis@
2017-11-29clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"Philip Guenther
to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when building with clang, instead mark those as protected visibility to get rid of the PLT relocations. We can't take the address of them then, but that's ok: it's a build-time error not a run-time error. ok kettenis@
2017-11-04Revert recent changes to unbreak ports/net/sambaJeremie Courreges-Anglas
While it is not clear (to me) why that ports ends up with corrupted shared libs, reverting those changes fixes the issue and should allow us to close p2k17 more smoothly. Discussed with a bunch, ok ajacoutot@ guenther@
2017-10-28Change pthread_cleanup_{push,pop} to macros that store the cleanup infoPhilip Guenther
on the stack instead of mallocing the list and move the APIs from libpthread to libc so that they can be used inside libc. Note: the standard was explicitly written to permit/support this "macro with unmatched brace" style and it's what basically everyone else already does. We xor the info with random cookies with a random magic to detect/trip-up overwrites. Major bump to both libc and libpthread due to the API move. ok mpi@
2017-09-05New POSIX xlocale implementation written from scratch.Ingo Schwarze
Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8. With important help from kettenis@, guenther@, and jca@. Repeated testing in ports bulk builds by naddy@. Additional testing by jca@, sebastia@, dcoppa@, and others. OK kettenis@ dcoppa@, and guenther@ on an earlier version. Riding guenther@'s libc/librthread major bump.
2017-09-05Move mutex, condvar, and thread-specific data routes, pthread_once, andPhilip Guenther
pthread_exit from libpthread to libc, along with low-level bits to support them. Major bump to both libc and libpthread. Requested by libressl team. Ports testing by naddy@ ok kettenis@
2017-08-15Wrap <sched.h> and <sys/futex.h> so that internal calls go directPhilip Guenther
2017-06-19port the RBT code to userland by making it part of libc.David Gwynne
src/lib/libc/gen/tree.c is a copy of src/sys/kern/subr_tree.c, but with annotations for symbol visibility. changes to one should be reflected in the other. the malloc debug code that uses RB code is ported to RBT. because libc provides the RBT code, procmap doesn't have to reach into the kernel and build subr_tree.c itself now. mild enthusiasm from many ok guenther@
2017-05-20Use David Musser's introsort algorithm to fall back to heapsort(3)Todd C. Miller
when the recursion depth reaches 2*lg(n + 1). This avoids quicksort's quadratic behavior for pathological input without appreciably changing the average run time.
2017-04-10Introducing freezero(3) a version of free that guarantees the processOtto Moerbeek
no longer has access to the content of a memmory object. It does this by either clearing (if the object memory remains cached) or by calling munmap(2). ok millert@, deraadt@, guenther@
2017-03-06Introducing recallocarray(3), a blend of calloc(3) and reallocarray(3)Otto Moerbeek
with the added feature that released memory is cleared. Much input from various developers. ok deraadt@ tom@
2016-09-26sigsetmask() and sigblock() are no longer used by any setjmp implementationPhilip Guenther
so the internal hidden names are unused; switch to PROTO_DEPRECATED() and drop the DEF_WEAK()s
2016-09-12Don't declare select() in <unistd.h>Philip Guenther
ok deraadt@ millert@
2016-09-06Make sure attributes are applied to function declarations before they'rePhilip Guenther
used or defined, as clang isn't as forgiving as gcc. Also, declare __flt_rounds() so that libc can build it despire clang providing its own <float.h> ok stefan@ kettenis@
2016-09-03Add functions for SHA512/256. The standard says you're supposed to startTed Unangst
with different magic numbers, so we need to add some functions instead of just asking the user to truncate as desired. Sigh. SHA512 is quite a bit faster than SHA256 on 64 bit CPUs, but 256 bit hashes are usually quite sufficient. Best of both. ok deraadt tom
2016-08-14Reduce qabs() and qdiv() to aliases of llabs() and lldiv().Philip Guenther
Merge the manual pages and call them deprecated there. ok and manpage tweak jmc@, ok natano@
2016-07-26Wrap fpgetround() so internal calls to it (seen on arm, powerpc, and sh)Philip Guenther
go direct instead of through the PLT. ok millert@ kettenis@
2016-05-30Stop publicly declaring _yp_dobind() and struct dom_binding, closing outPhilip Guenther
a rant Theo wrote 24 years ago. Mark __ypexclude_{add,is,free}() as hidden "get off my lawn!" deraadt@
2016-05-29Wrap <machine/sysarch.h> to prevent overriding internal calls, forPhilip Guenther
alpha and mips64 ok millert@
2016-05-29Remove dead support for changing BDB hash algorithm and cache of alternativesPhilip Guenther
ok natano@ millert@ deraadt@
2016-05-23Remove iruserok(_sa)? and __ivaliduser(sa)?Philip Guenther
ok millert@ deraadt@
2016-05-09Remove sigreturn declaration and the now-unused libc syscall stubPhilip Guenther
2016-05-07remove ancient dbm functions (ndbm remains). nothing uses them in forever.Ted Unangst
2016-05-07Use a Thread Information Block in both single and multi-threaded programs.Philip Guenther
This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
2016-03-30Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, toPhilip Guenther
make its underlying symbol name look like others.
2016-03-30Eliminate userspace caching by getlogin_r/setlogin; make the getloginPhilip Guenther
syscall behave exactly like userspace getlogin_r() and rename it to match. Eliminate the reduced-to-no-op wrappers of the syscalls. Eliminate the unnecessary per-thread static buffering by getlogin(). ok kettenis@ deraadt@
2016-03-21Rename the system call sendsyslog2 to sendsyslog. Keep the old oneAlexander Bluhm
as osendsyslog for a while. The three argument variant is the only one that will stay. input kettenis@; OK deraadt@
2016-03-20Rearrange C runtime bits: now that ld.so exports environ and __progname,Philip Guenther
move their definitions and initialization in static links to libc.a Make crt0 always invoke a new func _csu_finish() in libc to process the auxv and to either register the ld.so cleanup function (in dynamic links) or initialize environ and __progname and do MC_DISABLE_KBIND (in static links). In libc, get pagesize from auxv; cache that between getpagesize() and sysconf(_SC_PAGESIZE) ok mpi@ "good time" deraadt@
2016-03-13environ and __progname are not declared in a public header; declare themPhilip Guenther
in libc's hidden/stdlib.h instead of in each .c file that needs one ok deraadt@ gsoares@ mpi@
2015-11-25Wrap <icdb.h> so that calls go direct and the symbols are all weakPhilip Guenther
ok tedu@
2015-11-25Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passingTheo de Raadt
LOG_CONS to the kernel. As a result, the /dev/console opening code can be removed. ok kettenis millert beck
2015-11-24Use reentrant versions of getpw{nam,uid} and getgr{nam,gid} withinTodd C. Miller
libc to avoid reusing the static buffers returned by the non-reentrant versions. Since this is inside libc we can use constants for the buffer sizes instead of having to call sysconf(). OK guenther@ deraadt@
2015-11-18Add _shadow variants to the two popular getpw functions (uid and nam).Ted Unangst
This version of the function will always open the secure/shadow/master password files. Soon, the regular variants of these functions will not. (Intermixing shadow and regular gets a little weird; don't do that.) Not using struct spwd and getspwnam functions to reduce churn in callers. Should just be a one line diff in most places. ok deraadt
2015-11-10Split the intra-thread functionality from kill(2) into its own syscallPhilip Guenther
thrkill(2), rolling the kill(2) syscall number with the ABI change to avoid breaking binaries during during the transition. thrkill(2) includes a 'tcb' argument that eliminates the need for locking in pthread_kill() and simplifies pthread_cancel(). Switch __stack_smash_handler() to use thrkill(2) and explicitly unblock SIGABRT. Minor bump to both libc and libpthread: make sure you install a new kernel! ok semarie@
2015-11-10libc.so can't be unloaded, so move the hidden atexit() and pthread_atfork()Philip Guenther
stubs for the executable from crtbegin.o into libc, which lets them be excluded from static links that don't use them. For this, drop the normal crt{begin,end}S.o from libc.so: the .init and .fini sections for libc aren't called at the right times anyway, so it's good that they're unused. libc.so just needs __guard_local and the .note.openbsd.ident section, so add them to stack_protector.c for now (this will be improved) "good time" deraadt@
2015-10-31Do not include a timestamp in the syslog message. There is no need --Theo de Raadt
syslogd will fill it in immediately upon reception on the other side of sendsyslog(2). Our libc only talks to our syslogd, which will fix the timestamp before forwarding. syslog_r has done this for a long time already. ok tedu bluhm
2015-10-27Wrap the remaining math functions in libc: __fpclassify*(), __flt_rounds(),Philip Guenther
and ldexp(). ok millert@
2015-10-25Wrap waitpid() so calls go direct; weaken wait() and wait3().Philip Guenther
Strip out unnecessary #includes and use NULL instead of (struct rusage *)0
2015-10-25Hide __atexit and __atexit_register_cleanup()Philip Guenther
Wrap __cxa_{atexit,finalize}() so the call from exit() goes direct Switch regress/lib/libc/atexit/ to be built with -static so that it can still access __atexit* ok millert@ jca@
2015-10-25Use sigaction() instead of signal() to avoid pulling in unnecessaryPhilip Guenther
wrappers. To keep uses from crawling back in, mark signal() as deprecated inside libc. ok deraadt@