libxc: move temporary grant table mapping to end of memory
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 13 Nov 2013 08:26:13 +0000 (09:26 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 13 Nov 2013 08:26:13 +0000 (09:26 +0100)
commitdb062c28f30eb68d1b5d7a910445a0ba1136179a
treeef72785c80dc37875d7bf3c517b212d9e190ec6e
parentde5ce1e3921e86b7b8176d85eaa3263aadba637d
libxc: move temporary grant table mapping to end of memory

In order to set up the grant table for HVM guests, libxc needs to map
the grant table temporarily.  At the moment, it does this by adding the
grant page to the HVM guest's p2m table in the MMIO hole (at gfn 0xFFFFE),
then mapping that gfn, setting up the table, then unmapping the gfn and
removing it from the p2m table.

This breaks with PVH guests with 4G or more of ram, because there is
no MMIO hole; so it ends up clobbering a valid RAM p2m entry, then
leaving a "hole" when it removes the grant map from the p2m table.
Since the guest thinks this is normal ram, when it maps it and tries
to access the page, it crashes.

This patch maps the page at max_gfn+1 instead.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Eddie Dong <eddie.dong@intel.com>
tools/libxc/xc_dom.h
tools/libxc/xc_dom_boot.c