]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/mem-sharing: Don't leave the altp2m lock held when nominating a page
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 7 Nov 2018 12:25:26 +0000 (12:25 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 22 Nov 2018 17:58:46 +0000 (17:58 +0000)
get_gfn_type_access() internally takes the p2m lock, and nothing ever unlocks
it.  Switch to using the unlocked accessor instead.

This wasn't included in XSA-277 because neither mem-sharing nor altp2m are
supported.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm/mem_sharing.c

index f4c5074849d6da44bd7c3826c85e6f1585d01309..77f0d3fb0a964cb6f5bb63aa6f0159bc2bd05249 100644 (file)
@@ -820,7 +820,8 @@ static int nominate_page(struct domain *d, gfn_t gfn,
             if ( !ap2m )
                 continue;
 
-            amfn = get_gfn_type_access(ap2m, gfn_x(gfn), &ap2mt, &ap2ma, 0, NULL);
+            amfn = __get_gfn_type_access(ap2m, gfn_x(gfn), &ap2mt, &ap2ma,
+                                         0, NULL, false);
             if ( mfn_valid(amfn) && (!mfn_eq(amfn, mfn) || ap2ma != p2ma) )
             {
                 altp2m_list_unlock(d);