Skip to contentSkip to conversation

32on64 vCPU cleanup fix

PATCH In review Jan Beulich 2 participants 2 messages Apr 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 32on64 vCPU cleanup fix

Since vcpu_destroy_pagetables() clears v->arch.guest_table for hvm vCPUs, it must be avoided to free the page with MFN zero.

xen/arch/x86/domain.c +6 -3
Index: 2007-04-18/xen/arch/x86/domain.c
===================================================================
@@ -252,9 +252,12 @@ static int setup_compat_l4(struct vcpu *
 
 static void release_compat_l4(struct vcpu *v)
 {
-    free_domheap_page(pagetable_get_page(v->arch.guest_table));
-    v->arch.guest_table = pagetable_null();
-    v->arch.guest_table_user = pagetable_null();
+    if ( !pagetable_is_null(v->arch.guest_table) )
+    {
+        free_domheap_page(pagetable_get_page(v->arch.guest_table));
+        v->arch.guest_table = pagetable_null();
+        v->arch.guest_table_user = pagetable_null();
+    }
 }
 
 static inline int may_switch_mode(struct domain *d)
#1 lore raw
Quoted 2 lines · Jan Beulich

Since vcpu_destroy_pagetables() clears v->arch.guest_table for hvm vCPUs, it must be avoided to free the page with MFN zero.

Up to yesterday there was never a case that we'd have an HVM vcpu with IS_COMPAT()==1 (although there was some code that tried to handle this case). Now that we support this there's a general need for a cleanup so that code that is compat-mode-dependent explicitly checks for PV vs. HVM if that matters to it.

I've applied an initial general fix as c/s 14961:f18e1ca6. I think everything else is okay, but I'm not 100% sure about shadow code (although that was one place that was explicitly checking for PV 32bit guests where it cared, so I hope it's okay).

Please take a look and make sure I'm not very confused about what's going on. :-)

-- Keir