From: Yao Kai <yaokai34@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: <tglx@kernel.org>, <mingo@redhat.com>, <peterz@infradead.org>,
<dvhart@infradead.org>, <dave@stgolabs.net>,
<andrealmeid@igalia.com>, <bigeasy@linutronix.de>,
<liuyongqiang13@huawei.com>
Subject: [PATCH v2 0/2] futex/requeue: Fix requeue PI races
Date: Wed, 22 Jul 2026 16:51:38 +0800 [thread overview]
Message-ID: <20260722085140.1949077-1-yaokai34@huawei.com> (raw)
Hi,
This series fixes two independent issues in the requeue PI wait path.
Patch 1 restores rtmutex scheduling preparation when the temporary
removal of futex_q during requeue causes futex_do_wait() to skip
schedule(), while the proxy waiter still has to block on the target
rtmutex.
Patch 2 prevents the requeue side from accessing the waiter's
stack-based futex_q after publishing Q_REQUEUE_PI_LOCKED. The saved-task
wakeup in requeue_pi_wake_futex() also covers a waiter blocked in the
rcuwait synchronization path.
Changes since v1:
- Replace the scheduler helper split in patch 1 with
rt_mutex_pre_schedule()/rt_mutex_post_schedule() directly around
rt_mutex_wait_proxy_lock().
- Expand patch 2's comment and changelog to explain why the saved-task
wakeup covers rcuwait without losing a wakeup.
Thanks to Sebastian for the review and for suggesting the simpler fix
for patch 1.
v1:
https://lore.kernel.org/r/20260717084922.4153317-1-yaokai34@huawei.com
Testing:
- Build-tested with non-RT and PREEMPT_RT configurations.
- The original rt_mutex_schedule() warning reproducer no longer
triggers the warning.
- The original PREEMPT_RT KASAN reproducer no longer reports an
invalid access.
- The futex requeue PI selftests and stress tests pass.
Yao
Yao Kai (2):
futex/requeue: Fix rtmutex schedule preparation for requeue PI
futex/requeue: Prevent rcuwait use-after-free during requeue PI
kernel/futex/requeue.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
--
2.43.0
next reply other threads:[~2026-07-22 8:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 8:51 Yao Kai [this message]
2026-07-22 8:51 ` [PATCH v2 1/2] futex/requeue: Fix rtmutex schedule preparation for requeue PI Yao Kai
2026-08-04 12:21 ` Peter Zijlstra
2026-08-05 8:00 ` Yao Kai
2026-08-24 3:07 ` Yao Kai
2026-08-24 14:08 ` Sebastian Andrzej Siewior
2026-08-25 3:13 ` Yao Kai
2026-07-22 8:51 ` [PATCH v2 2/2] futex/requeue: Prevent rcuwait use-after-free during " Yao Kai
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=20260722085140.1949077-1-yaokai34@huawei.com \
--to=yaokai34@huawei.com \
--cc=andrealmeid@igalia.com \
--cc=bigeasy@linutronix.de \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyongqiang13@huawei.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@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®