Skip to contentSkip to conversation

x86/shadow: unconditionally set the p2m/log-dirty allocation functions

PATCH New Tim Deegan 1 participant 1 message Feb 14, 2011

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 x86/shadow: unconditionally set the p2m/log-dirty allocation functions

Otherwise enabling log-dirty mode on a PV guest that already has a shadow allocation can leave the alloc/free functions pointers NULL, and later try to dereference them.

# HG changeset patch
# User Tim Deegan <[email protected]>
# Date 1297690988 0
# Node ID 2af74339b90422fc26ba7aebd7868b1eb802de2f
# Parent 20140bcb4c047c5410594b3acc9e8b1f243b8ff9 x86/shadow: unconditionally set the p2m/log-dirty allocation functions.

Otherwise enabling log-dirty mode on a PV guest that already has a shadow allocation can leave the alloc/free functions pointers NULL, and later try to dereference them.

xen/arch/x86/mm/shadow/common.c +4 -4
diff -r 20140bcb4c04 -r 2af74339b904 xen/arch/x86/mm/shadow/common.c
@@ -3337,12 +3337,12 @@ static int shadow_one_bit_enable(struct 
             sh_set_allocation(d, 0, NULL);
             return -ENOMEM;
         }
-
-        /* Allow p2m and log-dirty code to borrow shadow memory */
-        d->arch.paging.alloc_page = shadow_alloc_p2m_page;
-        d->arch.paging.free_page = shadow_free_p2m_page;
     }
 
+    /* Allow p2m and log-dirty code to borrow shadow memory */
+    d->arch.paging.alloc_page = shadow_alloc_p2m_page;
+    d->arch.paging.free_page = shadow_free_p2m_page;
+
     if ( d->arch.paging.mode == 0 )
     {
         /* Init the shadow hash table */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel