Skip to contentSkip to conversation

i386: report unhandled non-root faults

RFC PATCH New Jan Kiszka 1 participant 1 message Oct 9, 2007

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

RFC PATCH 1/1 i386: report unhandled non-root faults

This patch was part of my endeavour to understand the vmalloc-pinning issue. It catches the theoretically impossible case that there is a bug inside the I-pipe core. That bug may cause a fault over a non-root domain AND that domain may not show any interest in the fault. Linux is called then, and things fall apart.

As the patch adds code to the fault handler's hot-patch, I decided to make the check depend on CONFIG_IPIPE_DEBUG. It's i386 only, but porting it to other archs should be straightforward.

My feeling is that this safety belt can be useful again for bugs we will surely invent in the future. :)

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
---
 arch/i386/kernel/ipipe.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/i386/kernel/ipipe.c +11 -2
Index: linux-2.6.22.9/arch/i386/kernel/ipipe.c
===================================================================
@@ -642,8 +642,17 @@ fastcall int __ipipe_handle_exception(st
 #endif /* CONFIG_KGDB */
 
 	if (!ipipe_trap_notify(vector, regs)) {
-		__ipipe_exptr handler = __ipipe_std_extable[vector];
-		handler(regs,error_code);
+#ifdef CONFIG_IPIPE_DEBUG
+		if (!ipipe_root_domain_p) {
+			/* Fix up domain so that Linux can handle this. */
+			ipipe_current_domain = ipipe_root_domain;
+			ipipe_trace_panic_freeze();
+			printk(KERN_ERR "BUG: Unhandled exception over domain"
+					" %s - switching to ROOT\n",
+					ipipe_current_domain->name);
+		}
+#endif /* CONFIG_IPIPE_DEBUG */
+		__ipipe_std_extable[vector](regs, error_code);
 		local_irq_restore(flags);
 		__fixup_if(regs);
 		return 0;