[PATCH] Call malloc_tsd_boot0 from malloc_init_hard_recursible

Jason Evans jasone at canonware.com
Wed Dec 23 08:56:34 PST 2015


On Nov 18, 2015, at 8:02 AM, Cosmin Paraschiv <cparaschiv at ixiacom.com> wrote:
> When using LinuxThreads, malloc bootstrapping deadlocks, since malloc_tsd_boot0
> ends up calling pthread_setspecific, which causes recursive allocation. Fix it,
> by moving the malloc_tsd_boot0 call to malloc_init_hard_recursible.
> 
> The deadlock has been introduced by commit 8bb3198f72, when tsd_boot was split
> and the top half, tsd_boot0, got an extra tsd_wrapper_set call.

This patch causes a test failure (on a Ubuntu 15.04 machine):

---
./autogen.sh --enable-prof --enable-debug && make check
[...]
MALLOC_CONF="prof:true" /bin/sh test/test.sh test/integration/aligned_alloc test/integration/allocated test/integration/sdallocx test/integration/mallocx test/integration/MALLOCX_ARENA test/integration/overflow test/integration/posix_memalign test/integration/rallocx test/integration/thread_arena test/integration/thread_tcache_enabled test/integration/xallocx test/integration/chunk
=== test/integration/aligned_alloc ===
<jemalloc>: include/jemalloc/internal/tsd.h:609: Failed assertion: "tsd_booted"
Aborted (core dumped)
---

It will probably be at least several weeks before I have a chunk of time to look into this myself, so if you have the time, please get back to me with an updated patch.

Thanks,
Jason


More information about the jemalloc-discuss mailing list