[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a751252ee17f64ec82e44ae2d64fc217e3849202.camel@gmx.de>
Date: Thu, 04 Mar 2021 14:23:27 +0100
From: Mike Galbraith <efault@....de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Ben Hutchings <ben@...adent.org.uk>, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
stable@...r.kernel.org, Lee Jones <lee.jones@...aro.org>,
"Luis Claudio R. Goncalves" <lgoncalv@...hat.com>, lwn@....net,
jslaby@...e.cz, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: futex breakage in 4.9 stable branch
On Thu, 2021-03-04 at 14:11 +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 04, 2021 at 10:12:56AM +0100, Mike Galbraith wrote:
>
> > futex: fix 4.4-stable 34c8e1c2c025 backport inspired lockdep complaint
> >
> > 1. 34c8e1c2c025 "futex: Provide and use pi_state_update_owner()" was backported
> > to stable, leading to the therein assertion that pi_state->pi_mutex.wait_lock
> > be held triggering in 4.4-stable. Fixing that leads to lockdep moan part 2.
> >
> > 2: b4abf91047cf "rtmutex: Make wait_lock irq safe" is absent in 4.4-stable, but
> > wake_futex_pi() nonetheless managed to acquire an unbalanced raw_spin_lock()
> > raw_spin_inlock_irq() pair, which inspires lockdep to moan after aforementioned
> > assert has been appeased.
> >
> > With this applied, futex tests pass, and no longer inspire lockdep gripeage.
> >
> > Not-Signed-off-by: Mike Galbraith <efault@....de>
> > ---
> > kernel/futex.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > --- a/kernel/futex.c
> > +++ b/kernel/futex.c
> > @@ -874,8 +874,12 @@ static void free_pi_state(struct futex_p
> > * and has cleaned up the pi_state already
> > */
> > if (pi_state->owner) {
> > + unsigned long flags;
> > +
> > + raw_spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags);
> > pi_state_update_owner(pi_state, NULL);
> > rt_mutex_proxy_unlock(&pi_state->pi_mutex);
> > + raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags);
> > }
> >
> > if (current->pi_state_cache)
> > @@ -1406,7 +1410,7 @@ static int wake_futex_pi(u32 __user *uad
> > if (pi_state->owner != current)
> > return -EINVAL;
> >
> > - raw_spin_lock(&pi_state->pi_mutex.wait_lock);
> > + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
> > new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
> >
> > /*
> >
>
> Care to sign-off on it so that if this is correct, I can apply it? :)
Consider it signed off iff Thomas acks it. I think it's correct.. just
like the guys who have installed every other bug in the damn things,
just a wee bit less over-confident :)
-Mike
Powered by blists - more mailing lists