From: Bart Van Assche <bvanassche@acm.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun@kernel.org>, Waiman Long <longman@redhat.com>,
linux-kernel@vger.kernel.org, Marco Elver <elver@google.com>,
"Paul E . McKenney" <paulmck@kernel.org>,
Bart Van Assche <bvanassche@acm.org>,
Thomas Gleixner <tglx@kernel.org>,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH 11/14] futex: Verify exit_mutex ownership in futex_exit_recursive()
Date: Mon, 2 Nov 2026 13:34:41 -0800 [thread overview]
Message-ID: <41ecca27e4ebb241ea200347a0e19dc0f5d03ee8.1793654853.git.bvanassche@acm.org> (raw)
In-Reply-To: <cover.1793654853.git.bvanassche@acm.org>
futex_exit_recursive() unlocks tsk->futex.exit_mutex if the futex state
is FUTEX_STATE_EXITING. It uses __assume_ctx_lock() to inform Clang's
context analysis that this mutex is held. However, __assume_ctx_lock()
does not verify that assumption. Convert the __assume_ctx_lock() call
into a lockdep_assume_ctx_held() call such that the lock ownership
assumption is also verified at runtime by lockdep.
Cc: Marco Elver <elver@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
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 a240638f69e5..4e5aa0160dd2 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1503,7 +1503,7 @@ void futex_exit_recursive(struct task_struct *tsk)
{
/* If the state is FUTEX_STATE_EXITING then futex_exit_mutex is held */
if (tsk->futex.state == FUTEX_STATE_EXITING) {
- __assume_ctx_lock(&tsk->futex.exit_mutex);
+ lockdep_assume_ctx_held(&tsk->futex.exit_mutex);
mutex_unlock(&tsk->futex.exit_mutex);
}
tsk->futex.state = FUTEX_STATE_DEAD;
next prev parent reply other threads:[~2026-11-02 21:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 21:34 [PATCH 00/14] Stop lockdep_assert_held*() from assuming lock ownership Bart Van Assche
2026-11-02 21:34 ` [PATCH 01/14] bit_spinlock: Fix the __bitlock() definition Bart Van Assche
2026-11-02 21:34 ` [PATCH 02/14] cleanup: Disable context analysis for __free() helpers Bart Van Assche
2026-11-02 21:34 ` [PATCH 03/14] tracing: Disable branch profiling for COMPILE_TEST builds Bart Van Assche
2026-11-02 21:34 ` [PATCH 04/14] srcu: Remove check from srcu_dereference_check() Bart Van Assche
2026-11-02 21:34 ` [PATCH 05/14] futex: Annotate __attach_to_pi_owner() and fixup_pi_*owner() Bart Van Assche
2026-11-02 21:34 ` [PATCH 06/14] locking/rwsem: Annotate rwsem internal functions with __must_hold() Bart Van Assche
2026-11-02 21:34 ` [PATCH 07/14] nvme-fabrics: Annotate nvmf_lookup_transport() with __must_hold_shared() Bart Van Assche
2026-11-02 21:34 ` [PATCH 08/14] lockdep: Introduce lockdep_assume_ctx_held() Bart Van Assche
2026-11-02 21:34 ` [PATCH 09/14] kfence: Use lockdep_assume_ctx_held() in kfence_report_error() Bart Van Assche
2026-11-02 21:34 ` [PATCH 10/14] Bluetooth: Add lock context annotations for connection aliases Bart Van Assche
2026-11-02 21:34 ` Bart Van Assche [this message]
2026-11-02 21:34 ` [PATCH 12/14] lockdep: Stop lockdep_assert_held*() from assuming lock ownership Bart Van Assche
2026-11-02 21:34 ` [PATCH 13/14] compiler-context-analysis: Split the RCU assertion tests Bart Van Assche
2026-11-02 21:34 ` [PATCH 14/14] rcu: Introduce lockdep_assume_in_rcu_*() Bart Van Assche
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=41ecca27e4ebb241ea200347a0e19dc0f5d03ee8.1793654853.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=boqun@kernel.org \
--cc=elver@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--cc=will@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®