From: Andres Lagar-Cavilla Date: Thu, 26 Jan 2012 13:21:27 +0000 (+0000) Subject: x86/mm: Allow foreign read-only mappings of shared pages X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8e98287101d630a19d694fdfa01c5f716d96470c;p=xen.git x86/mm: Allow foreign read-only mappings of shared pages Because shared pages are owned by dom_cow, the ownership test while foreign mapping fails. Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 2183bade33..fc954bb8e3 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -878,7 +878,8 @@ get_page_from_l1e( return 1; } - if ( unlikely(real_pg_owner != pg_owner) ) + if ( unlikely( (real_pg_owner != pg_owner) && + (real_pg_owner != dom_cow) ) ) { /* * Let privileged domains transfer the right to map their target @@ -892,6 +893,11 @@ get_page_from_l1e( pg_owner = real_pg_owner; } + /* Extra paranoid check for shared memory. Writable mappings + * disallowed (unshare first!) */ + if ( (l1f & _PAGE_RW) && (real_pg_owner == dom_cow) ) + goto could_not_pin; + /* Foreign mappings into guests in shadow external mode don't * contribute to writeable mapping refcounts. (This allows the * qemu-dm helper process in dom0 to map the domain's memory without