Re: [PATCH] futex: Make FUTEX_WAITERS state consistent for robust futex unlock
From: Thomas Gleixner
Date: Fri Jul 31 2026 - 12:13:28 EST
On Fri, Jul 31 2026 at 12:41, Thomas Gleixner wrote:
> On Fri, Jul 31 2026 at 00:36, Keno Fischer wrote:
>>> + /*
>>> + * This should never happen because evaluate_waiters() would
>>> + * have detected a PI futex mixup already.
>>> + */
>>> + if (WARN_ON_ONCE(nr_woken < 0))
>>> + return nr_woken;
>>
>> I missed this before, but the same issue makes this WARN reachable. If there's
>> a bunch of bitset-mismatched waiters at the start of the queue, then the check
>> will early out and the PI mixup will not be discovered until the second walk.
>
> Yes, but that has been the case forever and it's done opportunisticly to
> avoid full hash bucket walks wherever possible.
Duh. I misread what you said, but yes with the changes I did now it
should all be fine.
I'll post the lot later.