{"id":807694,"url":"http://patchwork.ozlabs.org/api/patches/807694/?format=json","web_url":"http://patchwork.ozlabs.org/project/glibc/patch/20170830160422.F2F1540C0E092@oldenburg.str.redhat.com/","project":{"id":41,"url":"http://patchwork.ozlabs.org/api/projects/41/?format=json","name":"GNU C Library","link_name":"glibc","list_id":"libc-alpha.sourceware.org","list_email":"libc-alpha@sourceware.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170830160422.F2F1540C0E092@oldenburg.str.redhat.com>","list_archive_url":null,"date":"2017-08-30T16:04:22","name":"malloc: Remove corrupt arena flag","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8f4828bbf84a503c1bff1664f6b4e746deff94ff","submitter":{"id":14312,"url":"http://patchwork.ozlabs.org/api/people/14312/?format=json","name":"Florian Weimer","email":"fweimer@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/glibc/patch/20170830160422.F2F1540C0E092@oldenburg.str.redhat.com/mbox/","series":[{"id":642,"url":"http://patchwork.ozlabs.org/api/series/642/?format=json","web_url":"http://patchwork.ozlabs.org/project/glibc/list/?series=642","date":"2017-08-30T16:04:22","name":"malloc: Remove corrupt arena flag","version":1,"mbox":"http://patchwork.ozlabs.org/series/642/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807694/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807694/checks/","tags":{},"related":[],"headers":{"Return-Path":"<libc-alpha-return-83875-incoming=patchwork.ozlabs.org@sourceware.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list libc-alpha@sourceware.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-83875-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"xkx9XMtO\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=fweimer@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj9LT2jklz9sPt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 02:04:33 +1000 (AEST)","(qmail 50229 invoked by alias); 30 Aug 2017 16:04:26 -0000","(qmail 50220 invoked by uid 89); 30 Aug 2017 16:04:26 -0000"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:to:subject:mime-version:content-type\n\t:content-transfer-encoding:message-id:from; q=dns; s=default; b=\n\tde2NlrbaoKbEqGouT08+E+aMEy2g8FnsNmRhEq3GMWjeg78wyZI9h196sJP7GImW\n\tYHTC6G00viJHgBPFZpYMVVBk3ficKF8W426x62vCGOyQZPWs7klGG3aTkhM2rSXJ\n\tDhxeXt2zMuzLoiMGkZUrbzC50SChRAEH9DXNN2XJ4Co=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:to:subject:mime-version:content-type\n\t:content-transfer-encoding:message-id:from; s=default; bh=U4m/it\n\tiDCU5XkLaCu2+xlmByCxc=; b=xkx9XMtO013J9ftFgFrviqkBL4Aw1yBpiIZx1j\n\tHFFhqtkIlWWrv7b6QDoN1mzr0zMwvqDLDw4pOAzTLsTTeTlz1pFT7wfbg57P9d6A\n\t25UMHOoaPvQTNudx7Z7QztUN9IgFxAwtym4hopBMYAZfn8JU55AJ3EFoTV8nNjWG\n\txXork=","Mailing-List":"contact libc-alpha-help@sourceware.org; run by ezmlm","Precedence":"bulk","List-Id":"<libc-alpha.sourceware.org>","List-Unsubscribe":"<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>","List-Subscribe":"<mailto:libc-alpha-subscribe@sourceware.org>","List-Archive":"<http://sourceware.org/ml/libc-alpha/>","List-Post":"<mailto:libc-alpha@sourceware.org>","List-Help":"<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>","Sender":"libc-alpha-owner@sourceware.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com AEF2C4A70F","Date":"Wed, 30 Aug 2017 18:04:22 +0200","To":"libc-alpha@sourceware.org","Subject":"[PATCH] malloc: Remove corrupt arena flag","User-Agent":"Heirloom mailx 12.5 7/5/10","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Transfer-Encoding":"7bit","Message-Id":"<20170830160422.F2F1540C0E092@oldenburg.str.redhat.com>","From":"fweimer@redhat.com (Florian Weimer)"},"content":"This is no longer needed because we now abort immediately\nonce heap corruption is detected.\n\n2017-08-30  Florian Weimer  <fweimer@redhat.com>\n\n\t* malloc/malloc.c (ARENA_CORRUPTION_BIT, arena_is_corrupt)\n\t(set_arena_corrupt): Remove definitions.\n\t(mtrim): Do not check for corrupt arena.\n\t* malloc/arena.c (arena_lock, reused_arena, arena_get_retry):\n\tLikewise.","diff":"diff --git a/malloc/arena.c b/malloc/arena.c\nindex 39cbfbc282..afd423240a 100644\n--- a/malloc/arena.c\n+++ b/malloc/arena.c\n@@ -116,7 +116,7 @@ int __malloc_initialized = -1;\n   } while (0)\n \n #define arena_lock(ptr, size) do {\t\t\t\t\t      \\\n-      if (ptr && !arena_is_corrupt (ptr))\t\t\t\t      \\\n+      if (ptr)\t\t\t\t\t\t\t\t      \\\n         __libc_lock_lock (ptr->mutex);\t\t\t\t\t      \\\n       else\t\t\t\t\t\t\t\t      \\\n         ptr = arena_get2 ((size), NULL);\t\t\t\t      \\\n@@ -832,7 +832,7 @@ reused_arena (mstate avoid_arena)\n   result = next_to_use;\n   do\n     {\n-      if (!arena_is_corrupt (result) && !__libc_lock_trylock (result->mutex))\n+      if (!__libc_lock_trylock (result->mutex))\n         goto out;\n \n       /* FIXME: This is a data race, see _int_new_arena.  */\n@@ -845,18 +845,6 @@ reused_arena (mstate avoid_arena)\n   if (result == avoid_arena)\n     result = result->next;\n \n-  /* Make sure that the arena we get is not corrupted.  */\n-  mstate begin = result;\n-  while (arena_is_corrupt (result) || result == avoid_arena)\n-    {\n-      result = result->next;\n-      if (result == begin)\n-\t/* We looped around the arena list.  We could not find any\n-\t   arena that was either not corrupted or not the one we\n-\t   wanted to avoid.  */\n-\treturn NULL;\n-    }\n-\n   /* No arena available without contention.  Wait for the next in line.  */\n   LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);\n   __libc_lock_lock (result->mutex);\n@@ -953,10 +941,6 @@ arena_get_retry (mstate ar_ptr, size_t bytes)\n   if (ar_ptr != &main_arena)\n     {\n       __libc_lock_unlock (ar_ptr->mutex);\n-      /* Don't touch the main arena if it is corrupt.  */\n-      if (arena_is_corrupt (&main_arena))\n-\treturn NULL;\n-\n       ar_ptr = &main_arena;\n       __libc_lock_lock (ar_ptr->mutex);\n     }\ndiff --git a/malloc/malloc.c b/malloc/malloc.c\nindex e0e8966001..d41851a0e4 100644\n--- a/malloc/malloc.c\n+++ b/malloc/malloc.c\n@@ -1647,15 +1647,6 @@ typedef struct malloc_chunk *mfastbinptr;\n #define set_noncontiguous(M)   ((M)->flags |= NONCONTIGUOUS_BIT)\n #define set_contiguous(M)      ((M)->flags &= ~NONCONTIGUOUS_BIT)\n \n-/* ARENA_CORRUPTION_BIT is set if a memory corruption was detected on the\n-   arena.  Such an arena is no longer used to allocate chunks.  Chunks\n-   allocated in that arena before detecting corruption are not freed.  */\n-\n-#define ARENA_CORRUPTION_BIT (4U)\n-\n-#define arena_is_corrupt(A)\t(((A)->flags & ARENA_CORRUPTION_BIT))\n-#define set_arena_corrupt(A)\t((A)->flags |= ARENA_CORRUPTION_BIT)\n-\n /* Maximum size of memory handled in fastbins.  */\n static INTERNAL_SIZE_T global_max_fast;\n \n@@ -4727,10 +4718,6 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)\n static int\n mtrim (mstate av, size_t pad)\n {\n-  /* Don't touch corrupt arenas.  */\n-  if (arena_is_corrupt (av))\n-    return 0;\n-\n   /* Ensure initialization/consolidation */\n   malloc_consolidate (av);\n \n","prefixes":[]}