There's a problem in handling kgdb-triggered memory faults on ARM when
the process in question has a user context.
To reproduce, set a breakpoint at a system call (sys_sync for example),
once the breakpoint is hit, do an 'info threads'. In the process of
doing this, kgdb_mem2hex may trigger a memory fault, but since this
process has a user context, it doesn't take the path with the kgdb
setjmp/longjmp fixups. Even worse, it eventually ends up in do_no_page
which can sleep, and since kgdb has disabled interrupts, a 'scheduling
while atomic' BUG appears.
It seems to work OK with no preemption, but this bug arises under
CONFIG_PREEMPT.
Patch below has been verified on a MontaVista 2.6.10 kernel (ARMv5, and
v6) but should be same on newer kernels.
Kevin
Index: linux-2.6.10/arch/arm/mm/fault.c
===================================================================
--- linux-2.6.10.orig/arch/arm/mm/fault.c
+++ linux-2.6.10/arch/arm/mm/fault.c
@@ -217,6 +217,10 @@ out:
return fault;
}
+#ifdef CONFIG_KGDB
+extern int kgdb_may_fault;
+#endif
+
static int
do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
{
@@ -227,6 +231,11 @@ do_page_fault(unsigned long addr, unsign
tsk = current;
mm = tsk->mm;
+#ifdef CONFIG_KGDB
+ if (kgdb_may_fault)
+ goto no_context;
+#endif
+
/*
* If we're in an interrupt or have no user
* context, we must not take the fault..
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport