Re: [RFC PATCH] futex: Introduce __vdso_robust_futex_unlock

From: Thomas Gleixner

Date: Mon Mar 16 2026 - 19:29:36 EST


On Mon, Mar 16 2026 at 18:30, Mathieu Desnoyers wrote:
> On 2026-03-16 18:19, Thomas Gleixner wrote:
>> What I clearly described is the sequence:
>>
>> set_pointer();
>> unlock();
>> sys_exit();
>>
>> The kernel does not care about that at all as that's what user space
>> asked for. That is clearly in the category of "I want to shoot myself
>> into the foot".
>>
>> The only case where the kernel has to provide help to user space is the
>> involuntary exit caused by a crash or external signal between unlock()
>> and clear_pointer(). Simply because there is no way that user space can
>> solve that problem on its own.
>>
>> If you want to prevent user space from shooting itself into the foot
>> then the above crude scenario is the least of your problems.
>
> So the extra scenario I am concerned about is:
>
> Thread A Thread B
> ----------------------------------------
> set_pointer();
> unlock();
> syscall exit_group(2)
>
> This does not fall under the "async" program termination per se, because
> it is issued by Thread B, but it's not the result of an "exit(2)" call
> from Thread A.
>
> Is this scenario too far fetched, or something we should care about ?

It's a legit scenario, but you still fail to try to look at the code and
understand how all of this works even after I gave you enough hints.

I'm truly amazed that you even failed to ask any AI agent the obvious
question:

"When a task invokes the exit_group syscall on Linux how does the
Linux kernel manage to tear down all tasks which belong to the same
process?"

Both agents which https://arena.ai randomly picked out for me provided
very comprehensive explanations. Let me paste you one of them:

"3. Terminate All Other Threads

do_group_exit calls zap_other_threads, which:

Iterates over all tasks in the thread group using for_each_thread
(traversing the thread group list in task_struct). Sends an
uncatchable SIGKILL signal to every thread except the current one
(using SEND_SIG_FORCED to bypass any signal blocking). Since SIGKILL
cannot be caught or ignored, these threads will terminate
immediately."

If that's not a sufficient answer for you, may I recommed to look at:

https://training.linuxfoundation.org/

Thanks,

tglx