Skip to content

Commit e1de91c

Browse files
Sean Christophersonbonzini
authored andcommitted
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>
1 parent b4d1851 commit e1de91c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/kvm/vmx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6377,6 +6377,7 @@ static int handle_cr(struct kvm_vcpu *vcpu)
63776377
err = handle_set_cr0(vcpu, val);
63786378
return kvm_complete_insn_gp(vcpu, err);
63796379
case 3:
6380+
WARN_ON_ONCE(enable_unrestricted_guest);
63806381
err = kvm_set_cr3(vcpu, val);
63816382
return kvm_complete_insn_gp(vcpu, err);
63826383
case 4:
@@ -6409,6 +6410,7 @@ static int handle_cr(struct kvm_vcpu *vcpu)
64096410
case 1: /*mov from cr*/
64106411
switch (cr) {
64116412
case 3:
6413+
WARN_ON_ONCE(enable_unrestricted_guest);
64126414
val = kvm_read_cr3(vcpu);
64136415
kvm_register_write(vcpu, reg, val);
64146416
trace_kvm_cr_read(cr, val);

0 commit comments

Comments
 (0)