diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-04-02 17:57:15 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-04-02 17:57:15 -0400 |
commit | 5446303328adf4b4e36d9fba21848e6feb55fab4 (patch) | |
tree | bb513d417244a07c5699018e17e341be41ca8c1f /src/search/hsearch.c | |
parent | 91d5aa06572d2660122f9a06ed242fef0383f292 (diff) | |
download | musl-5446303328adf4b4e36d9fba21848e6feb55fab4.tar.gz musl-5446303328adf4b4e36d9fba21848e6feb55fab4.tar.bz2 musl-5446303328adf4b4e36d9fba21848e6feb55fab4.tar.xz musl-5446303328adf4b4e36d9fba21848e6feb55fab4.zip |
avoid malloc failure for small requests when brk can't be extended
this issue mainly affects PIE binaries and execution of programs via
direct invocation of the dynamic linker binary: depending on kernel
behavior, in these cases the initial brk may be placed at at location
where it cannot be extended, due to conflicting adjacent maps.
when brk fails, mmap is used instead to expand the heap. in order to
avoid expensive bookkeeping for managing fragmentation by merging
these new heap regions, the minimum size for new heap regions
increases exponentially in the number of regions. this limits the
number of regions, and thereby the number of fixed fragmentation
points, to a quantity which is logarithmic with respect to the size of
virtual address space and thus negligible. the exponential growth is
tuned so as to avoid expanding the heap by more than approximately 50%
of its current total size.
Diffstat (limited to 'src/search/hsearch.c')
0 files changed, 0 insertions, 0 deletions