]> xenbits.xensource.com Git - xen.git/commit
arch/x86: use XSM hooks for get_pg_owner access checks
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Fri, 11 Jan 2013 10:39:58 +0000 (10:39 +0000)
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>
Fri, 11 Jan 2013 10:39:58 +0000 (10:39 +0000)
commitaaba7a677dfc5e42aa4064565948cb2632f83dd5
tree7bbde147754b565d210197065dee9010148aed28
parent79cd41ecce31b91f0456b57ca1b3cdacde405388
arch/x86: use XSM hooks for get_pg_owner access checks

There are three callers of get_pg_owner:
 * do_mmuext_op, which does not have XSM hooks on all subfunctions
 * do_mmu_update, which has hooks that are inefficient
 * do_update_va_mapping_otherdomain, which has a simple XSM hook

In order to preserve return values for the do_mmuext_op hypercall, an
additional XSM hook is required to check the operation even for those
subfunctions that do not use the pg_owner field. This also covers the
MMUEXT_UNPIN_TABLE operation which did previously have an XSM hook.

The XSM hooks in do_mmu_update were capable of replacing the checks in
get_pg_owner; however, the hooks are buried in the inner loop of the
function - not very good for performance when XSM is enabled and these
turn in to indirect function calls. This patch removes the PTE from
the hooks and replaces it with a bitfield describing what accesses are
being requested. The XSM hook can then be called only when additional
bits are set instead of once per iteration of the loop.

This patch results in a change in the FLASK permissions used for
mapping an MMIO page: the target for the permisison check on the
memory mapping is no longer resolved to the device-specific type, and
is instead either the domain's own type or domio_t (depending on if
the domain uses DOMID_SELF or DOMID_IO in the map
command). Device-specific access is still controlled via the "resource
use" permisison checked at domain creation (or device hotplug).

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
tools/flask/policy/policy/modules/xen/xen.if
tools/flask/policy/policy/modules/xen/xen.te
xen/arch/x86/mm.c
xen/include/xsm/dummy.h
xen/include/xsm/xsm.h
xen/xsm/dummy.c
xen/xsm/flask/hooks.c
xen/xsm/flask/policy/access_vectors