Skip to content

Commit aa0d42c

Browse files
sean-jcbonzini
authored andcommitted
KVM: VMX: Bury Intel PT virtualization (guest/host mode) behind CONFIG_BROKEN
Hide KVM's pt_mode module param behind CONFIG_BROKEN, i.e. disable support for virtualizing Intel PT via guest/host mode unless BROKEN=y. There are myriad bugs in the implementation, some of which are fatal to the guest, and others which put the stability and health of the host at risk. For guest fatalities, the most glaring issue is that KVM fails to ensure tracing is disabled, and *stays* disabled prior to VM-Enter, which is necessary as hardware disallows loading (the guest's) RTIT_CTL if tracing is enabled (enforced via a VMX consistency check). Per the SDM: If the logical processor is operating with Intel PT enabled (if IA32_RTIT_CTL.TraceEn = 1) at the time of VM entry, the "load IA32_RTIT_CTL" VM-entry control must be 0. On the host side, KVM doesn't validate the guest CPUID configuration provided by userspace, and even worse, uses the guest configuration to decide what MSRs to save/load at VM-Enter and VM-Exit. E.g. configuring guest CPUID to enumerate more address ranges than are supported in hardware will result in KVM trying to passthrough, save, and load non-existent MSRs, which generates a variety of WARNs, ToPA ERRORs in the host, a potential deadlock, etc. Fixes: f99e3da ("KVM: x86: Add Intel PT virtualization work mode") Cc: [email protected] Cc: Adrian Hunter <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Xiaoyao Li <[email protected]> Tested-by: Adrian Hunter <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d3ddef4 commit aa0d42c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,11 @@ module_param(ple_window_shrink, uint, 0444);
217217
static unsigned int ple_window_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX;
218218
module_param(ple_window_max, uint, 0444);
219219

220-
/* Default is SYSTEM mode, 1 for host-guest mode */
220+
/* Default is SYSTEM mode, 1 for host-guest mode (which is BROKEN) */
221221
int __read_mostly pt_mode = PT_MODE_SYSTEM;
222+
#ifdef CONFIG_BROKEN
222223
module_param(pt_mode, int, S_IRUGO);
224+
#endif
223225

224226
struct x86_pmu_lbr __ro_after_init vmx_lbr_caps;
225227

0 commit comments

Comments
 (0)