Re: [patch v2 07/11] futex: Add support for unlocking robust futexes
From: Thomas Gleixner
Date: Thu Mar 26 2026 - 18:24:12 EST
On Fri, Mar 20 2026 at 14:14, André Almeida wrote:
> Em 19/03/2026 20:24, Thomas Gleixner escreveu:
>>
>> The sys_futex() case [ab]uses the @uaddr2 argument to hand the pointer to
>> the kernel. This argument is only evaluated when the FUTEX_ROBUST_UNLOCK
>> bit is set and is therefore backward compatible.
>>
> I didn't find anywhere in the commit message that says what this
> pointers points to, so I would add:
>
> "@uaddr2 argument to hand the address of robust list pending op to the
> kernel"
Right.
> and also explain why we can't use
> current->futex.robust_list->list_op_pending (if I understood it
> correctly why):
>
> "Instead of using the list_op_pending address found at
> current->futex.robust_list, use the address explicitly set by the user
> in the syscall arguments to avoid racing with set_robust_list()"
No. The task can't be in the futex syscall and update the robust list
pointer concurrently. :)
The reason is to avoid the lookup of the robust list pointer and
retrieving the pending op pointer. User space has the pointer already
there so it can just put it into the @uaddr2 argument. Aside of that
this allows the usage of multiple robust lists in the future w/o any
changes to the internal functions as they just operate on the supplied
pointer. Only in the unresolvable fault case the kernel checks whether
there is a matching robust list registered and clears it to avoid
further trouble.
I'll amend the change log.
Thanks,
tglx