summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
AgeCommit message (Collapse)Author
2020-11-23mapalign() only handles allocations >= a page; problem found by and ok semarie@Otto Moerbeek
2020-10-12make fixed-sized fixed-value mib[] arrays be constTheo de Raadt
ok guenther tb millert
2020-10-09As noted by tb@ previous commit only removed an unused fucntion.Otto Moerbeek
So redo previous commit properly: Use random value for canary bytes; ok tb@.
2020-10-06Use random value for canary bytes; ok tb@Otto Moerbeek
2020-09-06For page-sized and larger allocations do not put the pages we'reOtto Moerbeek
shaving off into the cache but unamp them. Pages in the cache get re-used and then a future grow of the first allocation will be hampered. Also make realloc a no-op for small shrinkage. ok deraadt@
2020-05-27This patch fixes one bug and one instance of undesirable behaviour.Ingo Schwarze
The bug, present since 4.4BSD, was that a trailing dash in an option group, when the dash is not permitted as an option letter, resulted in the whole option group being returned as an argument, even though the previous option in the group was already parsed as an option: OPTS=abc ./getopt-test -a- -c arg ===>> OPT(a)ARG(-a-)ARG(-c)ARG(arg). Instead, treat the dash as an invalid option and continue parsing options: ===>> OPT(a)ERR(?-)OPT(c)ARG(arg). The undesirable behaviour was that allowing the dash as an option letter only allowed isolated dashes ("-") and trailing dashes in groups ("-a-"), but neither middle dashes in groups ("-a-b"), even though that already partially worked in 4.4BSD, nor leading dashes in groups ("--a"), even though that works on all other BSDs and on glibc. Also, while POSIX does not require that the dash can be used as an option letter at all, arguably, it encourages that letters either be fully supported or not supported at all. It is dubious whether supporting an option letter in some positions but not in others can be considered conforming. This patch makes OpenBSD behaviour identical to FreeBSD and NetBSD, improves compatibility with glibc (except that glibc does not support isolated "-"), improves compatibility with DragonFly (except that DragonFly is buggy when the dash option letter can take an optional argument but that argument is not present), improves compatibility with Illumos and Solaris 11 (except those do not support "-" and mishandle "--a"), and restores 4.4BSD behaviour for "-a-b". In no respect i'm aware of is compatibility with any other systems reduced. For the full rationale, see my mail to tech@ on 30 Mar 2020 14:26:41 +0200. Part of the problem was originally reported by an anonymous coward on tech@ on 12 Mar 2020 03:40:24 +0200, additional analysis was contributed by martijn@, and then the OP sent the final version of the patch i'm now committing on 17 Mar 2020 19:17:56 +0200. No licensing problem here because after the commit, the file does not contain a single word written by the OP. Also, the OP told me in private mail that he intends to publish the patch under the ISC license already contained in the file and that he wishes to be known by the pseudonym "0xef967c36". OK martijn@, and no objection when shown on tech@, but commit delayed to stay clear of the release.
2020-04-26Minimal maintenance to make this mess slightly less confusing:Ingo Schwarze
queue -> list; mention "intrusive"; element -> member at one place; delete a bogus remark that maybe referred to a long-gone implementation in VAX assembly code. Much more could be improved, but i don't want to waste too much time here.
2020-04-26fix the description; from andras farkasJason McIntyre
ok schwarze kill a Tn while here...
2020-03-30"eventually" came and went back in 2004.Martijn van Duren
OK schwarze@
2020-02-08correct Research Unix edition "appeared in" use in HISTORYJonathan Gray
Starting from "Combined Table of Contents" in Doug McIlroy's "A Research UNIX Reader" a table of which edition manuals appeared in. Checked against manuals from bitsavers/TUHS and source from TUHS where available. Ingo points out there are cases where something is included but not documented until a later release. bcd(6) v6 v7 printf(3) v2 v4 abort(3) v5 v6 system(3) v6 v7 fmod(3) v5 v6 ok schwarze@
2020-01-13Document how to make getopt_long(3) process arguments in order and stopStefan Sperling
at the first non-option argument. I had to read source code to figure it out.
2019-12-20drand48(3) returns values in [0.0, 1.0).Theo Buehler
From j@bitminer.ca with input from Andras Farkas, deraadt, joerg@netbsd "fix however you feel best!" jmc
2019-12-11The file passed to realpath(3) must exists, adjust man page to newAlexander Bluhm
behavior. noticed by hshoexer@; OK beck@
2019-09-14Add comment line saying S is described vaguely on purpose.Otto Moerbeek
Prompted by guenther@
2019-07-05improve verb-tense for explaining the calling convention of __Theo de Raadt
ok guenther jmc
2019-07-05The last consumer of pre-posix realpath behaviour has stoppedTheo de Raadt
requiring it (sftp-server). Remove the /exists///// behaviour from here. The /nonexistant behaviour remains in the kernel and needs to be shot next. There may be ports fallout, but we doubt it. ok beck djm
2019-06-30tweak previous; ok guentherJason McIntyre
2019-06-29Document that getcwd() and realpath() are built on system calls thatPhilip Guenther
have a different calling convention than the standard function...as seen in kdump output. ok deraadt@ schwarze@
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-06-27The C89 standard only requires that atexit(3) returns a non-zero valueIngo Schwarze
on error, so checking for -1 only is potentially non-portable. Also mention that the C89 standard does not require errno to be set. OK deraadt@ millert@
2019-06-17Remove old realpath(3), and the userland-vs-kernel realpath verificationTheo de Raadt
code. We now user the simple userland wrapper on top of __realpath(2). The non-POSIX behaviour still remains, that is the next component to fix. From a diff by beck, but I managed to chainsaw it a bit further. Tested in snaps for a couple of days. ok beck
2019-06-15oops - missing .El in previous;Jason McIntyre
2019-06-15realpath(3) doesn't use lstat(2), readlink(2), or getcwd(3) anymore,Theo de Raadt
it is a thin wrapper over the syscall __readlink(2). Improve the list of possible errors. ok millert beck jmc
2019-06-02Complete the ld.so boot cleanup: move most libc initialization fromPhilip Guenther
_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@
2019-05-30__realpath(2) appears to have improved, so re-enable the code thatTheo de Raadt
checks userland-parsing vs kernel parsing, we are hoping to spot another bug..
2019-05-29There are some bugs in __realpath(2) -- it isn't quite ready so disableTheo de Raadt
calling it until those are fixed.
2019-05-28Enable the use of the kernel __realpath() system call in the libc wrapper.Bob Beck
For now, this also still uses the existing realpath implmentation and emits a syslog if we see differening results. Once we have run with that for a little while we will remove the old code ok deraadt@
2019-05-23Only override size of chunk if we're not given the actual length.Otto Moerbeek
Fixes malloc_conceal...freezero with malloc options C and/or G.
2019-05-19clarify that later flags modify earlier flags;Ingo Schwarze
triggered by a question from Jan Stary <hans at stare dot cz> on misc@; OK otto@
2019-05-15delete two stray blank linesIngo Schwarze
2019-05-13Mention introduction of *_conceal.Otto Moerbeek
2019-05-10Inroduce malloc_conceal() and calloc_conceal(). Similar to theirOtto Moerbeek
counterparts but return memory in pages marked MAP_CONCEAL and on free() freezero() is actually called.
2019-03-20escape backslashes;Ingo Schwarze
patch from Peter Piwowarski <peterjpiwowarski at gmail dot com>
2019-01-25I am retiring my old email address; replace it with my OpenBSD one.Todd C. Miller
2019-01-22sort sections, and add a missing verb to the EXAMPLES text;Jason McIntyre
2019-01-22Wrap long lineOtto Moerbeek
2019-01-21a few tweaksTed Unangst
2019-01-21Add example showing a proper comparison function, as many examples showOtto Moerbeek
the wrong idiom. ok tedu@ but probably needs some tweakin
2019-01-18Replace the vague, incorrect, and confusing BUGS sections with CAVEATSIngo Schwarze
clearly stating which arguments have to be avoided, and mention the header files defining the constants required for the checks. Feedback and OK guenther@, OK bluhm@.
2019-01-16For all functions known to be infected by LC_NUMERIC, add shortIngo Schwarze
CAVEATS pointing to the new CAVEATS section in setlocale(3). Make those in wprintf(3) and wscanf(3) more concise since duplicate information is a bad idea. Incompleteness of information originally pointed out by millert@. OK millert@
2019-01-10Move default numer of pools in the multi-threaded case to 8. Various testsOtto Moerbeek
by me and others indicate that it is the optimum.
2019-01-10Make the "not my pool" searching loop a tiny bit smarter, whileOtto Moerbeek
making the number of pools variable. Do not document the malloc conf settings atm, don't know yet if they will stay. Thanks to all the testers. ok deraadt@
2018-12-10Improve speed for the multi-threaded case by reducing lock contention.Otto Moerbeek
tested by many; ok florian@
2018-12-09style; OK ottoFlorian Obser
2018-12-05remove a stray line accidentally left behind in rev. 1.120;Ingo Schwarze
patch from Hiltjo Posthuma <hiltjo at codemadness dot org>
2018-11-27Refactor "find the right pool" code into a function. ok djm@ tb@Otto Moerbeek
2018-11-21fold the contents of malloc.conf.5 into malloc.3 and sysctl.2,Jason McIntyre
now that there is essentially no malloc.conf; text tweaked by deraadt; ok otto deraadt
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-19Fix compilation on alpha, where DEF_WEAK() really must be paired withPhilip Guenther
PROTO_NORMAL(). Problem noted by deraadt@
2018-11-18Implement malloc_usable_size(); ok millert@ deraadt@ and jmc@ for the man pageOtto Moerbeek