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: 4+ 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
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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox