summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorSean Christopherson2018-03-05 21:04:41 +0100
committerPaolo Bonzini2018-03-16 22:01:37 +0100
commite1de91ccab311ec8007c6e77b0dbb4e3421fd298 (patch)
tree3b249e0301fd77aa6c215fab074e9a09d8bb8a3c /arch/x86/kvm/vmx.c
parentKVM: VMX: give unrestricted guest full control of CR3 (diff)
downloadkernel-qcow2-linux-e1de91ccab311ec8007c6e77b0dbb4e3421fd298.tar.gz
kernel-qcow2-linux-e1de91ccab311ec8007c6e77b0dbb4e3421fd298.tar.xz
kernel-qcow2-linux-e1de91ccab311ec8007c6e77b0dbb4e3421fd298.zip
KVM: VMX: WARN on a MOV CR3 exit w/ unrestricted guest
CR3 load/store exiting are always off when unrestricted guest is enabled. WARN on the associated CR3 VMEXIT to detect code that would re-introduce CR3 load/store exiting for unrestricted guest. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c517e966b829..6cefd7b3ff7f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6377,6 +6377,7 @@ static int handle_cr(struct kvm_vcpu *vcpu)
err = handle_set_cr0(vcpu, val);
return kvm_complete_insn_gp(vcpu, err);
case 3:
+ WARN_ON_ONCE(enable_unrestricted_guest);
err = kvm_set_cr3(vcpu, val);
return kvm_complete_insn_gp(vcpu, err);
case 4:
@@ -6409,6 +6410,7 @@ static int handle_cr(struct kvm_vcpu *vcpu)
case 1: /*mov from cr*/
switch (cr) {
case 3:
+ WARN_ON_ONCE(enable_unrestricted_guest);
val = kvm_read_cr3(vcpu);
kvm_register_write(vcpu, reg, val);
trace_kvm_cr_read(cr, val);