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] Do not allow HVM save/restore of a dying

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Do not allow HVM save/restore of a dying domain.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Jul 2008 06:30:15 -0700
Delivery-date: Thu, 03 Jul 2008 06:30:21 -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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1215015052 -3600
# Node ID 3a40a6997cc0610a17136fd38da1d0a1f94d932b
# Parent  b3d827e63a09d8d54b5bea688c2bb5d953d1464f
Do not allow HVM save/restore of a dying domain.

It's not a sensible thing to do, and it is easier than auditing all
state save/restore functions for safety (most importantly, racing
against domain_relinquish_resources).

Also place a spin_barrier on domain_lock after asserting d->is_dying,
allowing critical regions under the domain_lock to safely check
is_dying and avoid races with domain_relinquish_resources().

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/domain.c   |    1 +
 xen/common/hvm/save.c |    6 ++++++
 2 files changed, 7 insertions(+)

diff -r b3d827e63a09 -r 3a40a6997cc0 xen/common/domain.c
--- a/xen/common/domain.c       Wed Jul 02 13:54:20 2008 +0100
+++ b/xen/common/domain.c       Wed Jul 02 17:10:52 2008 +0100
@@ -341,6 +341,7 @@ int domain_kill(struct domain *d)
     case DOMDYING_alive:
         domain_pause(d);
         d->is_dying = DOMDYING_dying;
+        spin_barrier(&d->domain_lock);
         evtchn_destroy(d);
         gnttab_release_mappings(d);
         /* fallthrough */
diff -r b3d827e63a09 -r 3a40a6997cc0 xen/common/hvm/save.c
--- a/xen/common/hvm/save.c     Wed Jul 02 13:54:20 2008 +0100
+++ b/xen/common/hvm/save.c     Wed Jul 02 17:10:52 2008 +0100
@@ -84,6 +84,9 @@ int hvm_save(struct domain *d, hvm_domai
     hvm_save_handler handler;
     uint16_t i;
 
+    if ( d->is_dying )
+        return -EINVAL;
+
     hdr.magic = HVM_FILE_MAGIC;
     hdr.version = HVM_FILE_VERSION;
 
@@ -140,6 +143,9 @@ int hvm_load(struct domain *d, hvm_domai
     hvm_load_handler handler;
     struct vcpu *v;
     
+    if ( d->is_dying )
+        return -EINVAL;
+
     /* Read the save header, which must be first */
     if ( hvm_load_entry(HEADER, h, &hdr) != 0 ) 
         return -1;

_______________________________________________
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] Do not allow HVM save/restore of a dying domain., Xen patchbot-unstable <=