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 error path when VMRUN emul

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] nestedsvm: fix error path when VMRUN emulation fails
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 14 May 2011 07:15:52 +0100
Delivery-date: Fri, 13 May 2011 23:16:57 -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 1305187082 -3600
# Node ID b6e8e916ed2827fb1329de0de2e23ee5b6b78662
# Parent  8489494ee490cdf25e4d5132b871216e85c92836
nestedsvm: fix error path when VMRUN emulation fails

With this, l1 guest keeps alive rather crashing the host.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Acked-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---


diff -r 8489494ee490 -r b6e8e916ed28 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c  Thu May 12 08:57:08 2011 +0100
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c  Thu May 12 08:58:02 2011 +0100
@@ -656,17 +656,21 @@
 
     /* save host state */
     ret = nsvm_vcpu_vmentry(v, regs, inst_len);
+
+    /* Switch vcpu to guest mode. In the error case
+     * this ensures the host mode is restored correctly
+     * and l1 guest keeps alive. */
+    nestedhvm_vcpu_enter_guestmode(v);
+
     if (ret) {
         gdprintk(XENLOG_ERR,
             "nsvm_vcpu_vmentry failed, injecting #UD\n");
         hvm_inject_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE, 0);
+        /* Must happen after hvm_inject_exception or it doesn't work right. */
         nv->nv_vmswitch_in_progress = 0;
         return 1;
     }
 
-    /* Switch vcpu to guest mode
-     */
-    nestedhvm_vcpu_enter_guestmode(v);
     nv->nv_vmswitch_in_progress = 0;
     return 0;
 }
@@ -1329,7 +1333,7 @@
         int ret;
         ASSERT(!nv->nv_vmexit_pending);
         ret = nsvm_vcpu_vmrun(v, regs);
-        if (ret < 0)
+        if (ret)
             goto vmexit;
 
         ASSERT(nestedhvm_vcpu_in_guestmode(v));

_______________________________________________
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 error path when VMRUN emulation fails, Xen patchbot-unstable <=