aboutsummaryrefslogtreecommitdiff
path: root/malloc/arena.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-08-30 17:16:08 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-08-30 20:08:34 +0200
commita9da0bb2667ab20f1dbcd0a9ae6846db02fbc96a (patch)
tree9422f3ae82df4bef2ac63424b6f946be62e054d6 /malloc/arena.c
parentac3ed168d0c0b2b702319ac0db72c9b475a8c72e (diff)
downloadglibc-a9da0bb2667ab20f1dbcd0a9ae6846db02fbc96a.zip
glibc-a9da0bb2667ab20f1dbcd0a9ae6846db02fbc96a.tar.gz
glibc-a9da0bb2667ab20f1dbcd0a9ae6846db02fbc96a.tar.bz2
malloc: Remove corrupt arena flag
This is no longer needed because we now abort immediately once heap corruption is detected.
Diffstat (limited to 'malloc/arena.c')
-rw-r--r--malloc/arena.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/malloc/arena.c b/malloc/arena.c
index 39cbfbc..afd4232 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -116,7 +116,7 @@ int __malloc_initialized = -1;
} while (0)
#define arena_lock(ptr, size) do { \
- if (ptr && !arena_is_corrupt (ptr)) \
+ if (ptr) \
__libc_lock_lock (ptr->mutex); \
else \
ptr = arena_get2 ((size), NULL); \
@@ -832,7 +832,7 @@ reused_arena (mstate avoid_arena)
result = next_to_use;
do
{
- if (!arena_is_corrupt (result) && !__libc_lock_trylock (result->mutex))
+ if (!__libc_lock_trylock (result->mutex))
goto out;
/* FIXME: This is a data race, see _int_new_arena. */
@@ -845,18 +845,6 @@ reused_arena (mstate avoid_arena)
if (result == avoid_arena)
result = result->next;
- /* Make sure that the arena we get is not corrupted. */
- mstate begin = result;
- while (arena_is_corrupt (result) || result == avoid_arena)
- {
- result = result->next;
- if (result == begin)
- /* 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;
- }
-
/* No arena available without contention. Wait for the next in line. */
LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
__libc_lock_lock (result->mutex);
@@ -953,10 +941,6 @@ arena_get_retry (mstate ar_ptr, size_t bytes)
if (ar_ptr != &main_arena)
{
__libc_lock_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;
__libc_lock_lock (ar_ptr->mutex);
}