[PATCH] malloc: Ensure that ptmalloc_init runs only once

Siddhesh Poyarekar siddhesh@gotplt.org
Fri Jun 18 06:32:46 GMT 2021


On 6/18/21 11:58 AM, Siddhesh Poyarekar via Libc-alpha wrote:
> On 6/18/21 11:25 AM, Florian Weimer wrote:
>> I think it's a three-state value to avoid calling
>> __malloc_initialize_hook multiple times.  This is all a bit
>> under-documented unfortunately.
> 
> How so?  It's only called from ptmalloc_init now AFAICT and running 
> ptmalloc_init concurrently won't work anyway.

To be clear what I'm suggesting is setting __malloc_initialized at the 
entry of ptmalloc_init, which should ensure that the body is executed 
only once as long as it is not called concurrently.

Siddhesh


More information about the Libc-alpha mailing list