[PATCH v8 6/6] elf: Raise SIGABRT for assert within ld.so
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Fri Apr 10 15:11:28 GMT 2026
On 10/04/26 09:38, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> @@ -188,11 +232,11 @@ __assert_perror_fail (int errnum,
>> const char *function)
>> {
>> char errbuf[400];
>> - _dl_fatal_printf ("\
>> + _dl_error_printf ("\
>> Inconsistency detected by ld.so: %s: %u: %s%sUnexpected error: %s.\n",
>> file, line, function ?: "", function ? ": " : "",
>> __strerror_r (errnum, errbuf, sizeof errbuf));
>> -
>> + rtld_abort ();
>> }
>
> Would it make sense to change _dl_fatal_printf to abort instead?
>
> It requires changing the _dl_fatal_printf call in _dl_signal_error
> because we don't want to abort if loading fails due to a missing
> dependency.
But assert usage in dl-load.c (and related functions) are for unexpected
and unhandled situations (like invalid r_debug->state). I do not think
making assert an error on dlopen the expected behavior, I would rather
check every assert usage and see if we can make it a _dl_signal_error.
More information about the Libc-alpha
mailing list