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:	Thu, 5 Dec 2013 10:50:42 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	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>,
	Jonathan Corbet <corbet@....net>,
	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:

> + (*) The compiler is within its rights to reload a variable, for example,
> +     in cases where high register pressure prevents the compiler from
> +     keeping all data of interest in registers.  The compiler might
> +     therefore optimize the variable tmp out of our previous example:
> +
> +	while (tmp = a)
> +		do_something_with(tmp);
> +
> +     This could result in the following code, which is perfectly safe in
> +     single-threaded code, but can be fatal in concurrent code:
> +
> +	while (a)
> +		do_something_with(a);
> +
> +     For example, the optimized version of this code could result in
> +     passing a zero to do_something_with() in the case where the variable
> +     a was modified by some other CPU between the "while" statement and
> +     the call to do_something_with().

Nit: I guess references to variable names such as 'a' should be quoted 
(same for 'tmp', 'b', etc):

        For example, the optimized version of this code could result in
        passing a zero to do_something_with() in the case where the variable
        'a' was modified by some other CPU between the "while" statement and
        the call to do_something_with().

which makes reading it less ambiguous and more fluid IMO. This 
observation applies to the whole document as 'a' is used in many 
places.

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