Skip to content

Commit 86f7e90

Browse files
ouptonbonzini
authored andcommitted
KVM: VMX: check descriptor table exits on instruction emulation
KVM emulates UMIP on hardware that doesn't support it by setting the 'descriptor table exiting' VM-execution control and performing instruction emulation. When running nested, this emulation is broken as KVM refuses to emulate L2 instructions by default. Correct this regression by allowing the emulation of descriptor table instructions if L1 hasn't requested 'descriptor table exiting'. Fixes: 07721fe ("KVM: nVMX: Don't emulate instructions in guest mode") Reported-by: Jan Kiszka <[email protected]> Cc: [email protected] Cc: Paolo Bonzini <[email protected]> Cc: Jim Mattson <[email protected]> Signed-off-by: Oliver Upton <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e951445 commit 86f7e90

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7177,6 +7177,7 @@ static int vmx_check_intercept_io(struct kvm_vcpu *vcpu,
71777177
else
71787178
intercept = nested_vmx_check_io_bitmaps(vcpu, port, size);
71797179

7180+
/* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */
71807181
return intercept ? X86EMUL_UNHANDLEABLE : X86EMUL_CONTINUE;
71817182
}
71827183

@@ -7206,6 +7207,20 @@ static int vmx_check_intercept(struct kvm_vcpu *vcpu,
72067207
case x86_intercept_outs:
72077208
return vmx_check_intercept_io(vcpu, info);
72087209

7210+
case x86_intercept_lgdt:
7211+
case x86_intercept_lidt:
7212+
case x86_intercept_lldt:
7213+
case x86_intercept_ltr:
7214+
case x86_intercept_sgdt:
7215+
case x86_intercept_sidt:
7216+
case x86_intercept_sldt:
7217+
case x86_intercept_str:
7218+
if (!nested_cpu_has2(vmcs12, SECONDARY_EXEC_DESC))
7219+
return X86EMUL_CONTINUE;
7220+
7221+
/* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */
7222+
break;
7223+
72097224
/* TODO: check more intercepts... */
72107225
default:
72117226
break;

0 commit comments

Comments
 (0)