From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Jann Horn <jannh@google.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/urgent] futex: Also allocate private hash on vfork()
Date: Wed, 16 Sep 2026 12:23:09 -0000 [thread overview]
Message-ID: <178956138932.1720534.15117386989280713537.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260911090447.GT788244@noisy.programming.kicks-ass.net>
The following commit has been merged into the locking/urgent branch of tip:
Commit-ID: b61b6f95d6722ddbbbd09e689fa41b55fd36f9a5
Gitweb: https://git.kernel.org/tip/b61b6f95d6722ddbbbd09e689fa41b55fd36f9a5
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Fri, 11 Sep 2026 11:04:47 +02:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 16 Sep 2026 14:20:41 +02:00
futex: Also allocate private hash on vfork()
As Jann demonstrated, it is entirely feasible to access the mm through vfork().
Therefore we need to allocate a private hash on vfork() as well as any other
CLONE_VM user.
Specifically, it must be avoided to have (private) futex waiters before
allocating the private hash.
Fixes: ee9dce44362b ("futex: Drop CLONE_THREAD requirement for private default hash alloc")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260911090447.GT788244@noisy.programming.kicks-ass.net
---
kernel/fork.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index a5934a3..5ef4133 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1996,9 +1996,9 @@ static bool need_futex_hash_allocate_default(u64 clone_flags)
{
/*
* Allocate a default futex hash for any sibling that will
- * share the parent's mm, except vfork.
+ * share the parent's mm.
*/
- return (clone_flags & (CLONE_VM | CLONE_VFORK)) == CLONE_VM;
+ return clone_flags & CLONE_VM;
}
/*
next prev parent reply other threads:[~2026-09-16 12:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 15:27 [BUG] futex: scheduling-while-atomic because nested vfork can break guard(private_hash) Jann Horn
2026-09-11 8:36 ` Peter Zijlstra
2026-09-11 9:04 ` Peter Zijlstra
2026-09-11 11:51 ` Thomas Gleixner
2026-09-11 15:28 ` Jann Horn
2026-09-11 17:51 ` Davidlohr Bueso
2026-09-15 11:06 ` Sebastian Andrzej Siewior
2026-09-15 11:37 ` Peter Zijlstra
2026-09-16 12:23 ` tip-bot2 for Peter Zijlstra [this message]
2026-09-11 15:31 ` Jann Horn
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=178956138932.1720534.15117386989280713537.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®