From: Sean Christopherson Date: Fri, 19 Sep 2025 00:59:52 +0000 (-0700) Subject: KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0 X-Git-Tag: v6.19-rc1~103^2~5^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae8e6ad84177456d8810a8ff3a5cf3f477fb0721;p=thirdparty%2Fkernel%2Flinux.git KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0 Add a missing consistency check on the TSC Multiplier being '0'. Per the SDM: If the "use TSC scaling" VM-execution control is 1, the TSC-multiplier must not be zero. Fixes: d041b5ea9335 ("KVM: nVMX: Enable nested TSC scaling") Link: https://lore.kernel.org/r/20250919005955.1366256-7-seanjc@google.com Signed-off-by: Sean Christopherson --- diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index ffd2628b9c1ea..77b5f75cc2bb5 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2962,6 +2962,10 @@ static int nested_check_vm_execution_controls(struct kvm_vcpu *vcpu, } } + if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_TSC_SCALING) && + CC(!vmcs12->tsc_multiplier)) + return -EINVAL; + return 0; }