xen: arm: ensure we hold a reference to guest pages while we copy to/from them
authorIan Campbell <ian.campbell@citrix.com>
Wed, 4 Jun 2014 13:58:38 +0000 (14:58 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 4 Jun 2014 13:58:38 +0000 (14:58 +0100)
commit278283cd0b81fe5e026a95c71ea769797411076b
tree7d8dfc2f6c1846c9983930abd6c60176bb617b84
parent0fbaa84f60af1c27dcc78a6154d64227381e72e9
xen: arm: ensure we hold a reference to guest pages while we copy to/from them

This at once:
 - prevents the page from being reassigned under our feet
 - ensures that the domain owns the page, which stops a domain from giving a
   grant mapping, MMIO region, other non-RAM as a hypercall input/output.

We need to hold the p2m lock while doing the lookup until we have the
reference.

This also requires that during domain 0 building current is set to an actual
dom0 vcpu, so take care of this at the same time as the p2m is temporarily
loaded.

Lastly when dumping the guest stack we need to make sure that the guest hasn't
pointed its sp off into the weeds and/or misaligned it, which could lead to
hypervisor traps. Solve this by using the new function and checking alignment
first.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
xen/arch/arm/domain_build.c
xen/arch/arm/guestcopy.c
xen/arch/arm/p2m.c
xen/arch/arm/traps.c
xen/include/asm-arm/mm.h
xen/include/asm-arm/page.h