[PATCH v8 6/6] elf: Raise SIGABRT for assert within ld.so

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Fri Mar 20 13:18:45 GMT 2026



On 20/03/26 08:12, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> The assert static path already properly raises SIGABRT for assert during
>> process startup, while ld.so only prints the error message and issues
>> _exit.  This prevents a coredump from being created if the environment
>> is configured to do so.
>>
>> Similar to rtld malloc hooks, the assert symbol __assert_fail and
>> assert_perror_fail need to be relocated to the libc symbol after the
>> final relocation (so dlfcn.h functions call libc __assert_fail instead
>> of dl-minimal.c one). The hook framework is renamed to be more generic,
>> instead of tying to rtld malloc.
>>
>> The Hurd requires a proper __raise_direct implementation, issuing raise
>> or kill pull a lot of symbols that prevents ld.so building.
>>
>> Checked on x86_64-linux-gnu and i686-linux-gnu.
> 
> Is it really necessary to provide an interceptable assert for ld.so
> assertion failures?  We could reset the handler unconditionally and then
> send SIGABRT (in a loop, due to race conditions).

It allows a more clear definitions of the requirements, the assert
during process execution requires just 'raise (SIGABRT)' (I added the 
ABORT_INSTRUCTION and _exit for completeness, there are not strictly 
required).

We changed the libc abort to avoid clever solutions to handle the 
potential race condition, I think we avoid adding some similar.

> 
> With this approach, we wouldn't need stubs that get later replaced with
> the libc implementation.
> 
> I don't think providing SIGABRT interception capabilities is woth the
> complexity.
> 
> Thanks,
> Florian
> 



More information about the Libc-alpha mailing list