aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2012-10-04 10:44:43 +0200
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>2012-10-04 10:44:43 +0200
commit27fa8889f4d8bc85ae695616de48804f2b10dc58 (patch)
tree73d64f7654ac97be8a36eeca599fc26af4a5e178
parentb248f2b11e052cd7dce919f5b75d0796908713e6 (diff)
downloadxen-27fa8889f4d8bc85ae695616de48804f2b10dc58.tar.gz
xen-27fa8889f4d8bc85ae695616de48804f2b10dc58.tar.bz2
xen-27fa8889f4d8bc85ae695616de48804f2b10dc58.zip
x86: check remote MMIO remap permissions
When a domain is mapping pages from a different pg_owner domain, the iomem_access checks are currently only applied to the pg_owner domain, potentially allowing a domain with a more restrictive iomem_access policy to have the pages mapped into its page tables. To catch this, also check the owner of the page tables. The current domain does not need to be checked because the ability to manipulate a domain's page tables implies full access to the target domain, so checking that domain's permission is sufficient. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Jan Beulich <jbeulich@suse.com> xen-unstable changeset: 25952:8278d7d8fa48 xen-unstable date: Wed Sep 26 09:56:07 UTC 2012
-rw-r--r--xen/arch/x86/mm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 72872eeeda..30d281d243 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -827,6 +827,16 @@ get_page_from_l1e(
return 0;
}
+ if ( pg_owner != l1e_owner &&
+ !iomem_access_permitted(l1e_owner, mfn, mfn) )
+ {
+ if ( mfn != (PADDR_MASK >> PAGE_SHIFT) ) /* INVALID_MFN? */
+ MEM_LOG("Dom%u attempted to map I/O space %08lx in dom%u to dom%u",
+ curr->domain->domain_id, mfn, pg_owner->domain_id,
+ l1e_owner->domain_id);
+ return 0;
+ }
+
if ( !(l1f & _PAGE_RW) || IS_PRIV(pg_owner) ||
!rangeset_contains_singleton(mmio_ro_ranges, mfn) )
return 1;