From: Thomas Gleixner <tglx@kernel.org>
To: Keno Fischer <keno@juliahub.com>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: "Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"André Almeida" <andrealmeid@igalia.com>,
"Yang Tao" <yang.tao172@zte.com.cn>,
"Yi Wang" <wang.yi59@zte.com.cn>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] futex: Prevent robust futex exit race more
Date: Tue, 21 Jul 2026 14:24:34 +0200 [thread overview]
Message-ID: <87bjc0led9.ffs@fw13> (raw)
In-Reply-To: <CABV8kRwvex1VvQ0eGwUQmJL_vA7AP2h64VpHqtXvfOXMvvJQZA@mail.gmail.com>
On Mon, Jul 20 2026 at 23:26, Keno Fischer wrote:
> If a third task re-acquired the futex through the uncontended fast
> path in the meantime, the notification is lost: Robust exit processing
> sees that it is owned by another task and does nothing, while the new
> owner sees no FUTEX_WAITERS when it unlocks and wakes nobody.
> The remaining waiters sleep forever behind a free futex:
>
> A owns the futex, B and C sleep in FUTEX_WAIT
> uval == A | FUTEX_WAITERS
> A robust unlock: store 0, FUTEX_WAKE(1) wakes B
> uval == 0
> D fast path acquire: cmpxchg(0 -> D)
> uval == D, no FUTEX_WAITERS
> B killed before acting on the wakeup
> B exit walk, pending op: owner D != B -> no action
> D unlock: no FUTEX_WAITERS -> no wake
> C sleeps forever
>
> Fix this by augmenting the robust list exit processing to also
> perform the extra wakeup if the futex word is owned by another
> thread but FUTEX_WAITERS is *NOT* set.
While your change "fixes" this particular problem, it leaves the related
UAF problem unsolved.
The more complete solution is:
https://lore.kernel.org/all/20260602084648.462672743@kernel.org/
which is upstream now. Specifically the combined unlock/wake part
https://lore.kernel.org/all/20260602090535.670514505@kernel.org/
ensures that your scenario can't happen and provides at the same time
one part of the solution for the UAF exit race.
> This issues was discovered as part of a larger attempt to resolve the
> long-standing issue that robust futexes are not safely usable across
> pid namespaces.
What's the actual problem with that?
Thanks,
tglx
next prev parent reply other threads:[~2026-07-21 12:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 3:26 [PATCH] futex: Prevent robust futex exit race more Keno Fischer
2026-07-21 12:24 ` Thomas Gleixner [this message]
2026-07-21 16:50 ` Keno Fischer
2026-07-22 14:21 ` Thomas Gleixner
2026-07-23 12:53 ` Christian Brauner
2026-07-23 13:24 ` Florian Weimer
2026-07-24 8:20 ` Christian Brauner
2026-07-23 19:59 ` Keno Fischer
2026-07-23 19:44 ` Keno Fischer
2026-07-26 20:39 ` Thomas Gleixner
2026-07-26 22:54 ` Keno Fischer
2026-07-27 13:12 ` Thomas Gleixner
2026-07-27 17:23 ` Keno Fischer
2026-07-28 19:43 ` Thomas Gleixner
2026-07-28 21:29 ` Thomas Gleixner
2026-07-30 21:06 ` Thomas Gleixner
2026-07-30 22:15 ` [PATCH] futex: Make FUTEX_WAITERS state consistent for robust futex unlock Thomas Gleixner
2026-07-31 4:36 ` Keno Fischer
2026-07-31 10:41 ` Thomas Gleixner
2026-07-31 16:05 ` Thomas Gleixner
2026-07-28 22:05 ` [PATCH] futex: Prevent robust futex exit race more Thomas Gleixner
2026-07-28 22:13 ` Keno Fischer
2026-07-29 13:47 ` Thomas Gleixner
2026-07-29 14:47 ` Keno Fischer
2026-07-30 6:58 ` Thomas Gleixner
2026-07-30 19:46 ` Keno Fischer
2026-07-30 20:39 ` [tip: locking/futex] " tip-bot2 for Keno Fischer
2026-08-02 8:00 ` [tip: locking/urgent] futex: Prevent robust futex exit race some more tip-bot2 for Keno Fischer
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=87bjc0led9.ffs@fw13 \
--to=tglx@kernel.org \
--cc=andrealmeid@igalia.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=keno@juliahub.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=wang.yi59@zte.com.cn \
--cc=yang.tao172@zte.com.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.