kernel/futex/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown
Author: suunj1331@gmail.com
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.
Fixes: 80367ad01d93 ("futex: Add basic infrastructure for local task local hash")
Reported-by: syzbot+6c1861115b4253e45969@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6c1861115b4253e45969
Signed-off-by: SeungJu Cheon <suunj1331@gmail.com>
---
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
kernel/futex/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index cf7e610eac42..b625455a7e9f 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1736,7 +1736,7 @@ void futex_hash_free(struct mm_struct *mm)
kvfree(mm->futex_phash_new);
fph = rcu_dereference_raw(mm->futex_phash);
if (fph)
- kvfree(fph);
+ kvfree_rcu(fph, rcu);
}
static bool futex_pivot_pending(struct mm_struct *mm)
--
2.52.0
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@gmail.com
>
> 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
© 2016 - 2026 Red Hat, Inc.