tools/libs/ctrl: fix dumping of ballooned guest
authorJuergen Gross <jgross@suse.com>
Wed, 11 Nov 2020 10:01:43 +0000 (11:01 +0100)
committerWei Liu <wl@xen.org>
Fri, 4 Dec 2020 13:35:46 +0000 (13:35 +0000)
commit5e666356a9d55fbd9eb5b8506088aa760e107b5b
tree2af6833c4f34a62573e38ba01bed213127e1a4c6
parenta00b271677bfa6365cd0446e09a0f41017e166d3
tools/libs/ctrl: fix dumping of ballooned guest

A guest with memory < maxmem often can't be dumped via xl dump-core
without an error message today:

xc: info: exceeded nr_pages (262144) losing pages

In case the last page of the guest isn't allocated the loop in
xc_domain_dumpcore_via_callback() will always spit out this message,
as the number of already dumped pages is tested before the next page
is checked to be valid.

The guest's p2m_size might be lower than expected, so this should be
tested in order to avoid reading past the end of it.

The guest might use high bits in p2m entries to flag special cases like
foreign mappings. Entries with an MFN larger than the highest MFN of
the host should be skipped.

Signed-off-by: Juergen Gross <jgross@suse.com>
tools/libs/ctrl/xc_core.c