From: Thomas Gleixner <tglx@linutronix.de>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/futex: handle the case where we got a "late" waiter
Date: Wed, 20 Apr 2016 09:36:42 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1604200934190.3941@nanos> (raw)
In-Reply-To: <20160419222737.GA27058@linux-uzut.site>
On Tue, 19 Apr 2016, Davidlohr Bueso wrote:
> On Fri, 15 Apr 2016, Sebastian Andrzej Siewior wrote:
>
> > futex_unlock_pi() gets uval before taking the hb lock. Now imagine
> > someone in futex_lock_pi() took the lock. While futex_unlock_pi() waits
> > for the hb lock, the LOCK_PI sets FUTEX_WAITERS and drops the lock.
> > Now, futex_unlock_pi() figures out that there is waiter and invokes
> > wake_futex_pi() with the old uval which does not yet have FUTEX_WAITERS
> > set. This flaw lets cmpxchg_futex_value_locked() fail and return -EINVAL.
>
> Hmm but if we're calling futex_unlock_pi() in the first place, doesn't that
> indicate that the uval already has FUTEX_WAITERS and therefore failed the
> TID->0 transition in userland? That or the thread is bogusly unlocking a
> lock that it doesn't own.
It can be called unconditionally w/o trying the TID->0 transition in user
space first and we should handle that case.
Thanks,
tglx
next prev parent reply other threads:[~2016-04-20 7:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 12:35 Sebastian Andrzej Siewior
2016-04-19 22:27 ` Davidlohr Bueso
2016-04-20 7:09 ` Sebastian Andrzej Siewior
2016-04-20 7:36 ` Thomas Gleixner [this message]
2016-04-20 11:51 ` [tip:locking/urgent] futex: Handle unlock_pi race gracefully tip-bot for Sebastian Andrzej Siewior
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=alpine.DEB.2.11.1604200934190.3941@nanos \
--to=tglx@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.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®