From 357952d0ea8e8e6ce12479eced7275e444a7b2c2 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Wed, 16 Nov 2011 17:48:02 -0500 Subject: [PATCH] Bug 703087 - (Temporarily) enable assertion in isalloc_validate in release builds, to test for potential ozone_size corruption. r=khuey --- memory/jemalloc/jemalloc.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/memory/jemalloc/jemalloc.c b/memory/jemalloc/jemalloc.c index 6720066a8c7..e8985dbcb24 100644 --- a/memory/jemalloc/jemalloc.c +++ b/memory/jemalloc/jemalloc.c @@ -989,10 +989,10 @@ struct arena_bin_s { }; struct arena_s { -#ifdef MALLOC_DEBUG + /* For bug 703087, we're temporarily adding arena.magic to release + builds. */ uint32_t magic; # define ARENA_MAGIC 0x947d3d24 -#endif /* All operations on this arena require that lock be locked. */ #ifdef MOZ_MEMORY @@ -4332,7 +4332,15 @@ isalloc_validate(const void *ptr) return (0); if (chunk != ptr) { - assert(chunk->arena->magic == ARENA_MAGIC); + /* For bug 703087, we've temporarily made what is normally a + debug-only assertion here into a fatal assertion. */ + if (chunk->arena->magic != ARENA_MAGIC) { + char* boom = (char*) 0; + _malloc_message("isalloc_validate called with invalid pointer. " + "Crashing...\n", "", "", ""); + *boom = 1; + } + return (arena_salloc(ptr)); } else { size_t ret; @@ -4842,10 +4850,9 @@ arena_new(arena_t *arena) #endif } -#ifdef MALLOC_DEBUG + /* For bug 703087, we're temporarily adding arena->magic for release + builds. */ arena->magic = ARENA_MAGIC; -#endif - return (false); }