common: map_vcpu_info() wants to unshare the underlying page
authorJan Beulich <jbeulich@suse.com>
Fri, 28 Oct 2022 09:38:32 +0000 (11:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 28 Oct 2022 09:38:32 +0000 (11:38 +0200)
Not passing P2M_UNSHARE to get_page_from_gfn() means there won't even be
an attempt to unshare the referenced page, without any indication to the
caller (e.g. -EAGAIN). Note that guests have no direct control over
which of their pages are shared (or paged out), and hence they have no
way to make sure all on their own that the subsequent obtaining of a
writable type reference can actually succeed.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
xen/common/domain.c

index 8dd6cd5a8ff5ac3e52b728f1f8e8609258cf6615..53f7e734fe08a8a6c0c7fd2090c574571d4b5b9b 100644 (file)
@@ -1484,7 +1484,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned int offset)
     if ( (v != current) && !(v->pause_flags & VPF_down) )
         return -EINVAL;
 
-    page = get_page_from_gfn(d, gfn, NULL, P2M_ALLOC);
+    page = get_page_from_gfn(d, gfn, NULL, P2M_UNSHARE);
     if ( !page )
         return -EINVAL;