summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
AgeCommit message (Collapse)Author
2014-12-16typo; ok deraadtStuart Henderson
2014-12-16warn for correct symbolTheo de Raadt
2014-12-09Xr and Ox fixes;Jason McIntyre
2014-12-09random seed buffer must be unsignedTheo de Raadt
2014-12-09fix NAME;Jason McIntyre
2014-12-09improve warnings from rand_r(), rand(), and random()Theo de Raadt
It may take a few iterations to get the tone right. previously discussed with millert
2014-12-09more standardsier: cast to int to make sure we keep the negative numbers.Ted Unangst
observed by jonas termansen
2014-12-08Oops, got the sense of the test backwards. Hilarious that we didn't spot it.Theo de Raadt
2014-12-08Change rand(), random(), drand48(), lrand48(), mrand48(), and srand48()Theo de Raadt
to returning strong random by default, source from arc4random(3). Parameters to the seeding functions are ignored, and the subsystems remain in strong random mode. If you wish the standardized deterministic mode, call srand_deterministic(), srandom_determistic(), srand48_deterministic(), seed48_deterministic() or lcong48_deterministic() instead. The re-entrant functions rand_r(), erand48(), nrand48(), jrand48() are unaffected by this change and remain in deterministic mode (for now). Verified as a good roadmap forward by auditing 8800 pieces of software. Roughly 60 pieces of software will need adaptation to request the deterministic mode. Violates POSIX and C89, which violate best practice in this century. ok guenther tedu millert
2014-12-08remove cfree from documentationTed Unangst
2014-12-08delete obsolete sunos cfree function. ok deraadt millert naddyTed Unangst
2014-12-08avoid left shift overflow in reallocarray.Brent Cook
Some 64-bit platforms (e.g. Windows 64) have a 32-bit long. So, shifting 1UL 32-bits to the left causes an overflow. This replaces the constant 1UL with (size_t)1 so that we get the correct constant size for the platform. discussed with tedu@ & deraadt@
2014-12-06malloc(3) is in the "comp" install set, malloc.conf(5) in "man",Ingo Schwarze
breaking the hardlink between file system entries, confusing apropos(1). Split malloc.conf(5) out of malloc(3) as suggested by deraadt@. Feedback and OK jmc@, OK deraadt@ tedu@ jasper@.
2014-11-30Replace all 14 instances of .St -ansiC-99 in our tree with .St -isoC-99.Ingo Schwarze
The former is not used anywhere in NetBSD, FreeBSD, or DragonFly and not supported by groff, so i'm going to delete it from mandoc(1). We don't need two macros for the same thing.
2014-11-30obvious STANDARDS updateIngo Schwarze
2014-11-25rand() is a pseudo-random number generatorTodd C. Miller
2014-11-25Don't describe random() as "better".Todd C. Miller
Remove the bug about rand() being faster. Add a bug about historical implementations seeding very poorly.
2014-11-25Warn people to use arc4random() in DESCRIPTION so they see it usingTodd C. Miller
the same text from random.3.
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@