From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC78C288C0A for ; Wed, 11 Feb 2026 03:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770780703; cv=none; b=mVTcbIkxVbZIhmqp104C4xjVB7V94z1p56HqdUYydEzGwHa5RSLPATZJFOCEkldOImLJch8gjjXSGV6AHPsJCCV7I7dpCeEdSoz5Fw7LiGq/vxOFzr6UkE7CuGFHV5sxLoJVm8EGEC0MJ8BP4Xa32ZGhGmvRkRMPlWu12Bee39E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770780703; c=relaxed/simple; bh=dtQSp6u9kNuPM2bEUtzOW3jkvYmeuXVNA1bXTi2A9Ac=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=lJ5kDWhS5ZgI2hUXz0/Frd7edCLH4RD2tv2BzRN5pRXP1qjw8OHmFBBLEa5nqf9YkgADne4cBKTrx6h+lXVY5c41Sb8HTB67XMW+ieVVgeRjWvSvXdOFrr5QV7YEstICJew2ZY32aQW0CMMTGFze7VYGux0e/8e9PM1E7Ef93nQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f72.google.com with SMTP id 006d021491bc7-66308f16ea0so26923563eaf.0 for ; Tue, 10 Feb 2026 19:31:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770780701; x=1771385501; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s9Cvu2Ac9NnsEKdRKnGxR94hrKKUvjrItGE1qgIHfjQ=; b=LDWsuc5NAn7mYmA+HI5Sle4arP5TvqtwBgodDnYTWO8EZF8UtSBNKxLYh1xXoZ6F2I GAP1FsKd4iryD9gg7I3Io9TTaBsXovdgegt++AR+y27EoU9SUYWdVRB1os5qzPePi9M4 AfDdIqljJHDIeCidaMoaNEzSOTKOrTwnryPfxc49lqJzhziCIETddteiUsxbHG2gF/mE HQyEsfedUAtlX5I/FMGNGOeuV19q+eug7WPqE0GAjQfAB6Nw3rNJkJt0UZ8OzbSNF3id Gml5xZaE/gh0mphGmEVU6i0M4gmDBBIYXhR5ew/VJuvcyjrdcnJx/+r6ZRlogXZ4h+ZM SRew== X-Gm-Message-State: AOJu0YxDlQNDOEUMExEf6AKq4iPXmo6tvonkOMIxrBhMO2FFvGM2b9K6 IqNYDkPhrv2nPipHY/lZjbZFQFZBq7kWIpceoJZpYtBPaqrIWhjGZZ03b2c9Wnr3RtjUJLb4qqr bt+X8PxjhsEaiT+LuhGoQFVHuaJ7fPD4npEjB6QQsepbifN/yneS4Mxwoo70= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:4cca:b0:667:7e1a:203a with SMTP id 006d021491bc7-67484be1a9cmr218043eaf.58.1770780700746; Tue, 10 Feb 2026 19:31:40 -0800 (PST) Date: Tue, 10 Feb 2026 19:31:40 -0800 In-Reply-To: <698ba684.a70a0220.2c38d7.007c.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <698bf81c.050a0220.340abe.000a.GAE@google.com> Subject: Forwarded: [PATCH] futex: Fix use-after-free in futex_unqueue() on private hash teardown From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" 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 --- #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