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: <20171017185609.GU3521@linux.vnet.ibm.com>
Date:   Tue, 17 Oct 2017 11:56:09 -0700
From:   "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     Andrea Parri <parri.andrea@...il.com>,
        Will Deacon <will.deacon@....com>, peterz@...radead.org,
        boqun.feng@...il.com, npiggin@...il.com, dhowells@...hat.com,
        Jade Alglave <j.alglave@....ac.uk>,
        Luc Maranget <luc.maranget@...ia.fr>,
        Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Linux-kernel examples for LKMM recipes

On Fri, Oct 13, 2017 at 04:09:26PM -0400, Alan Stern wrote:
> On Fri, 13 Oct 2017, Paul E. McKenney wrote:
> > On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote:
> > > On Wed, 11 Oct 2017, Paul E. McKenney wrote:

[ . . . ]

> > Perhaps the recipes document should just baldly state that any execution
> > having only one thread and/or having only one variable will be fully
> > ordered?
> 
> That wouldn't be a bad idea.  (Although the part about only one thread 
> should be pretty obvious.)
> 
> Also, you have to be a little careful because the ordering of the
> execution may not always agree with the ordering of the source code.  
> The compiler is allowed to evaluate the arguments to a function call,
> for example, in any order it likes.

How about this?

0.	Simple special cases

	If there is only one CPU on the one hand or only one variable
	on the other, the code will execute in order.  There are (as
	usual) some things to be careful of:

	a.	There are some aspects of the C language that are
		unordered.  For example, the compiler can output code
		computing arguments of a multi-parameter function in
		any order it likes, or even interleaved if it so chooses.

	b.	Compilers are permitted to use the "as-if" rule.
		That is, a compiler can emit whatever code it likes,
		as long as the results appear just as if the compiler
		had followed all the relevant rules.  To see this,
		compiler with a high level of optimization and run
		the debugger on the resulting binary.

	c.	If there is only one variable but multiple CPUs, all
		accesses to that variable must be aligned and full sized.
		Variables that straddle cachelines or pages void your
		full-ordering warranty, as do undersized accesses that
		load from or store to only part of the variable.

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ