xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH] libxc: Don't call set_pod_target in case of previous memory failure
Date: Thu, 26 Jul 2012 18:02:22 +0100	[thread overview]
Message-ID: <f7997e838585d4f40ae5.1343322142@elijah> (raw)

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# 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 <george.dunlap@eu.citrix.com>

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 )
         rc = xc_domain_set_pod_target(xch, dom, target_pages - 0x20,
                                       NULL, NULL, NULL);

             reply	other threads:[~2012-07-26 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 17:02 George Dunlap [this message]
2012-07-26 17:05 ` [PATCH] libxc: Don't call set_pod_target in case of previous memory failure George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7997e838585d4f40ae5.1343322142@elijah \
    --to=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).