mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 22:40:05 +00:00
Don't use the main arena in retry path if it is corrupt
If allocation on a non-main arena fails, the main arena is used without checking to see if it is corrupt. Add a check that avoids the main arena if it is corrupt. * malloc/arena.c (arena_get_retry): Don't use main_arena if it is corrupt.
This commit is contained in:
parent
92a9b22d70
commit
c3b9ef8dfc
@ -1,5 +1,8 @@
|
|||||||
2015-08-24 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2015-08-24 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
|
* malloc/arena.c (arena_get_retry): Don't use main_arena if it
|
||||||
|
is corrupt.
|
||||||
|
|
||||||
* malloc/arena.c (arena_get2): Drop unused argument.
|
* malloc/arena.c (arena_get2): Drop unused argument.
|
||||||
(arena_lock): Adjust.
|
(arena_lock): Adjust.
|
||||||
(arena_get_retry): Likewise.
|
(arena_get_retry): Likewise.
|
||||||
|
@ -909,6 +909,10 @@ arena_get_retry (mstate ar_ptr, size_t bytes)
|
|||||||
if (ar_ptr != &main_arena)
|
if (ar_ptr != &main_arena)
|
||||||
{
|
{
|
||||||
(void) mutex_unlock (&ar_ptr->mutex);
|
(void) mutex_unlock (&ar_ptr->mutex);
|
||||||
|
/* Don't touch the main arena if it is corrupt. */
|
||||||
|
if (arena_is_corrupt (&main_arena))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ar_ptr = &main_arena;
|
ar_ptr = &main_arena;
|
||||||
(void) mutex_lock (&ar_ptr->mutex);
|
(void) mutex_lock (&ar_ptr->mutex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user