From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Lagar-Cavilla Subject: [PATCH 3 of 8] x86/mm: Allow foreign read-only mappings of shared pages Date: Wed, 25 Jan 2012 22:53:27 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: olaf@aepfle.de, tim@xen.org, andres@gridcentric.ca, adin@gridcentric.ca List-Id: xen-devel@lists.xenproject.org xen/arch/x86/mm.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) Because shared pages are owned by dom_cow, the ownership test while foreign mapping fails. Signed-off-by: Andres Lagar-Cavilla diff -r 2e7c77585adb -r c4b96d2cba06 xen/arch/x86/mm.c --- 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