hvm: Fix CR0.WP=0 emulation. Don't take write emulation path for MMIO.
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Dec 2009 07:52:22 +0000 (07:52 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Dec 2009 07:52:22 +0000 (07:52 +0000)
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/multi.c

index dc288fd36490a4a10043372d02c0b564eb49c3d9..434d56753688ca10720ecb7b36cf8d5b5c5c7392 100644 (file)
@@ -2752,6 +2752,7 @@ void sh_remove_shadows(struct vcpu *v, mfn_t gmfn, int fast, int all)
     };
 
     ASSERT(!(all && fast));
+    ASSERT(mfn_valid(gmfn));
 
     /* Although this is an externally visible function, we do not know
      * whether the shadow lock will be held when it is called (since it
index 4675eab675bf78dbadffb5e1cb1097ec0af3feb8..49f8349cd2b15e9bb3694c0ac5686146ea454f77 100644 (file)
@@ -3305,7 +3305,8 @@ static int sh_page_fault(struct vcpu *v,
      * fault was a non-user write to a present page.  */
     if ( is_hvm_domain(d) 
          && unlikely(!hvm_wp_enabled(v)) 
-         && regs->error_code == (PFEC_write_access|PFEC_page_present) )
+         && regs->error_code == (PFEC_write_access|PFEC_page_present)
+         && mfn_valid(gmfn) )
     {
         perfc_incr(shadow_fault_emulate_wp);
         goto emulate;