futex: Also allocate private hash on vfork()

As Jann demonstrated, it is entirely feasible to access the mm through vfork().
Therefore we need to allocate a private hash on vfork() as well as any other
CLONE_VM user.

Specifically, it must be avoided to have (private) futex waiters before
allocating the private hash.

Fixes: ee9dce4436 ("futex: Drop CLONE_THREAD requirement for private default hash alloc")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260911090447.GT788244@noisy.programming.kicks-ass.net
This commit is contained in:
Peter Zijlstra 2026-09-11 11:04:47 +02:00
parent fd73f4a665
commit b61b6f95d6

View File

@ -1996,9 +1996,9 @@ static bool need_futex_hash_allocate_default(u64 clone_flags)
{
/*
* Allocate a default futex hash for any sibling that will
* share the parent's mm, except vfork.
* share the parent's mm.
*/
return (clone_flags & (CLONE_VM | CLONE_VFORK)) == CLONE_VM;
return clone_flags & CLONE_VM;
}
/*