All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Stephan Mueller <smueller@chronox.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will.deacon@arm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Theodore Tso <tytso@mit.edu>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	mancha security <mancha1@zoho.com>,
	Mark Charlebois <charlebm@gmail.com>,
	Behan Webster <behanw@converseincode.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	rostedt <rostedt@goodmis.org>
Subject: Re: interesting commit about llvm introducing barrier_data()
Date: Tue, 23 Feb 2016 08:10:42 -0800	[thread overview]
Message-ID: <20160223161042.GM3522@linux.vnet.ibm.com> (raw)
In-Reply-To: <1316436701.5482.1456239517072.JavaMail.zimbra@efficios.com>

On Tue, Feb 23, 2016 at 02:58:37PM +0000, Mathieu Desnoyers wrote:
> ----- On Feb 23, 2016, at 9:46 AM, Stephan Mueller smueller@chronox.de wrote:
> 
> > Am Dienstag, 23. Februar 2016, 14:32:43 schrieb Mathieu Desnoyers:
> > 
> > Hi Mathieu,
> > 
> >> ----- On Feb 23, 2016, at 9:23 AM, Paul E. McKenney
> > paulmck@linux.vnet.ibm.com wrote:
> >> > On Tue, Feb 23, 2016 at 02:02:26PM +0000, Mathieu Desnoyers wrote:
> >> >> commit 7829fb09a2b4268b30dd9bc782fa5ebee278b137
> >> >> Author: Daniel Borkmann <daniel@iogearbox.net>
> >> >> Date:   Thu Apr 30 04:13:52 2015 +0200
> >> >> 
> >> >>     lib: make memzero_explicit more robust against dead store elimination
> >> >> 
> >> >> ^ interesting commit. Any idea on the impact of this on kernel RCU
> >> >> implementation and liburcu cmm_barrier() ?
> >> > 
> >> > First I knew of it!  But I bet that more like this are needed.  ;-)
> >> 
> >> I recommend you check my IRC discussion with peterz on the matter of
> >> this new "barrier_data()".
> >> 
> > The key idea of the memzero_explicit is about forcing the compiler to do a
> > memset.
> > 
> > See the trivial test attached.
> 
> My question is mainly about documentation of the new "barrier_data()"
> added to include/linux/compiler-gcc.h. Its comment does not clearly
> state where it should be used, and where it should not be needed.
> 
> If it is useful for clearing memory for security purposes, it
> should be stated in the comment above the macro, and in the
> memory-barriers.txt Documentation file.
> 
> If it is useful for securely clearing local variables in
> registers and on stack, it should be documented. Or if
> variables sitting on stack are not a target here, it should
> be documented too.
> 
> If there is any way this could have impacts on DMA reads/writes
> (typically only global and allocated variables), it should be
> documented.
> 
> If beyond the "clearing memory for security" use-case, this
> new barrier is needed rather than barrier() for code correctness,
> it should also be documented.

Looks like this is an issue only for code that doesn't use WRITE_ONCE()
or better for writes to shared variables.  Of which there does appear
to be a great deal in the kernel, to be sure...

							Thanx, Paul

      reply	other threads:[~2016-02-23 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1168693945.5302.1456236146207.JavaMail.zimbra@efficios.com>
     [not found] ` <20160223142336.GK3522@linux.vnet.ibm.com>
2016-02-23 14:32   ` interesting commit about llvm introducing barrier_data() Mathieu Desnoyers
2016-02-23 14:46     ` Stephan Mueller
2016-02-23 14:58       ` Mathieu Desnoyers
2016-02-23 16:10         ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160223161042.GM3522@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=behanw@converseincode.com \
    --cc=charlebm@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=hannes@stressinduktion.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mancha1@zoho.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=smueller@chronox.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.