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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Dec 2021 16:55:56 -0800
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-team@...com, mingo@...nel.org, jiangshanlai@...il.com,
        akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
        josh@...htriplett.org, tglx@...utronix.de, peterz@...radead.org,
        rostedt@...dmis.org, dhowells@...hat.com, edumazet@...gle.com,
        fweisbec@...il.com, oleg@...hat.com, joel@...lfernandes.org,
        Guillaume Morin <guillaume@...infr.org>
Subject: Re: [PATCH rcu 01/18] rcu: Tighten rcu_advance_cbs_nowake() checks

On Thu, Dec 02, 2021 at 01:41:42AM +0100, Frederic Weisbecker wrote:
> On Wed, Dec 01, 2021 at 04:28:55PM -0800, Paul E. McKenney wrote:
> > Currently, rcu_advance_cbs_nowake() checks that a grace period is in
> > progress, however, that grace period could end just after the check.
> > This commit rechecks that a grace period is still in progress the lock.
> 
> *while holding the node lock.

Good eyes, thank you!  I will fix on next rebase.

							Thanx, Paul

> > The grace period cannot end while the current CPU's rcu_node structure's
> > ->lock is held, thus avoiding false positives from the WARN_ON_ONCE().
> > 
> > As Daniel Vacek noted, it is not necessary for the rcu_node structure
> > to have a CPU that has not yet passed through its quiescent state.
> > 
> > Tested-By: Guillaume Morin <guillaume@...infr.org>
> > Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
> 
> Thanks!
> 
> > ---
> >  kernel/rcu/tree.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index ef8d36f580fc3..8706b30c2ac88 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -1590,10 +1590,11 @@ static void __maybe_unused rcu_advance_cbs_nowake(struct rcu_node *rnp,
> >  						  struct rcu_data *rdp)
> >  {
> >  	rcu_lockdep_assert_cblist_protected(rdp);
> > -	if (!rcu_seq_state(rcu_seq_current(&rnp->gp_seq)) ||
> > -	    !raw_spin_trylock_rcu_node(rnp))
> > +	if (!rcu_seq_state(rcu_seq_current(&rnp->gp_seq)) || !raw_spin_trylock_rcu_node(rnp))
> >  		return;
> > -	WARN_ON_ONCE(rcu_advance_cbs(rnp, rdp));
> > +	// The grace period cannot end while we hold the rcu_node lock.
> > +	if (rcu_seq_state(rcu_seq_current(&rnp->gp_seq)))
> > +		WARN_ON_ONCE(rcu_advance_cbs(rnp, rdp));
> >  	raw_spin_unlock_rcu_node(rnp);
> >  }
> >  
> > -- 
> > 2.31.1.189.g2e36527f23
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ