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] nestedsvm: fix handling of invalid virtua

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] nestedsvm: fix handling of invalid virtual vmcb
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 08 Jul 2011 06:22:31 +0100
Delivery-date: Thu, 07 Jul 2011 22:28:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] nestedsvm: fix handling of invalid virtual vmcb, Xen patchbot-unstable <=