Thread (4 messages) 4 messages, 3 authors, 2010-12-09

Re: Run 'usermode-agent' cause kernel panic on Powerpc

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2010-12-09 03:26:20

On Wed, 2010-12-08 at 09:20 +0800, xufeng zhang wrote:
quoted
I believe it would have such an impact.  I don't see that user-mode
debugging would be enabled at all.

Maybe something like this untested patch:
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 84906d3..0e7d1cf 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -323,6 +323,13 @@ static void set_debug_reg_defaults(struct thread_struct *thread)

  static void prime_debug_regs(struct thread_struct *thread)
  {
+	/*
+	 * If we're setting up debug events for user space, make sure they
+	 * don't fire in kernel space before we get to user space
+	 */
+	if (thread->dbcr0&  DBCR0_IDM)
+		mtmsr(mfmsr()&  ~MSR_DE);
+
  	mtspr(SPRN_IAC1, thread->iac1);
  	mtspr(SPRN_IAC2, thread->iac2);
  #if CONFIG_PPC_ADV_DEBUG_IACS>  2

   
Thanks for your reply, Dave, I know where the problem is.
So is there a kernel bug we need to fix ?

Cheers,
Ben.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help