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]
Message-Id: <20171011145000.GA3521@linux.vnet.ibm.com>
Date:   Wed, 11 Oct 2017 07:50:00 -0700
From:   "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:     Will Deacon <will.deacon@....com>
Cc:     David Howells <dhowells@...hat.com>, linux-kernel@...r.kernel.org,
        mingo@...nel.org, torvalds@...ux-foundation.org,
        mark.rutland@....com, linux-arch@...r.kernel.org,
        peterz@...radead.org, Jonathan Corbet <corbet@....net>,
        Alexander Kuleshov <kuleshovmail@...il.com>
Subject: Re: [PATCH RFC tip/core/rcu 12/15] lib/assoc_array: Remove
 smp_read_barrier_depends()

On Wed, Oct 11, 2017 at 03:18:17PM +0100, Will Deacon wrote:
> On Wed, Oct 11, 2017 at 05:54:51AM -0700, Paul E. McKenney wrote:
> > On Wed, Oct 11, 2017 at 01:22:17PM +0100, Will Deacon wrote:
> > > On Wed, Oct 11, 2017 at 01:19:59PM +0100, David Howells wrote:
> > > > Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
> > > > 
> > > > > -	node = result.terminal_node.node;
> > > > > -	smp_read_barrier_depends();
> > > > > +	node = READ_ONCE(result.terminal_node.node); /* Address dependency. */
> > > > 
> > > > The main problem I have with this method of annotation is that it's not
> > > > obvious there's a barrier there or which side the barrier is.
> > > > 
> > > > I think one of the trickiest issues is that a barrier is typically between two
> > > > things and we're not making it clear what those two things actually are.
> > > > 
> > > > Also, I would say that the most natural interpretation of READ_ONCE() is that
> > > > the implicit barrier comes after the read, e.g.:
> > > > 
> > > > 	f = READ_ONCE(stuff->foo);
> > > > 	/* Implied barrier */
> > > > 	look_at(f->a);
> > > > 	look_at(f->b);
> > > > 
> > > > I.e. READ_ONCE() prevents stuff->foo from being reread whilst you access f and
> > > > orders LOAD(stuff->foo) before LOAD(f->a) and LOAD(f->b).
> > > 
> > > FWIW, that's exactly what my patches do, this fixup looks a bit weird
> > > because it removes a prior barrier which suggests that either (a) it's in
> > > the wrong place to start with, or (b) we're annotating the wrong load.
> > 
> > You lost me on this one.  Here is the side-by-side change, minus the
> > comment:
> > 
> > node = result.terminal_node.node;		 node = READ_ONCE(result.terminal_node.node);
> > smp_read_barrier_depends();
> > 
> > The barrier was after the load that got annotated.
> 
> Yes, sorry, I completely lost my ability to read diff. Looking again, I
> don't actually know what's being ordered by the smp_read_barrier_depends()
> in the snippet above, given that assigning "node" is a load from the stack
> afaict.

Good point, and in fact the required READ_ONCE() already exists off
in assoc_array_walk().  Updated.

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ