[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Do not allow HVM save/restore of a dying domain.
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |