From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH] libxc: Don't call set_pod_target in case of previous memory failure Date: Thu, 26 Jul 2012 18:05:41 +0100 Message-ID: <501178E5.80701@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 26/07/12 18:02, George Dunlap wrote: > # HG changeset patch > # User George Dunlap > # Date 1343320554 -3600 > # Node ID f7997e838585d4f40ae5dc14541f8efe71ce3c55 > # Parent b63d4890d15e74b4c8ca45607563245076b3e770 > libxc: Don't call set_pod_target in case of previous memory failure > > The while() loop in the memory allocation section of the hvm builder > is where the actual check for failure of memory alloction happens. If > the domain is being built in PoD mode, however, this value may be > clobbered by a call to xc_domain_set_pod_target() before erroring out. > There is a very small chance that after xc_domain_populate_physmap() > fails, that somehow set_pod_target() will succeed, leaving a domain > with only a partially created address space. > > This patch modifies the builder to check that there have not been any > errors so far before calling xc_domain_set_pod_target(). > > Signed-off-by: George Dunlap > > diff --git a/tools/libxc/xc_hvm_build_x86.c b/tools/libxc/xc_hvm_build_x86.c > --- a/tools/libxc/xc_hvm_build_x86.c > +++ b/tools/libxc/xc_hvm_build_x86.c > @@ -311,7 +311,7 @@ static int setup_guest(xc_interface *xch > /* Subtract 0x20 from target_pages for the VGA "hole". Xen will > * adjust the PoD cache size so that domain tot_pages will be > * target_pages - 0x20 after this call. */ > - if ( pod_mode ) > + if ( rc != 0 && pod_mode ) Gah, sorry -- got the polarity wrong on this one... please ignore... -George > rc = xc_domain_set_pod_target(xch, dom, target_pages - 0x20, > NULL, NULL, NULL); >