[PATCH v4 0/2] futex: Address two futex-requeue-pi issues

From: Sebastian Andrzej Siewior

Date: Tue Sep 01 2026 - 10:02:29 EST


This is an update to Yao Kai initial series. I replaced #1 and updated the
commit a bit in #2.

#1 Was simply missed in the initial commit and never noticed.
#2 Requires extreme precise timing to reproduce.

v3…4: https://lore.kernel.org/all/20260824125544.2353006-1-bigeasy@xxxxxxxxxxxxx/
- PeterZ pointed out that doing sched_submit_work() while waiter is enqueued
looks a bit wrong. tglx's enthusiasm was also missing.
Rewrote that bit to only trigger the assert.

v2…v3: https://lore.kernel.org/20260722085140.1949077-1-yaokai34@xxxxxxxxxx
- Update commit message for both patches.
- Drop the comment from #1. The whole thing has nothing to do with
skipped schedule(). The only problem is that that rt_mutex_schedule()
requires a rt_mutex_.*_schedule() invocation before rtmutex is about
to be acquired. In case it went unnoticed for so long because that
rt_mutex is usually not contended.
- Update the comment in #2 to describe the race and why the wake is
skipped.

v1…v2: (Yao Kai) https://lore.kernel.org/20260722085140.1949077-1-yaokai34@xxxxxxxxxx
- 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.

Sebastian Andrzej Siewior (1):
futex: Provide rt_mutex_.*_schedule() equivalents for futex scheduling

Yao Kai (1):
futex: Prevent rcuwait use-after-free during requeue PI

include/linux/sched/rt.h | 2 ++
kernel/futex/pi.c | 16 +++-------------
kernel/futex/requeue.c | 12 ++++++++++--
kernel/locking/rtmutex_api.c | 2 ++
kernel/sched/core.c | 16 ++++++++++++++++
5 files changed, 33 insertions(+), 15 deletions(-)

--
2.55.0