aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_core.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-12 11:09:57 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-03-12 11:09:57 +0000
commitfb0a30b839c4dbe13fafe63c47446485e86668f7 (patch)
tree0d17e3ad888417eff852fa72a1673a0b6882013a /tools/libxc/xc_core.c
parent51494c865161cd0fe83910e5c00aaafbe34da23b (diff)
downloadxen-fb0a30b839c4dbe13fafe63c47446485e86668f7.tar.gz
xen-fb0a30b839c4dbe13fafe63c47446485e86668f7.tar.bz2
xen-fb0a30b839c4dbe13fafe63c47446485e86668f7.zip
Domain core-dumping fixes
The code was attempting to use the domain's current number of pages (info.nr_pages) as a maximum index. We then walk the memory map and can easily over-write past the end of the nr_pages-sized array, if the domain has more pages mapped in than earlier (live dump). Restrict ourselves to the current number of pages. Also fix the dump core method in xend to actually implement the crash and live options. In particular this means that xend clients other than xm now get non-live dumps by default. Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/libxc/xc_core.c')
-rw-r--r--tools/libxc/xc_core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
index a7fd1647f3..ef1e8dd7a1 100644
--- a/tools/libxc/xc_core.c
+++ b/tools/libxc/xc_core.c
@@ -518,7 +518,17 @@ xc_domain_dumpcore_via_callback(int xc_handle,
if ( sts != 0 )
goto out;
+ /*
+ * Note: this is the *current* number of pages and may change under
+ * a live dump-core. We'll just take this value, and if more pages
+ * exist, we'll skip them. If there's less, then we'll just not use
+ * all the array...
+ *
+ * We don't want to use the total potential size of the memory map
+ * since that is usually much higher than info.nr_pages.
+ */
nr_pages = info.nr_pages;
+
if ( !auto_translated_physmap )
{
/* obtain p2m table */