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

[Xen-changelog] [xen-4.2-testing] nestedsvm: fix memory leak on shutdown/crash


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-4.2-testing <patchbot@xxxxxxx>
  • Date: Thu, 25 Oct 2012 20:22:10 +0000
  • Delivery-date: Thu, 25 Oct 2012 20:22:18 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Christoph Egger <Christoph.Egger@xxxxxxx>
# Date 1351171926 -7200
# Node ID 67eb562ebe06e4fc00fe9f085e83a06099c5bc13
# Parent  d2e6d50b6cffd50048beb23e1712317fd5b26237
nestedsvm: fix memory leak on shutdown/crash

Fix memory leak of l1 vmcb page when destroying a vcpu while l2 guest
is running.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
xen-unstable changeset: 26095:a7503ce27d46
xen-unstable date: Tue Oct 23 07:13:27 UTC 2012
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r d2e6d50b6cff -r 67eb562ebe06 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c  Thu Oct 25 15:31:08 2012 +0200
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c  Thu Oct 25 15:32:06 2012 +0200
@@ -122,6 +122,15 @@ void nsvm_vcpu_destroy(struct vcpu *v)
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
 
+    /*
+     * When destroying the vcpu, it may be running on behalf of l2 guest.
+     * Therefore we need to switch the VMCB pointer back to the l1 vmcb,
+     * in order to avoid double free of l2 vmcb and the possible memory leak
+     * of l1 vmcb page.
+     */
+    if (nv->nv_n1vmcx)
+        v->arch.hvm_svm.vmcb = nv->nv_n1vmcx;
+
     if (svm->ns_cached_msrpm) {
         free_xenheap_pages(svm->ns_cached_msrpm,
                            get_order_from_bytes(MSRPM_SIZE));

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.