Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | on malloc flag S, set cache size to 0; will catch even more | otto | 2011-07-12 | 1 | -2/+6 | |
| | | | | use-after-free bugs; ok krw@ dlg@ pirofti@ | |||||
* | as man page states, lower case undoes upper case. add support for little s, | tedu | 2011-06-20 | 1 | -1/+5 | |
| | | | | | no security, for consistency. use of this option is discouraged. :) ok deraadt guenther millert | |||||
* | save errno dance in wrterror() and malloc_dump(); prompted by and ok deraadt@ | otto | 2011-05-20 | 1 | -2/+6 | |
| | ||||||
* | introduce symbolic constant for initial number of regions | otto | 2011-05-18 | 1 | -2/+3 | |
| | ||||||
* | zap regions_bits and rework MALLOC_MAXSHIFT a bit; ok djm@ | otto | 2011-05-18 | 1 | -14/+8 | |
| | ||||||
* | Avoid fp computations for stats, this make calling malloc_dump() safe in more | otto | 2011-05-12 | 1 | -10/+7 | |
| | | | | cases. | |||||
* | fix comment, the bitmap is an array of u_short now | otto | 2011-05-12 | 1 | -2/+2 | |
| | ||||||
* | Introduce leak detection code for MALLOC_STATS | otto | 2011-05-12 | 1 | -25/+165 | |
| | ||||||
* | Move MALLOC_STATS code to bottom of file, so the real stuff is more at the top. | otto | 2011-05-08 | 1 | -137/+141 | |
| | ||||||
* | Up until now, malloc scanned the bits of the chunk bitmap from | otto | 2011-05-05 | 1 | -32/+24 | |
| | | | | | | | | | | | | | | | | | | position zero, skipping a random number of free slots and then picking the next free one. This slowed things down, especially if the number of full slots increases. This changes the scannning to start at a random position in the bitmap and then taking the first available free slot, wrapping if the end of the bitmap is reached. Of course we'll still scan more if the bitmap becomes more full, but the extra iterations skipping free slots and then some full slots are avoided. The random number is derived from a global, which is incremented by a few random bits every time a chunk is needed (with a small optimization if only one free slot is left). Thanks to the testers! | |||||
* | Now that we use an array of u_short for the chunk bitmap change a few | otto | 2011-04-30 | 1 | -5/+5 | |
| | | | | 1UL to 1U. | |||||
* | More efficient scanning for free chunks while not losing any randomization; | otto | 2011-04-30 | 1 | -21/+25 | |
| | | | | thanks to all testers. | |||||
* | avoid pointer arithmetic on void * | dhill | 2010-12-16 | 1 | -5/+5 | |
| | | | | | | tested for a while by me. ok otto@ | |||||
* | print the pointer value that caused the error (if available); ok | otto | 2010-10-21 | 1 | -47/+54 | |
| | | | | deraadt@ nicm@ (on an earlier version) | |||||
* | add posix_madvise, posix_memalign, strndup, and strnlen. mostly from | tedu | 2010-05-18 | 1 | -1/+26 | |
| | | | | | brad and millert, with hints from guenther, jmc, and otto I think. ok previous. | |||||
* | New options 'S', as a shorthand for the options most suitable as an | otto | 2010-01-13 | 1 | -1/+5 | |
| | | | | extra safeguard (FGJ). Idea from deraadt@; ok deraadt@ dlg@ | |||||
* | save calls to arc4random() by using a nibble at a time; not because | otto | 2009-12-16 | 1 | -24/+27 | |
| | | | | | arc4random() is slow, but it induces getpid() calls; also saves a bit on stirring efforts | |||||
* | Make userland malloc use __LDPGSZ granularity on mips, regardless of the | miod | 2009-12-07 | 1 | -1/+3 | |
| | | | | actual kernel page size. | |||||
* | Switch the chunk_info lists to doubly-linked lists and use the queue | otto | 2009-11-27 | 1 | -51/+34 | |
| | | | | | | macros for them. Avoids walking the lists and greatly enhances speed of freeing chunks in reverse or random order at the cost of a little space. Suggested by Fabien Romano and Jonathan Armani; ok djm@ | |||||
* | Don't forget to fill region from the cache with junk if needed in one case; | otto | 2009-11-27 | 1 | -1/+3 | |
| | | | | from Fabien Romano and Jonathan Armani | |||||
* | No need to clear a mmapped region; from Fabien Romano and Jonathan | otto | 2009-11-27 | 1 | -2/+1 | |
| | | | | Armani | |||||
* | permit -DMALLOC_STATS to compile again | todd | 2009-11-02 | 1 | -2/+2 | |
| | | | | | noticed by Jonathan Armani & Fabien Romano ugh+ok otto@ | |||||
* | Check mmap return value against MAP_FAILED not NULL. | pirofti | 2009-10-20 | 1 | -2/+2 | |
| | | | | Okay deraadt@, otto@. | |||||
* | quieten compiler by converting pointers to uintptr_t before truncating them | deraadt | 2009-06-08 | 1 | -5/+5 | |
| | | | | | to u_int32_t to do integer math with (in a situation where that is legit) ok otto millert | |||||
* | reintroduce extra malloc protections, but avoiding the use of | djm | 2009-01-03 | 1 | -164/+229 | |
| | | | | | | PAGE_(SIZE|SHIFT|MASK) defines that evaluate to variables on the sparc architecture; ok otto@ tested on my reanimated ss20 | |||||
* | PAGE_SIZE is not a valid symbol to use in that way. In particular, | deraadt | 2008-12-31 | 1 | -235/+164 | |
| | | | | | | | on sparc, it expands to something that just plain does not work, because the page size can be variable. Sorry we didn't spot this before. Backing it all out to allow sparc to build; please find a different way to fix it. | |||||
* | Remove mprotecting of struct dir_info introduced in previous commit | djm | 2008-12-30 | 1 | -37/+2 | |
| | | | | | | | (MALLOC_OPTIONS=L). It was too slow to turn on by default, and we don't do optional security. requested by deraadt@ grumbling ok otto@ | |||||
* | extra paranoia for malloc(3): | djm | 2008-12-29 | 1 | -163/+269 | |
| | | | | | | | | | | | | | | | | Move all runtime options into a structure that is made read-only (via mprotect) after initialisation to protect against attacks that overwrite options to turn off malloc protections (e.g. use-after-free) Allocate the main bookkeeping data (struct dir_info) using mmap(), thereby giving it an unpredictable address. Place a PROT_NONE guard page on either side to further frustrate attacks on it. Add a new 'L' option that maps struct dir_info PROT_NONE except when in the allocator code itself. Makes attacks on it basically impossible. feedback tedu deraadt otto canacar ok otto | |||||
* | shave off more bytes than you expect by declaring a few const local arrays | otto | 2008-12-15 | 1 | -4/+4 | |
| | | | | as static const | |||||
* | move allocations between half a page and a page as close to the end of | otto | 2008-11-20 | 1 | -2/+2 | |
| | | | | | the page as possible (i.e. make malloc option P a default). ok art@ millert@ krw@ | |||||
* | Reduce the leeway malloc allows when moving allocations to the end of | otto | 2008-11-20 | 1 | -2/+2 | |
| | | | | | a page to 0. P default will be changed in a separate commit. ok millert@ art@ krw@ | |||||
* | To allow for easier playing with more strict settings introduce | otto | 2008-11-13 | 1 | -5/+14 | |
| | | | | | a separate symbolic constant for the leeway we allow when moving allocations towards the end of a page. No functional change. | |||||
* | avoid a few strlen calls for constant strings; prompted by tg; ok djm@ | otto | 2008-11-12 | 1 | -10/+10 | |
| | ||||||
* | if the freeprot flag (F) is set, do not do delayed frees for chunks | otto | 2008-11-06 | 1 | -6/+10 | |
| | | | | | | (might catch errors closer to the trouble spot) and junk fill pages just before reuse instead of immediate (we can't access the page anyway) since we set PROT_NONE in the F case. ok djm@ | |||||
* | remove distinction between warnings and errors, ok deraadt@ djm@ | otto | 2008-11-02 | 1 | -47/+20 | |
| | ||||||
* | if MALLOC_STATS is defined, record how many "cheap reallocs" were | otto | 2008-10-29 | 1 | -1/+8 | |
| | | | | tried and how many actually succeeded. | |||||
* | oops, assign errno the right way. caught by david running regress tests | otto | 2008-10-20 | 1 | -2/+2 | |
| | ||||||
* | reduce rbyte cache to 512 bytes, no measurable slowdown (even in the | otto | 2008-10-03 | 1 | -2/+2 | |
| | | | | threaded case) but much smaller working set; prompted by and ok deraadt@ | |||||
* | save and restore errno on success. while it is not stricly needed for | otto | 2008-10-03 | 1 | -4/+14 | |
| | | | | | non-syscalls, there's just too much code not doing the right thing on error paths; prompted by and ok deraadt@ | |||||
* | when increasing the size of a larger than a page allocation try | otto | 2008-10-03 | 1 | -3/+41 | |
| | | | | | mapping the region next to the existing one first; there's a pretty high chance there's a hole there we can use; ok deraadt@ tedu@ | |||||
* | avoid spitting up regions when purging stuff from the cache, it puts | otto | 2008-10-03 | 1 | -17/+10 | |
| | | | | too much pressure on the amaps. ok tedu@ deraadt@ | |||||
* | Make all combinations of G, P, J and zero-fill work with as little | otto | 2008-08-25 | 1 | -5/+20 | |
| | | | | effort as possible in most cases; ok djm@ | |||||
* | unbreak MALLOC_OPTIONS=G that I broke in my last commit; | djm | 2008-08-23 | 1 | -3/+3 | |
| | | | | slightly kludgey solution for until otto fixes it properly; ok otto@ | |||||
* | fix calloc() for MALLOC_OPTIONS=J case: SOME_JUNK was being filled into | djm | 2008-08-23 | 1 | -2/+2 | |
| | | | | | the freshly mmaped pages disrupting their pure zeroness; ok otto@ deraadt@ | |||||
* | make sure we always map and unmap multiples of MALLOC_PAGESIZE; | otto | 2008-08-22 | 1 | -5/+14 | |
| | | | | case spotted by beck, one by me; ok deraadt@ beck@ | |||||
* | Smarter implementation of calloc(3), which uses the fact that mmap(2) | otto | 2008-08-22 | 1 | -6/+55 | |
| | | | | | returns zero filled pages; remember to replace this function as well if you provide your own malloc implementation; ok djm@ deraadt@ | |||||
* | small cleanup of error/warning strings | otto | 2008-08-07 | 1 | -4/+4 | |
| | ||||||
* | Almost complete rewrite of malloc, to have a more efficient data | otto | 2008-07-28 | 1 | -1443/+835 | |
| | | | | | | structure of tracking pages returned by mmap(). Lots of testing by lots of people, thanks to you all. ok djm@ (for a slighly earlier version) deraadt@ | |||||
* | remove _MALLOC_LOCK_INIT; major bump; ok deraadt@ | otto | 2008-06-13 | 1 | -3/+1 | |
| | ||||||
* | remove recalloc(3); it is buggy and impossible to repair without big | otto | 2008-05-19 | 1 | -35/+15 | |
| | | | | costs; ok jmc@ for the man page bits; ok millert@ deraadt@ |