x86/hvm: fix domain crash when CR3 has the noflush bit set
authorRazvan Cojocaru <rcojocaru@bitdefender.com>
Wed, 28 Feb 2018 10:38:15 +0000 (12:38 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 28 Feb 2018 17:56:24 +0000 (17:56 +0000)
commitb68c4f1ebe4f413076c4915733a61c818b7dc73a
tree72f299e7420eab89a8a18a12f232de1caba7f1d8
parentcb671efbf1fae302c0ee5ebd6e23564e319babc8
x86/hvm: fix domain crash when CR3 has the noflush bit set

In hardware, when PCID support is enabled and the NOFLUSH bit is set
when writing a CR3 value, the hardware will clear that that bit and
change the CR3 without flushing the TLB. hvm_set_cr3(), however, was
ignoring this bit; the result was that post-vm_event checks detected
an invalid CR3 value and crashed the domain.

Handle NOFLUSH in hvm_set_cr3() by:
1. Clearing the bit
2. Passing a "noflush" flag to lower-level cr3 setting functions to
indicate that a flush should not be performed.

Also clear X86_CR3_NOFLUSH when reporting CR3 monitored CR3 writes.

This allows introspection to be used on VMs whose operating system uses
the NOFLUSH bit.

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reported-by: Bitweasil <bitweasil@cryptohaze.com>
Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
13 files changed:
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/monitor.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/mm.c
xen/arch/x86/mm/hap/hap.c
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/multi.c
xen/arch/x86/mm/shadow/none.c
xen/include/asm-x86/hvm/hvm.h
xen/include/asm-x86/hvm/svm/svm.h
xen/include/asm-x86/paging.h
xen/include/asm-x86/x86-defns.h