[6/9] x86/HVM: relax shadow mode check in hvm_set_cr3()
diff mbox series

Message ID 392b0783-adf7-d3b3-8ed2-65fa2c537e98@suse.com
State Superseded
Headers show
Series
  • XSA-292 follow-up
Related show

Commit Message

Jan Beulich Sept. 11, 2019, 3:25 p.m. UTC
There's no need to re-obtain a page reference if only bits not affecting
the address change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Roger Pau Monné Sept. 12, 2019, 2:50 p.m. UTC | #1
On Wed, Sep 11, 2019 at 05:25:18PM +0200, Jan Beulich wrote:
> There's no need to re-obtain a page reference if only bits not affecting
> the address change.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

Patch
diff mbox series

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2326,7 +2326,7 @@  int hvm_set_cr3(unsigned long value, boo
     }
 
     if ( hvm_paging_enabled(v) && !paging_mode_hap(currd) &&
-         (value != v->arch.hvm.guest_cr[3]) )
+         ((value ^ v->arch.hvm.guest_cr[3]) >> PAGE_SHIFT) )
     {
         /* Shadow-mode CR3 change. Check PDBR and update refcounts. */
         HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);