* [PATCH] libxc: Don't call set_pod_target in case of previous memory failure
@ 2012-07-26 17:02 George Dunlap
2012-07-26 17:05 ` George Dunlap
0 siblings, 1 reply; 2+ messages in thread
From: George Dunlap @ 2012-07-26 17:02 UTC (permalink / raw)
To: xen-devel; +Cc: george.dunlap
# 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);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] libxc: Don't call set_pod_target in case of previous memory failure
2012-07-26 17:02 [PATCH] libxc: Don't call set_pod_target in case of previous memory failure George Dunlap
@ 2012-07-26 17:05 ` George Dunlap
0 siblings, 0 replies; 2+ messages in thread
From: George Dunlap @ 2012-07-26 17:05 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
On 26/07/12 18:02, George Dunlap wrote:
> # 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 )
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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-26 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26 17:02 [PATCH] libxc: Don't call set_pod_target in case of previous memory failure George Dunlap
2012-07-26 17:05 ` George Dunlap
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).