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: <20141113225128.3568bae6@gandalf.local.home>
Date:	Thu, 13 Nov 2014 22:51:28 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Joe Perches <joe@...ches.com>
Cc:	Pranith Kumar <bobby.prani@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Petr Mladek <pmladek@...e.cz>, Jan Kara <jack@...e.cz>,
	"Luis R. Rodriguez" <mcgrof@...e.com>,
	Alex Elder <elder@...aro.org>,
	open list <linux-kernel@...r.kernel.org>,
	paulmck@...ux.vnet.ibm.com
Subject: Re: [RFC PATCH] printk: Use ACCESS_ONCE() instead of a volatile
 type

On Thu, 13 Nov 2014 19:41:00 -0800
Joe Perches <joe@...ches.com> wrote:

> On Thu, 2014-11-13 at 22:21 -0500, Pranith Kumar wrote:
> > Remove volatile type qualifier and use ACCESS_ONCE() in its place for each
> > access. Using volatile is not recommended as documented in
> > Documentation/volatile-considered-harmful.txt.
> > 
> > Here logbuf_cpu is a local variable and it is not clear how it is being accessed
> > concurrently. We should remove volatile accesses entirely here, but for now make
> > a safer change of using ACCESS_ONCE().
> 
> Not recommended does not mean "don't ever use".

I would argue that the use of volatile in open code is evil and prone
to bugs. I agree that this is one of the few occasions that this is not
the case.

> 
> Forcing the volatile at each use site instead
> of the declaration isn't necessarily better.
> 
> I think the code is more readable as-is but I'm
> not going to object if Andrew picks this up...
> 

The ACCESS_ONCE() calls at each location makes it a bit uglier, but it
drives in the point of what that is doing. Where as the volatile may be
missed.

-- Steve

--
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