lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 30 Jun 2021 16:50:15 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Xu, Yanfei" <yanfei.xu@...driver.com>
Cc:     Waiman Long <longman@...hat.com>, Ingo Molnar <mingo@...hat.com>,
        Will Deacon <will@...nel.org>,
        Boqun Feng <boqun.feng@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] locking/mutex: Reduce chance of setting HANDOFF bit on
 unlocked mutex

On Wed, Jun 30, 2021 at 10:43:37PM +0800, Xu, Yanfei wrote:
> > +static inline struct task_struct *__mutex_trylock_or_owner(struct mutex *lock, bool handoff)
> >   {
> >          unsigned long owner, curr = (unsigned long)current;
> > 
> >          owner = atomic_long_read(&lock->owner);
> >          for (;;) { /* must loop, can race against a flag */
> > +               unsigned long flags = __owner_flags(owner);
> >                  unsigned long task = owner & ~MUTEX_FLAGS;
> > 
> >                  if (task) {
> > +                       if (flags & MUTEX_FLAG_PICKUP) {
> > 
> > +                               if (task != curr)
> > +                                       break;
> > +
> > +                               flags &= ~MUTEX_FLAG_PICKUP;
> > +
> 
> Hmm.. Should we also clear HANDOFF bit here? I don't find where it is
> cleared.

Should already be gone; see __mutex_handoff().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ