Should malloc-related functions be weak?

Florian Weimer fweimer@redhat.com
Mon Aug 1 10:40:00 GMT 2016


On 08/01/2016 12:25 PM, Pedro Alves wrote:
> On 07/31/2016 02:50 PM, Florian Weimer wrote:
>> * DJ Delorie:
>>
>>> "Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> writes:
>>>> Shouldn't they be weak functions?
>>>
>>> I can imagine the mess that would happen if someone overwrode malloc()
>>> but not free()...
>>
>> The problem is with the other symbols Tulio identified.  I'll try to
>> see if providing weak stubs for them addresses the issue.
>>
>
> Are these other symbols meant be overridden?

These symbols (__malloc_fork_lock_parent etc.) are not supposed to be 
overridden, they are entirely internal to glibc and its malloc 
implementation.  If the glibc malloc is interposed, these functions 
should not do anything.

Thanks,
Florian



More information about the Libc-alpha mailing list