[PATCH] nptl: futex_lock_pi deadlock detection provides valuable information but it is turned into a rather cryptic assertion failure

Florian Weimer fweimer@redhat.com
Wed Apr 15 14:02:19 GMT 2026


* Adhemerval Zanella Netto:

> On 15/04/26 04:24, Florian Weimer wrote:
>> * Carlos O'Donell:
>> 
>>> If we aren't triggering undefined behaviour then I think it's perfectly
>>> acceptable to return a "may fail" error to the caller.
>> 
>> Doing that triggers undefined behavior in this case if the caller
>> ignores the EDEADLK right, no?
>
> The 'may fail' for multi-mutex deadlock is defined even for POSIX 2001 [1],
> so I am not sure if we can consider this UB.
>
> [1] https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html

It's likely to end up in UB because the lock is not taken, the caller
doesn't realize this, and enters the code for the critical section
without any protection against data races.

Thanks,
Florian



More information about the Libc-alpha mailing list