]> xenbits.xensource.com Git - xen.git/commitdiff
memory: don't hand MFN info to translated guests
authorJan Beulich <jbeulich@suse.com>
Wed, 5 Apr 2017 14:39:53 +0000 (16:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 5 Apr 2017 14:39:53 +0000 (16:39 +0200)
We shouldn't hand MFN info back from increase-reservation for
translated domains, just like we don't for populate-physmap and
memory-exchange. For full symmetry also check for a NULL guest handle
in populate_physmap() (but note this makes no sense in
memory_exchange(), as there the array is also an input).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Released-acked-by: Julien Grall <julien.grall@arm.com>
xen/common/memory.c

index bed43e236d5fc18b2a6f54a2652f9a21e8001ce4..52879e74387ce6050e6304a629efe996294fc4d2 100644 (file)
@@ -122,7 +122,8 @@ static void increase_reservation(struct memop_args *a)
         }
 
         /* Inform the domain of the new page's machine address. */ 
-        if ( !guest_handle_is_null(a->extent_list) )
+        if ( !paging_mode_translate(d) &&
+             !guest_handle_is_null(a->extent_list) )
         {
             mfn = page_to_mfn(page);
             if ( unlikely(__copy_to_guest_offset(a->extent_list, i, &mfn, 1)) )
@@ -238,7 +239,8 @@ static void populate_physmap(struct memop_args *a)
 
             guest_physmap_add_page(d, _gfn(gpfn), _mfn(mfn), a->extent_order);
 
-            if ( !paging_mode_translate(d) )
+            if ( !paging_mode_translate(d) &&
+                 !guest_handle_is_null(a->extent_list) )
             {
                 for ( j = 0; j < (1U << a->extent_order); j++ )
                     set_gpfn_from_mfn(mfn + j, gpfn + j);