[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Tighten up the assertion conditions in the GUEST_MODE() macro.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 51c59d5d76b05dc5ce849e8e983f1683d7096881
# Parent  583d01868d17c622b1dff036ebac353192b02611
Tighten up the assertion conditions in the GUEST_MODE() macro.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 583d01868d17 -r 51c59d5d76b0 xen/include/asm-x86/regs.h
--- a/xen/include/asm-x86/regs.h        Mon Mar  6 22:50:30 2006
+++ b/xen/include/asm-x86/regs.h        Tue Mar  7 13:40:23 2006
@@ -36,10 +36,12 @@
     unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
     /* Frame pointer must point into current CPU stack. */                    \
     ASSERT(diff < STACK_SIZE);                                                \
-    /* If a guest frame, it must not be a ring 0 frame (unless HVM guest). */ \
-    ASSERT((diff != 0) || VM86_MODE(r) || !RING_0(r) || HVM_DOMAIN(current)); \
-    /* If not a guest frame, it must be a ring 0 frame. */                    \
-    ASSERT((diff == 0) || (!VM86_MODE(r) && RING_0(r)));                      \
+    /* 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_DOMAIN(current));                              \
+    /* If not a guest frame, it must be a hypervisor frame. */                \
+    ASSERT((diff == 0) || (!VM86_MODE(r) && (r->cs == __HYPERVISOR_CS)));     \
     /* Return TRUE if it's a guest frame. */                                  \
     (diff == 0);                                                              \
 })

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.