All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+6c1861115b4253e45969@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown
Date: Tue, 10 Feb 2026 19:31:40 -0800	[thread overview]
Message-ID: <698bf81c.050a0220.340abe.000a.GAE@google.com> (raw)
In-Reply-To: <698ba684.a70a0220.2c38d7.007c.GAE@google.com>

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


  parent reply	other threads:[~2026-02-11  3:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 21:43 [syzbot] [kernel?] KASAN: slab-use-after-free Read in futex_unqueue syzbot
2026-02-10 22:51 ` Hillf Danton
2026-02-10 23:15   ` syzbot
2026-02-11  0:38 ` Hillf Danton
2026-02-11  0:55   ` syzbot
2026-02-11  3:31 ` syzbot [this message]
2026-02-11  8:14   ` Forwarded: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown Thomas Gleixner
2026-02-11  6:31 ` [syzbot] [kernel?] KASAN: slab-use-after-free Read in futex_unqueue Hillf Danton
2026-02-11  6:55   ` syzbot
2026-02-11  9:22 ` Hillf Danton
2026-02-11  9:46   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=698bf81c.050a0220.340abe.000a.GAE@google.com \
    --to=syzbot+6c1861115b4253e45969@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.