summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
AgeCommit message (Collapse)Author
2018-01-18Zap the rotor, it was a wrong idea. Cluebat applied by kshe whoOtto Moerbeek
came also up with this diff. Simple, no bias and benchmarks show the extra random calls disappear in te measurement noise.
2018-01-18Move to ffs(3) for bitmask scanning. I played with this earlier,Otto Moerbeek
but at that time ffs function calls were generated instead of the compiler inlining the code. Now that ffs is marked protected in libc this is handled better. Thanks to kshe who prompted me to look at this again.
2018-01-08optimization and some cleanup; mostly from kshe (except the unmap() part)Otto Moerbeek
2018-01-01Only init chunk_info once, plus some moving of code to group related functions.Otto Moerbeek
2017-12-27step one in avoiding unneccesary init of chunk_info;Otto Moerbeek
some cleanup; tested by sthen@ on a ports build
2017-12-24Fix one possible buffer overflow and one underflow. Also some minorTodd C. Miller
cleanups. From Jan Kokemueller. OK deraadt@
2017-12-16Move __cxa_thread_atexit* to its own .c file to avoid pulling the codePhilip Guenther
(w/ _dlctl reference) into static executables. It's all Mark's code so put his preferred copyright on it. ok kettenis@
2017-12-05Remove DEF_STRONG(__cxa_thread_atexit_impl). This produces an unwantedMark Kettenis
_libc___cxa_thread_atexit_impl reference on gcc architectures that breaks the build.
2017-12-05Implement __cxa_thread_atexit to support C++11 thread_local scope. TheMark Kettenis
interface is also made available as __cxa_thread_atexit_impl to satisfy the needs of GNU libstdc++. ok guenther@, millert@
2017-11-28GNU ld has prefixed the contents of .gnu.warning.SYMBOL sectionsTheo Buehler
with "warning: " since 2003, so the messages themselves need not contain the prefix anymore. From Scott Cheloha ok jca, deraadt
2017-11-02's' should include 'f'; from Jacqueline JolicoeurOtto Moerbeek
2017-10-19Restore a return that was inadvertently removed from freezero() in r1.234,Joel Sing
which results in an internal double free when internal functions are not in use. ok otto@
2017-10-05do not return f() where f is a void function; loop var type fixOtto Moerbeek
2017-10-05Use dprintf instead of snprintf/writeOtto Moerbeek
2017-09-23Make delayed free non-optional and make F do an extensive double free check.Otto Moerbeek
ok tb@ tedu@
2017-09-12mapalign returns MAP_FAILED for failuer; from George KoehlerOtto Moerbeek
2017-09-11check double free before canary for chunks; ok millert@Otto Moerbeek
2017-08-20two MALLOC_STATS only tweaks; one from David CARLIER, the other found by clangOtto Moerbeek
2017-08-12Minimize #includes, particularly to avoid thread_private.hPhilip Guenther
ok tedu@
2017-08-01add missing and correct misspelled names, most in NAME sections;Ingo Schwarze
found with regress/usr.bin/mandoc/db/dbm_dump; OK jmc@
2017-07-10one more instance of the previous commit; also initialize ->offset to aOtto Moerbeek
definite value in the size == 0 case
2017-07-07Only access offset if canaries are enabled *and* size > 0, otherwise offsetOtto Moerbeek
is not initialized. Problem spotted by Carlin Bingham; ok phessler@ tedu@
2017-07-06The 0x (or 0X) prefix in base 16 is optional so only skip over theTodd C. Miller
prefix if the character following it is a valid hex char. The C99 standard is clear that given the string "0xy" zero should be returned and endptr set to point to the "x". OK deraadt@ espie@
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-30Don't fall back to heapsort() if we would otherwise switch toTodd C. Miller
insertion sort (when the number of elements is < 7).
2017-05-24Support swapping 32-bit aligned elements on 64-bit platforms.Todd C. Miller
Previously they would be swapped a byte at a time when sizeof(int) != sizeof(long). Idea from FreeBSD.
2017-05-20Document that qsort falls back to heapsort() if the recursion depthTodd C. Miller
exceeds 2 lg N and add a reference to the introsort paper.
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-05-17The BSD qsort() performs tail recursion elimination on the secondTodd C. Miller
side of the array being partitioned to save on stack space. Greater savings can be gained by choosing recursion for the smaller side of the partition and eliminating recursion for the larger side. This also results in a small but measurable performance gain. OK otto@ schwarze@
2017-05-15Typo: freezeo -> freezeroTheo Buehler
From "fenderq" on freenode via tj@
2017-05-13- fix bug wrt posix_memalign(3) of blocks between half a page and a pageOtto Moerbeek
- document posix_memalign() does not play nice with reacallocarray(3) and freezero(3)
2017-04-23Rearrange text a bit to make it clear what "discarded" means; ok jmc@ deraadt@Otto Moerbeek
2017-04-22For small allocations (chunk) freezero only validates the givenOtto Moerbeek
size if canaries are enabled. In that case we have the exact requested size of the allocation. But we can at least check the given size against the chunk size if C is not enabled. Plus add some braces so my brain doesn't have to scan for dangling else problems when I see this code.
2017-04-18don't forget to fill in canary bytes for posix_memalign(3); reported byOtto Moerbeek
and ok jeremy@
2017-04-17consictently use .Dv NULL and a few other tweaks; ok schwarze@Otto Moerbeek
2017-04-17whitespace fixesOtto Moerbeek
2017-04-13allow clearing less than allocated and document freezero(3) betterOtto Moerbeek
2017-04-10tweak previous;Jason McIntyre
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-04-06Consistentcy between nmembers and size order. From Christopher Hettrick;Otto Moerbeek
ok deraadt@
2017-04-06first print size in meta-data then supplied arg size when an inconsistency isOtto Moerbeek
detected wrt recallocarray()
2017-03-29rephrase more enumerations of functionsOtto Moerbeek
2017-03-28small cleanup & optimization; ok deraadt@ millert@Otto Moerbeek
2017-03-26Stop enumeration all allocation functions, just say "allocation functions"Otto Moerbeek
ok jmc@ deraadt@
2017-03-24add a helper function to print all pools #ifdef MALLOC_STATSOtto Moerbeek
from David CARLIER
2017-03-24document new recallocarray diagnostic; zap a few diagnostics that shouldOtto Moerbeek
never occur
2017-03-24move recallocarray to malloc.c andOtto Moerbeek
- use internal meta-data to do more consistency checking (especially with option C) - use cheap free if possible ok deraadt@
2017-03-17remove unneccessary macro;Jason McIntyre
2017-03-17Strengthen description of recallocarray(3) behaviour, hoping that readersTheo de Raadt
make the behaviour -> use case connection. help from jmc and jsing
2017-03-07Some tweaks from jmc@ and describe better what recallocarray does;Otto Moerbeek
help and ok from tom@ and deraadt@