Re: Forwarded: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown
From: Thomas Gleixner
Date: Wed Feb 11 2026 - 03:15:00 EST
On Tue, Feb 10 2026 at 19:31, syzbot wrote:
> Subject: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown
> Author: suunj1331@xxxxxxxxx
>
> futex_hash_free() frees the private hash table with kvfree() in the
> __mmput() path. However, a task sharing the same mm via CLONE_VM may
> still be in futex_unqueue() which relies on RCU read-side protection
> (guard(rcu)) when acquiring the hash bucket spinlock.
>
> Since kvfree() does not respect RCU grace periods, the hash bucket
> memory can be reclaimed while futex_unqueue() is still referencing it,
> leading to a use-after-free on the embedded spinlock.
>
> Use kvfree_rcu() instead, which defers freeing until after an RCU grace
> period, matching the protection already assumed by futex_unqueue().
>
> The futex_private_hash structure already has an rcu_head field used by
> the pivot path (__futex_pivot_hash), so no structural changes are needed.
This does not fix anything as I explained already before:
https://lore.kernel.org/lkml/87o6lwa0fl.ffs@tglx/
https://lore.kernel.org/all/87qzqsa1br.ffs@tglx/
The futex code has absolutely nothing to do with this and is entirely
correct.
Thanks,
tglx