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

Florian Weimer fweimer@redhat.com
Fri Apr 10 15:49:37 GMT 2026


* Adhemerval Zanella Netto:

> 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.

Sorry, I meant the path that is executed if there's no exception
handler.  That's used for internal dlopen failures of dependencies
during startup (excluding preloading, loading auditors; those failures
are ignored/warning only), and for lazy symbol binding failures later
on.

If a handler is installed, _dl_signal_error does not call
_dl_fatal_printf, and that should not change.

Thanks,
Florian



More information about the Libc-alpha mailing list