summaryrefslogtreecommitdiffstats
path: root/lib/libc/hidden (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Correct error returns, do not print eror message to stdout (thereotto2020-10-091-2/+2
| | | | | | is a dlerror() function for that) and mark dladdr() as PROTO_NORMAL to be able to call it from a malloc.c MALLOC_STATS leak reporting project I'm working on. ok kettenis@
* Partly revert previous commit, these changes we not supposed to go in.otto2020-10-091-2/+2
|
* As noted by tb@ previous commit only removed an unused fucntion.otto2020-10-091-2/+2
| | | | | So redo previous commit properly: Use random value for canary bytes; ok tb@.
* Add support for timeconting in userland.pirofti2020-07-063-4/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* libc's authentication privsep layer performed insufficient usernamederaadt2019-12-041-1/+5
| | | | | | | | validation. Repair work mostly by markus and millert, first of all solving the primary problem, then adding some additional validation points. And then futher validation in login and su. This will be 6.5/021_libcauth.patch.sig and 6.6/010_libcauth.patch.sig Reported by Qualys
* Allow the caller of asr functions to create and use a specific context.otto2019-10-241-1/+3
| | | | | Diff from eric@ and florian@, commiting on their behalf since they are absent and we want to ride the minor shlib bump.
* Complete the ld.so boot cleanup: move most libc initialization fromguenther2019-06-023-1/+60
| | | | | | | | | | | | | | | | | _csu_finish() to _libc_preinit(), which is an .init_array function in shared libc (and mark it INITFIRST) or a .preinit_array function in static libc, grabbing the _dl_cb callback there from ld.so. Then in _csu_finish(), invoke the dl_clean_boot() callback to free ld.so's startup bits before main() gets control. Other cleanups this permits: - move various startup structures into .data.rel.ro - the dl* stubs in libc can be strong and call the callbacks provided via _dl_cb - no longer need to conditionalize dlctl() calls on presence of _DYNAMIC original concept and full diff ok kettenis@ ok deraadt@
* Inroduce malloc_conceal() and calloc_conceal(). Similar to theirotto2019-05-101-1/+3
| | | | | counterparts but return memory in pages marked MAP_CONCEAL and on free() freezero() is actually called.
* Move sigwait(3) from libpthread to libcjca2019-01-121-1/+2
| | | | | | | | 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.
* mincore() is a relic from the past, exposing physical machine informationderaadt2019-01-111-2/+1
| | | | | | | 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
* Introducing malloc_usable_size() was a mistake. While some otherotto2018-11-211-2/+1
| | | | | | | | | | | 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
* Implement malloc_usable_size(); ok millert@ deraadt@ and jmc@ for the man pageotto2018-11-181-1/+2
|
* Implement C11's aligned_alloc(3). ok guenther@otto2018-11-051-1/+2
|
* Add C11's timespec_get(3); minor bump for libc.guenther2018-10-301-1/+2
| | | | | | Tweaked diff from brad@ manpage tweaks florian@ and jmc@ ok deraadt@ millert@
* Add uid_from_user() and gid_from_group(), derived from pax's cache.c.millert2018-09-132-3/+5
| | | | | | 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@
* Unveiling unveil(2).beck2018-07-131-1/+2
| | | | | | | | | | | | | 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@
* Mark pthread_equal() as unused inside libcguenther2018-03-311-1/+2
|
* Instead of trying to handle ffs() with the normal rename-mark-hidden-and-aliasguenther2018-01-181-2/+2
| | | | | | | 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@
* Redo the calculation of the alignment and placement of static TLS data toguenther2017-12-011-3/+13
| | | | | | | | | | 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@
* clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"guenther2017-11-291-4/+4
| | | | | | | | | 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@
* Revert recent changes to unbreak ports/net/sambajca2017-11-041-3/+1
| | | | | | | | 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@
* Change pthread_cleanup_{push,pop} to macros that store the cleanup infoguenther2017-10-281-1/+3
| | | | | | | | | | | | | | 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@
* New POSIX xlocale implementation written from scratch.schwarze2017-09-058-14/+80
| | | | | | | | | | | | 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.
* Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther2017-09-052-2/+52
| | | | | | | | 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@
* Wrap <sched.h> and <sys/futex.h> so that internal calls go directguenther2017-08-152-0/+50
|
* port the RBT code to userland by making it part of libc.dlg2017-06-191-0/+42
| | | | | | | | | | | | | | 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@
* Use David Musser's introsort algorithm to fall back to heapsort(3)millert2017-05-201-2/+2
| | | | | | 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.
* Introducing freezero(3) a version of free that guarantees the processotto2017-04-101-1/+2
| | | | | | 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@
* Introducing recallocarray(3), a blend of calloc(3) and reallocarray(3)otto2017-03-061-1/+2
| | | | | with the added feature that released memory is cleared. Much input from various developers. ok deraadt@ tom@
* sigsetmask() and sigblock() are no longer used by any setjmp implementationguenther2016-09-261-3/+3
| | | | | so the internal hidden names are unused; switch to PROTO_DEPRECATED() and drop the DEF_WEAK()s
* Don't declare select() in <unistd.h>guenther2016-09-121-2/+1
| | | | ok deraadt@ millert@
* Make sure attributes are applied to function declarations before they'reguenther2016-09-064-18/+58
| | | | | | | | 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@
* Add functions for SHA512/256. The standard says you're supposed to starttedu2016-09-031-2/+11
| | | | | | | | 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
* Reduce qabs() and qdiv() to aliases of llabs() and lldiv().guenther2016-08-141-3/+3
| | | | | | Merge the manual pages and call them deprecated there. ok and manpage tweak jmc@, ok natano@
* Wrap fpgetround() so internal calls to it (seen on arm, powerpc, and sh)guenther2016-07-261-0/+30
| | | | | | go direct instead of through the PLT. ok millert@ kettenis@
* Stop publicly declaring _yp_dobind() and struct dom_binding, closing outguenther2016-05-301-2/+6
| | | | | | a rant Theo wrote 24 years ago. Mark __ypexclude_{add,is,free}() as hidden "get off my lawn!" deraadt@
* Wrap <machine/sysarch.h> to prevent overriding internal calls, forguenther2016-05-291-0/+25
| | | | | | alpha and mips64 ok millert@
* Remove dead support for changing BDB hash algorithm and cache of alternativesguenther2016-05-291-1/+4
| | | | ok natano@ millert@ deraadt@
* Remove iruserok(_sa)? and __ivaliduser(sa)?guenther2016-05-231-3/+1
| | | | ok millert@ deraadt@
* Remove sigreturn declaration and the now-unused libc syscall stubguenther2016-05-091-2/+1
|
* remove ancient dbm functions (ndbm remains). nothing uses them in forever.tedu2016-05-071-31/+0
|
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-0714-31/+197
| | | | | | | | | | | | | | | | | 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@
* Turd polish: use HIDDEN= instead of PSEUDO= for ptrace syscall stub, toguenther2016-03-301-0/+25
| | | | make its underlying symbol name look like others.
* Eliminate userspace caching by getlogin_r/setlogin; make the getloginguenther2016-03-301-3/+3
| | | | | | | | 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@
* Rename the system call sendsyslog2 to sendsyslog. Keep the old onebluhm2016-03-211-5/+2
| | | | | | as osendsyslog for a while. The three argument variant is the only one that will stay. input kettenis@; OK deraadt@
* Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther2016-03-201-1/+6
| | | | | | | | | | | 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@
* environ and __progname are not declared in a public header; declare themguenther2016-03-131-1/+4
| | | | | | in libc's hidden/stdlib.h instead of in each .c file that needs one ok deraadt@ gsoares@ mpi@
* Wrap <icdb.h> so that calls go direct and the symbols are all weakguenther2015-11-251-0/+35
| | | | ok tedu@
* Add a syscall stub for sendsyslog2(2), and use it in syslog_r(3), passingderaadt2015-11-251-1/+4
| | | | | | LOG_CONS to the kernel. As a result, the /dev/console opening code can be removed. ok kettenis millert beck
* Use reentrant versions of getpw{nam,uid} and getgr{nam,gid} withinmillert2015-11-242-6/+6
| | | | | | | 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@