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: <20131210194628.GA21814@gmail.com>
Date:	Tue, 10 Dec 2013 20:46:28 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
	laijs@...fujitsu.com, dipankar@...ibm.com,
	akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
	josh@...htriplett.org, niv@...ibm.com, tglx@...utronix.de,
	peterz@...radead.org, rostedt@...dmis.org, dhowells@...hat.com,
	edumazet@...gle.com, darren@...art.com, fweisbec@...il.com,
	sbw@....edu, Oleg Nesterov <oleg@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH tip/core/locking 4/4] Documentation/memory-barriers.txt:
 Document ACCESS_ONCE()


* Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:

> > So, what I don't see this statement cover (and I might be dense about 
> > it!) is whether two ACCESS_ONCE() macros referring to different 
> > variables are allowed to be reordered with each other.
> > 
> > If the compiler reorders:
> > 
> > 	ACCESS_ONCE(x);
> > 	ACCESS_ONCE(y);
> > 
> > to:
> > 
> > 	ACCESS_ONCE(y);
> > 	ACCESS_ONCE(x);
> > 
> > then AFAICS it still meets the "compiler need only forget the contents 
> > of the indicated memory located" requirement that you listed, right?
> 
> True, but if the compiler was willing to reorder ACCESS_ONCE()'s 
> volatile accesses, it would be really hard to write reliable device 
> drivers. [...]

But nowhere do we link ACCESS_ONCE() to 'volatile' semantics in the 
document, do we? (and I'm not sure we should.)

[ In theory a future compiler could offer a smarter, more flexible 
  'compiler barrier' implementation - at which point we might be 
  tempted to use that new facility to implement ACCESS_ONCE(). At that 
  point this ambiguity might arise. ]


> [...]  The standard says the following:
> 
> 	Access to volatile objects are evaluated strictly according to
> 	the rules of the abstract machine.
> 
> That said, compiler writers and standards wonks will argue endlessly 
> about exactly what that does and does not mean.  :-/
> 
> I added a sentence reading:
> 
> 	Of course, the compiler must also respect the order in which
> 	the ACCESS_ONCE()s occur, though the CPU of course need not do so.
> 
> To the end of that paragraph.  Does that help?

Yeah, that looks perfect!

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ