[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <698bf81c.050a0220.340abe.000a.GAE@google.com>
Date: Tue, 10 Feb 2026 19:31:40 -0800
From: syzbot <syzbot+6c1861115b4253e45969@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Forwarded: [PATCH] futex: Fix use-after-free in futex_unqueue() on
private hash teardown
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown
Author: suunj1331@...il.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@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6c1861115b4253e45969
Signed-off-by: SeungJu Cheon <suunj1331@...il.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
Powered by blists - more mailing lists