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:	Fri, 20 May 2011 10:36:48 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Stable <stable@...nel.org>
Subject: Re: [PATCH] rcu: Fix unpaired rcu_irq_enter() from locking selftests


* Frederic Weisbecker <fweisbec@...il.com> wrote:

> HARDIRQ_ENTER() maps to irq_enter() which calls rcu_irq_enter().
> But HARDIRQ_EXIT() maps to __irq_exit() which doesn't call
> rcu_irq_exit().
> 
> So for every locking selftest that simulates hardirq disabled,
> we create an imbalance in the rcu extended quiescent state
> internal state.
> 
> As a result, after the first missing rcu_irq_exit(), subsequent
> irqs won't exit any extended quiescent state the time of the
> interrupt servicing. Rcu read side critical section inside irqs
> on that CPU won't be guaranteed anymore.
> 
> To fix this, just use __irq_enter() to simulate the hardirq
> context. This is sufficient for the locking selftests as we
> don't need to exit any extended quiescent state or perform
> any check that irqs normally do when they wake up from idle.
> 
> As a side effect, this patch should make it possible to
> restore
> "rcu: Decrease memory-barrier usage based on semi-formal proof",
> which eventually helped finding this bug.
> 
> Reported-and-tested-by: Yinghai Lu <yinghai@...nel.org>
> Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Cc: Stable <stable@...nel.org>
> ---
>  lib/locking-selftest.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c
> index 619313e..507a22f 100644
> --- a/lib/locking-selftest.c
> +++ b/lib/locking-selftest.c
> @@ -144,7 +144,7 @@ static void init_shared_classes(void)
>  
>  #define HARDIRQ_ENTER()				\
>  	local_irq_disable();			\
> -	irq_enter();				\
> +	__irq_enter();				\
>  	WARN_ON(!in_irq());
>  
>  #define HARDIRQ_EXIT()				\

Very nice!

Note that a cherry-picked version of the manual revert from Paul is upstream 
now with the main body of RCU changes, so we can do the finegrained split-up 
queue approach for this one problematic commit (that is no longer problematic).

I think it can still go in for v2.6.40. Paul, what do you think?

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