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

[Xen-changelog] [xen-unstable] nestedsvm: fix handling of invalid virtual vmcb



# HG changeset patch
# User Christoph Egger <Christoph.Egger@xxxxxxx>
# Date 1309549680 -3600
# Node ID 177ddb2f4ebf4e71471129de7e197a8cba19b777
# Parent  2ad4262cac39616506f3c0e0dba6ae3590412ace
nestedsvm: fix handling of invalid virtual vmcb

When the l1 guest sets up an invalid vmcb then inject VMEXIT(#INVALID)
rather having the host sitting in an endless loop of injecting #UD.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---


diff -r 2ad4262cac39 -r 177ddb2f4ebf xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c  Fri Jul 01 20:46:54 2011 +0100
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c  Fri Jul 01 20:48:00 2011 +0100
@@ -28,6 +28,10 @@
 #include <asm/event.h> /* for local_event_delivery_(en|dis)able */
 #include <asm/p2m.h> /* p2m_get_pagetable, p2m_get_nestedp2m */
 
+
+#define NSVM_ERROR_VVMCB        1
+#define NSVM_ERROR_VMENTRY      2
+ 
 static void
 nestedsvm_vcpu_clgi(struct vcpu *v)
 {
@@ -616,13 +620,13 @@
     rc = svm_vmcb_isvalid(__func__, ns_vmcb, 1);
     if (rc) {
         gdprintk(XENLOG_ERR, "virtual vmcb invalid\n");
-        return rc;
+        return NSVM_ERROR_VVMCB;
     }
 
     rc = svm_vmcb_isvalid(__func__, n2vmcb, 1);
     if (rc) {
         gdprintk(XENLOG_ERR, "n2vmcb invalid\n");
-        return rc;
+        return NSVM_ERROR_VMENTRY;
     }
 
     /* Switch guest registers to l2 guest */
@@ -718,7 +722,15 @@
      * and l1 guest keeps alive. */
     nestedhvm_vcpu_enter_guestmode(v);
 
-    if (ret) {
+    switch (ret) {
+    case 0:
+        break;
+    case NSVM_ERROR_VVMCB:
+        gdprintk(XENLOG_ERR, "inject VMEXIT(INVALID)\n");
+        svm->ns_vmexit.exitcode = VMEXIT_INVALID;
+        return -1;
+    case NSVM_ERROR_VMENTRY:
+    default:
         gdprintk(XENLOG_ERR,
             "nsvm_vcpu_vmentry failed, injecting #UD\n");
         hvm_inject_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE, 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®.