WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: Prevent an infinite series of traps

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Prevent an infinite series of traps
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 04 Jun 2007 03:15:22 -0700
Delivery-date: Mon, 04 Jun 2007 03:15:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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 <=