Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | a small tweak to improve malloc in multithreaded programs. we don't need | tedu | 2014-08-18 | 1 | -7/+21 |
| | | | | | | | 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. | ||||
* | reduce obvious dependency on global g_pool by moving to local aliases | tedu | 2014-07-09 | 1 | -42/+48 |
| | | | | ok otto | ||||
* | extra evil spaces snuck in over the last while | deraadt | 2014-06-27 | 1 | -20/+20 |
| | |||||
* | Move to a smaller rbytes buffer and skip a random part. Not to | otto | 2014-06-27 | 1 | -3/+4 |
| | | | | | | 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@ | ||||
* | move random bytes buffer to be part of mmaped pages; ok tedu@ | otto | 2014-06-02 | 1 | -21/+18 |
| | |||||
* | move all stats collecting under MALLOC_STATS; ok krw@ | otto | 2014-05-26 | 1 | -28/+33 |
| | |||||
* | fix MALLOC_STATS (not compiled in by default); ok tedu@ | otto | 2014-05-21 | 1 | -18/+19 |
| | |||||
* | factor out a bit of the chunk index code and use it to make sure that a | tedu | 2014-05-18 | 1 | -14/+33 |
| | | | | | freed chunk is actually freeable immediately. catch more errors. hints/ok otto | ||||
* | change to having four freelists per size, to reduce another source of | tedu | 2014-05-12 | 1 | -16/+20 |
| | | | | | deterministic behavior. four selected because it's more than three, less than five. i.e., no particular reason. | ||||
* | fix MALLOC_STATS code that was broken in rev 1.159, not compiled in by default | otto | 2014-05-10 | 1 | -2/+2 |
| | |||||
* | move reallocarray() to a seperate file so that -portable applications | deraadt | 2014-05-08 | 1 | -12/+1 |
| | | | | | can avoid reinventing the wheel ok guenther schwarze | ||||
* | comment style fix | halex | 2014-05-07 | 1 | -2/+3 |
| | | | | ok crickets@ | ||||
* | nibbles aren't enough random, use bytes. does a better job of picking | tedu | 2014-05-01 | 1 | -14/+14 |
| | | | | | a free chunk at random and may allow to increase delayed chunk array. ok otto | ||||
* | remove Z option and default to something halfway to J. | tedu | 2014-04-23 | 1 | -32/+22 |
| | | | | | | | 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 | ||||
* | explain a bit more what's going on for stupid me. | espie | 2014-04-23 | 1 | -1/+4 |
| | | | | okay otto@ | ||||
* | Better, cleaner hash function that computes the same on be and le archs. | otto | 2014-04-23 | 1 | -10/+8 |
| | | | | Should improve sparc64 and other be archs. ok matthew@ miod@ | ||||
* | change mallocarray to reallocarray. useful in a few more situations. | tedu | 2014-04-22 | 1 | -3/+3 |
| | | | | | malloc can, as always, be emulated via realloc(NULL). ok deraadt | ||||
* | Introducing: void *mallocarray(size_t nmemb, size_t size); | deraadt | 2014-04-21 | 1 | -1/+12 |
| | | | | | Like calloc(), except without the cleared-memory gaurantee ok beck guenther, discussed for more than a year... | ||||
* | print pid in error messages; ok reyk@ | otto | 2014-04-14 | 1 | -14/+18 |
| | |||||
* | Update Copyright notice; ok otto@ beck@ deraadt@. | schwarze | 2014-04-03 | 1 | -2/+4 |
| | | | | | This is merely a by-product of figuring out the amount of phk@ code contained herein; i'm not planning to hack on this file. | ||||
* | Poul-Henning Kamp informed me he is allright with this licensing change. | beck | 2014-03-25 | 1 | -11/+4 |
| | |||||
* | avoid arithetic on void * | deraadt | 2013-11-12 | 1 | -4/+4 |
| | | | | ok guenther otto | ||||
* | Fix bug in random offset introduced in rev 1.143; random range was | otto | 2012-12-22 | 1 | -3/+3 |
| | | | | expanded, but not enough due to precedence error. Spotted by Thorsten Glaser. | ||||
* | Add a new malloc option 'U' => "Free unmap" that does the guarding/ | djm | 2012-11-02 | 1 | -15/+24 |
| | | | | | | | | | | | | unmapping of freed allocations without disabling chunk randomisation like the "Freeguard" ('F') option does. Make security 'S' option use 'U' and not 'F'. Rationale: guarding with no chunk randomisation is great for debugging use-after-free, but chunk randomisation offers better defence against "heap feng shui" style attacks that depend on carefully constructing a particular heap layout so we should leave this enabled when requesting security options. | ||||
* | Fix precedence bug (& has lower precedence than !=). | pirofti | 2012-09-13 | 1 | -2/+2 |
| | | | | | | Okay otto@. Found by Michal Mazurek <akfaew at jasminek dot net>, thanks! | ||||
* | use PAGE_SHIFT instead of PGSHIFT, in preperation for future | deraadt | 2012-07-09 | 1 | -2/+2 |
| | | | | | param.h symbol reduction. ok guenther | ||||
* | after a talk with ariane, use MAP_FIXED for mquery to avoid the cost of | tedu | 2012-06-26 | 1 | -2/+2 |
| | | | | | | scanning for free space if the hint isn't available. also, on further inspection, this will prevent pmap_prefer from "improving" our hint. | ||||
* | two changes which should improve realloc. first, fix zapcacheregion to | tedu | 2012-06-22 | 1 | -10/+19 |
| | | | | | | clear out the entire requested area, not just a perfect fit. second, use mquery to check for room to avoid getting an address we don't like and having to send it back. | ||||
* | two small fixes to free page cache. first, we need two nibbles of random | tedu | 2012-06-20 | 1 | -4/+4 |
| | | | | | | in order to span the the entire cache. second, on free use the same offset to put things in the cache instead of always starting at zero. ok otto | ||||
* | Support larger-than-page-alignment requests in posix_memalign() by | matthew | 2012-06-18 | 1 | -19/+128 |
| | | | | | | overallocating and then releasing unneeded memory pages. ok otto | ||||
* | - Test for the retrieved page address not being NULL. This turns free((void*)1) | otto | 2012-02-29 | 1 | -2/+7 |
| | | | | | | into an bogus pointer error instead of a segfault. - Document that we use the assumption that a non-MAP_FIXED mmap() with hint 0 never returns NULL. | ||||
* | Make struct chunk_info a variable sized struct, wasting less | otto | 2011-10-06 | 1 | -28/+55 |
| | | | | | space for meta data by only allocating space actually needed for the bitmap (modulo alignment requirements). ok deraadt@ | ||||
* | 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. |