Skip to contentSkip to conversation

Avoid double faults in stacktrace

PATCH New Robert S. Phillips 1 participant 1 message May 17, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid double faults in stacktrace

This patch changes the guest_mode macro so it does not double-fault when faced with a bogus stack pointer.

# HG changeset patch
# User rphillips@rphillips
# Node ID 4ba740e1027492b5c12daa1447b2d2c71d1cc753 # Parent ac69f504f7c1fd7415927f2c9ca460de70f71b53

This patch changes the guest_mode macro so it does not double-fault when faced with a bogus stack pointer.

xen/include/asm-x86/regs.h +2 -2
diff -r ac69f504f7c1 -r 4ba740e10274 xen/include/asm-x86/regs.h
@@ -35,13 +35,13 @@
 ({                                                                            \
     unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
     /* Frame pointer must point into current CPU stack. */                    \
-    ASSERT(diff < STACK_SIZE);                                                \
+    if (diff >= STACK_SIZE) printk("guestregs:%p r:%p\n", guest_cpu_user_regs(), r); else { \
     /* If a guest frame, it must be have guest privs (unless HVM guest).   */ \
     /* We permit CS==0 which can come from an uninitialised trap entry. */    \
     ASSERT((diff != 0) || vm86_mode(r) || ((r->cs&3) >= GUEST_KERNEL_RPL) ||  \
            (r->cs == 0) || hvm_guest(current));                              \
     /* If not a guest frame, it must be a hypervisor frame. */                \
-    ASSERT((diff == 0) || (!vm86_mode(r) && (r->cs == __HYPERVISOR_CS)));     \
+    ASSERT((diff == 0) || (!vm86_mode(r) && (r->cs == __HYPERVISOR_CS))); } \
     /* Return TRUE if it's a guest frame. */                                  \
     (diff == 0);                                                              \
 })

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel