|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: fix a variable underflow in libxl_wait_for_free_memory
# HG changeset patch
# User Ronny Hegewald <ronny.hegewald@xxxxxxxxx>
# Date 1354025619 0
# Node ID 678718a2e565ee0e45fcfd7606d99d30ab038cbe
# Parent 48a02f60bf1e4be1f376a848fb6800e4caf333b6
libxl: fix a variable underflow in libxl_wait_for_free_memory
When xl is called to create a domU and there is not enough memory available,
then the autoballooning is called to extract memory from dom0. During the
ballooning a loop in libxl_wait_for_free_memory() waits unless enough memory
is available to create the domU.
But because of a variable-underflow the loop can finish too soon and xl
finally aborts with the message:
xc: error: panic: xc_dom_boot.c:161: xc_dom_boot_mem_init: can't allocate low
memory for domain: Out of memory
libxl: error: libxl_dom.c:430:libxl__build_pv: xc_dom_boot_mem_init failed:
Device or resource busy
libxl: error: libxl_create.c:901:domcreate_rebuild_done: cannot (re-)build
domain: -3
The variable-underflow happens when freemem_slack is larger then
info.free_pages*4, because the solution of this operation is converted
implicit to a unsigned int to match the type of memory_kb.
Add a extra check for this condition to solve the problem.
Signed-off-by: Ronny Hegewald <Ronny.Hegewald@xxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
diff -r 48a02f60bf1e -r 678718a2e565 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Tue Nov 27 14:13:38 2012 +0000
+++ b/tools/libxl/libxl.c Tue Nov 27 14:13:39 2012 +0000
@@ -3764,7 +3764,8 @@ int libxl_wait_for_free_memory(libxl_ctx
rc = libxl_get_physinfo(ctx, &info);
if (rc < 0)
goto out;
- if (info.free_pages * 4 - freemem_slack >= memory_kb) {
+ if (info.free_pages * 4 >= freemem_slack &&
+ info.free_pages * 4 - freemem_slack >= memory_kb) {
rc = 0;
goto out;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |