summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
AgeCommit message (Collapse)Author
2014-11-20Document behavior of atexit() when called in a DSO that is later unloaded.Philip Guenther
Would be nice to document when/where this originated (in glibc?) if anyone knows... tweaks by schwarze@ ok jmc@ espie@ kettenis@ schwarze@ dimitry(at)google.com
2014-11-15Reduce instances of `` '' in manuals.Anthony J. Bentley
troff displays these as typographic quotes, but nroff implementations almost always print them literally, which rarely has the intended effect with modern fonts, even in stock xterm. These uses of `` '' can be replaced either with more semantic alternatives or with Dq, which prints typographic quotes in a UTF-8 locale (but will automatically fall back to `` '' in an ASCII locale). improvements and ok schwarze@
2014-10-30clean up verbiage around the calculations; ok ingo jmc ottoTheo de Raadt
2014-10-30Don't mention old systems where realloc(NULL, n) didn't work as weTodd C. Miller
don't want to give people the idea that this is non-portable (it has been present since C89). OK deraadt@ schwarze@
2014-10-23Save space in man page: err() -> errc() and combine vars.Doug Hogan
Suggested by millert@ and schwarze@. OK schwarze@, millert@
2014-10-22Avoid writing in second person in malloc.3Doug Hogan
ok deraadt@
2014-10-20List extensions in the STANDARDS section, replacing some text below CAVEATS.Ingo Schwarze
Remove excessive technicalities on zero-sized objects as suggested by deraadt@. contributions and ok deraadt@, ok jmc@ on an earlier version
2014-10-19make RETURN VALUES more conciseIngo Schwarze
and fix two instances of "new sentence, new line" while here feedback and ok jmc@, ok doug@
2014-10-19Revamp malloc.3 by reordering the sections and rewriting parts.Doug Hogan
The old man page had a lot of useful information, but it was all mixed together which made it difficult to reference. The main theme in this commit is that the sections are more focused: * DESCRIPTION describes the overall behavior * RETURN VALUES describes what it may return (including implementation defined values) * EXAMPLES shows why we recently started an audit on malloc and realloc usage in the tree. * Added CAVEATS which describes what is implementation defined, gotchas and security implications of misusing these functions * Added IDIOMS which describes how these functions should or should not be used The MALLOC_OPTIONS section was left unchanged. Function names were added to DIAGNOSTICS and STANDARDS. The MALLOC_OPTIONS and DIAGNOSTICS sections were pushed down in the page so more pertinent information is higher up. This has gone through several revisions thanks to input from deraadt@ and schwarze@. Ingo also helped with some of the mandoc formatting. OK schwarze@ (as far as it is a good starting point and the code snippets look ok)
2014-10-19Revert last commit due to changed semantics found by make release.Doug Hogan
2014-10-18Better POSIX compliance in realpath(3).Doug Hogan
millert@ made changes to realpath.c based on FreeBSD's version. I merged Todd's changes into dl_realpath.c. ok millert@, guenther@
2014-10-13remove unused variableCharles Longeau
ok tedu@
2014-10-08using reallocarray() gives us multiplicative integer overflow checkingTheo de Raadt
in case something wants to create massive amounts of environment, like a bit more than 1/4 of a 32-bit address space. unrealistic -- but why audit one code path, and not treat others the same? then you have to re-engage everytime you see the code. read the news, that isn't what developers do. At least if the code paths look the same, there is hope, because they are easier to verify for correctness. developers need to give other developers a chance to want to care.
2014-09-14Do not claim that empty numbers set EINVAL, our implementation doesn't.Ingo Schwarze
Mention that invalid bases do set EINVAL (as required by POSIX); this part of the change uses part of an earlier patch by millert@. Minor mdoc(7) cleanup and sync between the two pages while here. Feedback and ok jmc@ and millert@.
2014-09-13Make sure that the following functions return 0 and EINVAL asIngo Schwarze
required by the C standard when called with an invalid base: strtoll(), strtoimax(), strtoul(), strtoull(), and strtoumax(). Same behaviour for strtoq() and strtouq() even though not standardized. No functional change in strtol(), it was the only one already correct. While here, simplify the conditional expression for checking the base and sync whitespace and comments among the six files. ok millert@
2014-09-08obvious cases of missing .An;Ingo Schwarze
found with the new mandoc(1) MANDOCERR_AN_MISSING warning; no text changes
2014-08-18a small tweak to improve malloc in multithreaded programs. we don't needTed Unangst
to hold the malloc lock across mmap syscalls in all cases. dropping it allows another thread to access the existing chunk cache if necessary. could be improved to be a bit more aggressive, but i've been testing this simple diff for some time now with good results.
2014-08-15XPG requires insque() and remque() to work with linear lists and not justPhilip Guenther
circular lists. Amazingly, they managed to extend the requirements to no longer match the behavior of the VAX instructions they were modeled after, so the trivial VAX ASM versions have to go. Nice job breaking it, X/Open! Based on a diff from enh (at) google.com ok miod@
2014-08-10Only need <stdint.h> and not all of <inttypes.h> herePhilip Guenther
2014-07-18Remove "const" from the lsearch(3) manual's synopsis too.Matthew Dempsky
Reminded by Rafael Neves
2014-07-18zap trailing whitespace;Jason McIntyre
2014-07-18Change lsearch()'s "base" argument to require a non-const pointer toMatthew Dempsky
align with POSIX and other systems. Pointed out by Elliott Hughes on tech ok deraadt
2014-07-17it is 2014, and we still need to encourage people away from srand()Theo de Raadt
and random(). Sigh.
2014-07-13oops, i deleted the wrong wordTed Unangst
2014-07-13remove a lie spotted by guentherTed Unangst
2014-07-13once srandomdev() is called, switch to using arc4random() but mask off theTed Unangst
high bit as required by posix. wouldn't want to break any standards. idea and ok deraadt
2014-07-11Add locking for __cxa_finalize() as it modifies the page permissions of theMark Kettenis
__atexit tables and touches global variables. From Srinavasa Nagaraju through Android/Elliott Hughes. ok tedu@, guenther@
2014-07-11better document perils of setuid getenv and xr with issetugidTed Unangst
ok deraadt
2014-07-10as noted by google/android via kettenis, atexit handlers can install newTed Unangst
handlers. if this happens, restart the loop. ok kettenis matthew millert miod
2014-07-09reduce obvious dependency on global g_pool by moving to local aliasesTed Unangst
ok otto
2014-06-27extra evil spaces snuck in over the last whileTheo de Raadt
2014-06-27Move to a smaller rbytes buffer and skip a random part. Not toOtto Moerbeek
improve the random stream itself (it doesn't), but to introduce noise in the arc4random calling pattern. Thanks to matthew@ who pointed out bias in a previous diff, ok deraadt@ matthew@
2014-06-18Always call atexit handlers as if they were registered with __cxa_atexit.Mark Kettenis
The extra argument doesn't hurt genuine atexit handlers and this fixes a bug where we didn't provide the argument (effectively passing garbage) for functions registered with __cxa_atexit in the main executable. Pointed out by Dmitriy Ivanov <dimitry@google.com> and Elliott Hughes <enh@google.com>. ok matthew@
2014-06-15oops, typo. James Hartley is fast at trying -currentTheo de Raadt
2014-06-15In srandomdev(), use arc4random_buf() instead of from the kernel.Theo de Raadt
discussion with matthew
2014-06-13use getentropy; from matthewTheo de Raadt
2014-06-12Disable the "switch to insertion sort" optimization to avoid quadraticTodd C. Miller
behavior for certain inputs. From NetBSD. OK tedu@
2014-06-02move random bytes buffer to be part of mmaped pages; ok tedu@Otto Moerbeek
2014-05-26move all stats collecting under MALLOC_STATS; ok krw@Otto Moerbeek
2014-05-21fix MALLOC_STATS (not compiled in by default); ok tedu@Otto Moerbeek
2014-05-18factor out a bit of the chunk index code and use it to make sure that aTed Unangst
freed chunk is actually freeable immediately. catch more errors. hints/ok otto
2014-05-14stop flushing streams in abort(). it's hackish and unsafe, and no longerTed Unangst
required. try to document this fact and some of the history. with feedback from deraadt guenther millert
2014-05-12change to having four freelists per size, to reduce another source ofTed Unangst
deterministic behavior. four selected because it's more than three, less than five. i.e., no particular reason.
2014-05-10fix MALLOC_STATS code that was broken in rev 1.159, not compiled in by defaultOtto Moerbeek
2014-05-08move reallocarray() to a seperate file so that -portable applicationsTheo de Raadt
can avoid reinventing the wheel ok guenther schwarze
2014-05-07comment style fixAlexander Hall
ok crickets@
2014-05-01tweak previous; ok sthenJason McIntyre
2014-05-01nibbles aren't enough random, use bytes. does a better job of pickingTed Unangst
a free chunk at random and may allow to increase delayed chunk array. ok otto
2014-04-30first cut at documenting the change to malloc doing a partial 'junk' byStuart Henderson
default and the new 'j' option to disable this; ok jmc@
2014-04-23remove Z option and default to something halfway to J.Ted Unangst
we always junk small chunks now, and the first part of pages, but only after free. J still does the old thing. j disables everything. Consider experimental as we evaluate performance in the real world. ok otto