[PATCH v2] malloc: Remove malloc hooks (Bug 23328)
Florian Weimer
fw@deneb.enyo.de
Mon Jul 2 18:37:00 GMT 2018
* DJ Delorie:
> Florian Weimer <fw@deneb.enyo.de> writes:
>>> + void *(*hook) (size_t, const void *)
>>> + = atomic_forced_read (__glibc_malloc_hook);
>>> + if (__builtin_expect (hook != NULL, 0))
>>> + return (*hook) (sz, RETURN_ADDRESS (0));
>>
>> Should this use atomic_load_relaxed instead?
>
> It's a copy of what's in malloc/malloc.c
Is supected as much. Oh well.
>>> + HOOK (malloc, NULL);
>>
>> I think you can simplify HOOK considerably if you always initialize
>> all function pointers. Then you don't need to use atomics there
>> because pthread_create always initializes malloc before creating new
>> threads.
>
> I tried that, but you end up being just as complicated due to having to
> check for "set to dummy hooks", plus implementing the dummy hooks,
> plus... etc. It turned out to not be worth the effort, even once I got
> it working properly (bootstrapping an interposed malloc is not trivial).
Dummy hooks? I meant to initialize not the hooks, but the next_*
variables.
More information about the Libc-alpha
mailing list