mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
malloc: Avoid premature fallback to mmap [BZ #20284]
Before this change, the while loop in reused_arena which avoids returning a corrupt arena would never execute its body if the selected arena were not corrupt. As a result, result == begin after the loop, and the function returns NULL, triggering fallback to mmap.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2016-06-21 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
[BZ #20284]
|
||||||
|
* malloc/arena.c (reused_arena): Do not return NULL if we start
|
||||||
|
out with a non-corrupted arena.
|
||||||
|
|
||||||
2016-06-21 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
2016-06-21 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
|
||||||
* misc/Makefile (tests): Add tst-preadvwritev and tst-preadvwritev64.
|
* misc/Makefile (tests): Add tst-preadvwritev and tst-preadvwritev64.
|
||||||
|
@ -771,14 +771,12 @@ reused_arena (mstate avoid_arena)
|
|||||||
{
|
{
|
||||||
result = result->next;
|
result = result->next;
|
||||||
if (result == begin)
|
if (result == begin)
|
||||||
break;
|
/* We looped around the arena list. We could not find any
|
||||||
|
arena that was either not corrupted or not the one we
|
||||||
|
wanted to avoid. */
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We could not find any arena that was either not corrupted or not the one
|
|
||||||
we wanted to avoid. */
|
|
||||||
if (result == begin || result == avoid_arena)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* No arena available without contention. Wait for the next in line. */
|
/* No arena available without contention. Wait for the next in line. */
|
||||||
LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
|
LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
|
||||||
(void) mutex_lock (&result->mutex);
|
(void) mutex_lock (&result->mutex);
|
||||||
|
Reference in New Issue
Block a user