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-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1803232210110.1481@nanos.tec.linutronix.de>
Date:   Fri, 23 Mar 2018 22:12:24 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     LKML <linux-kernel@...r.kernel.org>
cc:     "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Josh Triplett <josh@...htriplett.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Joel Fernandes <joelaf@...gle.com>
Subject: rcu: Add might_sleep() check to synchronize_rcu()

Subject: rcu: Add might_sleep() check to synchronize_rcu()
From: Thomas Gleixner <tglx@...utronix.de>
Date: Fri, 23 Mar 2018 22:02:18 +0100

Joel reported a debugobjects warning which is triggered by a RCU callback
invoking synchronize_rcu(). RCU callbacks run in softirq context, so
calling synchronize_rcu() is a bad idea as it might sleep.

debugobjects triggers because __wait_rcu_gp() uses on stack objects and
invokes debug_object_init_on_stack(). That function checks the object
address against current's task stack, which fails because the code runs on
the softirq stack.

synchronize_rcu() lacks a might_sleep() check which would have caught that
issue way earlier because it would trigger with the minimal debug options
enabled.

Add a might_sleep() check to catch such cases.

Reported-by: Joel Fernandes <joelaf@...gle.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Josh Triplett <josh@...htriplett.org>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Lai Jiangshan <jiangshanlai@...il.com>
---
 kernel/rcu/tree_plugin.h |    1 +
 1 file changed, 1 insertion(+)

--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -753,6 +753,7 @@ void synchronize_rcu(void)
 			 "Illegal synchronize_rcu() in RCU read-side critical section");
 	if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
 		return;
+	might_sleep();
 	if (rcu_gp_is_expedited())
 		synchronize_rcu_expedited();
 	else

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ