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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 6 Oct 2015 22:05:38 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	Josh Triplett <josh@...htriplett.org>,
	linux-kernel@...r.kernel.org, mingo@...nel.org,
	jiangshanlai@...il.com, dipankar@...ibm.com,
	akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
	tglx@...utronix.de, rostedt@...dmis.org, dhowells@...hat.com,
	edumazet@...gle.com, dvhart@...ux.intel.com, fweisbec@...il.com,
	oleg@...hat.com, bobby.prani@...il.com,
	Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for
 Tiny and Tree RCU readers

On Tue, Oct 06, 2015 at 10:42:04AM -0700, Paul E. McKenney wrote:

> 
> Ah.  The reason is that Tiny RCU and Tree RCU (the !PREEMPT ones) act
> by implicitly extending (and, if need be, merging) the RCU read-side
> critical sections to include all the code between successive quiescent
> states, for example, all the code between a pair of calls to schedule().
> 
> Therefore, there need to be barrier() calls in the quiescent-state
> functions.  Some could be argued to be implicitly present due to
> translation-unit boundaries, but paranoia and all that.
> 
> Would adding that sort of explanation help?

> +++ b/include/linux/rcutiny.h
> @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void)
>  
>  static inline void rcu_all_qs(void)
>  {
> +	barrier(); /* Avoid RCU read-side critical sections leaking across. */
>  }
>  
>  #endif /* __LINUX_RCUTINY_H */

This is more than sheer paranoia I think, inlined functions are not a
compiler barrier.

> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index b9d9e0249e2f..93c0f23c3e45 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void)
>   */
>  void rcu_note_context_switch(void)
>  {
> +	barrier(); /* Avoid RCU read-side critical sections leaking down. */
>  	trace_rcu_utilization(TPS("Start context switch"));
>  	rcu_sched_qs();
>  	rcu_preempt_note_context_switch();
>  	if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
>  		rcu_momentary_dyntick_idle();
>  	trace_rcu_utilization(TPS("End context switch"));
> +	barrier(); /* Avoid RCU read-side critical sections leaking up. */
>  }
>  EXPORT_SYMBOL_GPL(rcu_note_context_switch);

These OTOH could be fixed with a noinline, such that the compiler may
never inline it, even with whole-program-optimizations, thereby
guaranteeing a function call boundary or compiler barrier.
--
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