|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [xen-unstable] x86: Prevent an infinite series of traps
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1179999568 -3600
# Node ID e49b110cbb4afa7186a5d666ac73b44a55584145
# Parent 96915ca8d5f239062f889970279c5d90296a8a96
x86: Prevent an infinite series of traps
In some cases, we can end up in a vicious cycle of fatal_trap()s
within fatal_trap()s. Panic after a certain number of attempts.
Signed-off-by: Nils Nieuwejaar <nils.nieuwejaar@xxxxxxx>
Use a per-cpu depth variable.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
xen/arch/x86/traps.c | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff -r 96915ca8d5f2 -r e49b110cbb4a xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Thu May 24 10:18:55 2007 +0100
+++ b/xen/arch/x86/traps.c Thu May 24 10:39:28 2007 +0100
@@ -345,16 +345,26 @@ char *trapstr(int trapnr)
*/
asmlinkage void fatal_trap(int trapnr, struct cpu_user_regs *regs)
{
- watchdog_disable();
- console_start_sync();
-
- show_execution_state(regs);
-
- if ( trapnr == TRAP_page_fault )
- {
- unsigned long cr2 = read_cr2();
- printk("Faulting linear address: %p\n", _p(cr2));
- show_page_walk(cr2);
+ static DEFINE_PER_CPU(char, depth);
+
+ /*
+ * In some cases, we can end up in a vicious cycle of fatal_trap()s
+ * within fatal_trap()s. We give the problem a couple of iterations to
+ * bottom out, and then we just panic.
+ */
+ if ( ++this_cpu(depth) < 3 )
+ {
+ watchdog_disable();
+ console_start_sync();
+
+ show_execution_state(regs);
+
+ if ( trapnr == TRAP_page_fault )
+ {
+ unsigned long cr2 = read_cr2();
+ printk("Faulting linear address: %p\n", _p(cr2));
+ show_page_walk(cr2);
+ }
}
panic("FATAL TRAP: vector = %d (%s)\n"
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [xen-unstable] x86: Prevent an infinite series of traps,
Xen patchbot-unstable <=
|
|
|
|
|