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: <20080811160956.GA9069@linux.vnet.ibm.com>
Date:	Mon, 11 Aug 2008 09:09:56 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	torvalds@...ux-foundation.org, tglx@...utronix.de,
	marcin.slusarz@...il.com, linux-kernel@...r.kernel.org,
	davem@...emloft.net, rostedt@...dmis.org
Subject: Re: [PATCH] printk: robustify printk

On Mon, Aug 11, 2008 at 01:04:00PM +0200, Peter Zijlstra wrote:
> On Mon, 2008-08-11 at 12:45 +0200, Ingo Molnar wrote:
> > ( But that's for a separate cleanup patch i think. )
> > 
> > No strong feelings though. Peter, which one do you prefer?
> 
> I personally prefer this printk_tick() driven one over the RCU driven
> one because it doesn't trade deadlocks.

One way to break the deadlock within the RCU subsystem would be something
similar to the following untested (known not to compile) patch.  The
idea is that RCU detects that call_rcu() is being called from printk(), and
simply enqueues the callback in this case.  For this to really work, RCU
needs something exported from printk() to allow it to make this
decision.  I chose the static variable printk_cpu below just to present
the general idea.

Thoughts?

Buggy, but otherwise:

Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
---

 rcupreempt.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff -urpNa -X dontdiff linux-2.6.27-rc1/kernel/rcupreempt.c linux-2.6.27-rc1-printk/kernel/rcupreempt.c
--- linux-2.6.27-rc1/kernel/rcupreempt.c	2008-07-30 08:48:17.000000000 -0700
+++ linux-2.6.27-rc1-printk/kernel/rcupreempt.c	2008-08-11 09:02:03.000000000 -0700
@@ -1118,17 +1118,22 @@ void call_rcu(struct rcu_head *head, voi
 {
 	unsigned long flags;
 	struct rcu_data *rdp;
+	int this_cpu = smp_processor_id();
 
 	head->func = func;
 	head->next = NULL;
 	local_irq_save(flags);
 	rdp = RCU_DATA_ME();
-	spin_lock(&rdp->lock);
-	__rcu_advance_callbacks(rdp);
+	if (this_cpu == printk_cpu) {
+		spin_lock(&rdp->lock);
+		__rcu_advance_callbacks(rdp);
+	}
 	*rdp->nexttail = head;
 	rdp->nexttail = &head->next;
 	RCU_TRACE_RDP(rcupreempt_trace_next_add, rdp);
-	spin_unlock_irqrestore(&rdp->lock, flags);
+	if (this_cpu == printk_cpu) {
+		spin_unlock_irqrestore(&rdp->lock, flags);
+	}
 }
 EXPORT_SYMBOL_GPL(call_rcu);
 
--
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