Skip to content

Commit 6c7c519

Browse files
Ravi Bangoriagregkh
authored andcommitted
KVM: SVM: Don't advertise Bus Lock Detect to guest if SVM support is missing
commit 54950bf upstream. If host supports Bus Lock Detect, KVM advertises it to guests even if SVM support is absent. Additionally, guest wouldn't be able to use it despite guest CPUID bit being set. Fix it by unconditionally clearing the feature bit in KVM cpu capability. Reported-by: Jim Mattson <jmattson@google.com> Closes: https://lore.kernel.org/r/CALMp9eRet6+v8Y1Q-i6mqPm4hUow_kJNhmVHfOV8tMfuSS=tVg@mail.gmail.com Fixes: 76ea438 ("KVM: X86: Expose bus lock debug exception to guest") Cc: stable@vger.kernel.org Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com> Reviewed-by: Jim Mattson <jmattson@google.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Link: https://lore.kernel.org/r/20240808062937.1149-4-ravi.bangoria@amd.com Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c98bb4f commit 6c7c519

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/x86/kvm/svm/svm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5178,6 +5178,9 @@ static __init void svm_set_cpu_caps(void)
51785178

51795179
/* CPUID 0x8000001F (SME/SEV features) */
51805180
sev_set_cpu_caps();
5181+
5182+
/* Don't advertise Bus Lock Detect to guest if SVM support is absent */
5183+
kvm_cpu_cap_clear(X86_FEATURE_BUS_LOCK_DETECT);
51815184
}
51825185

51835186
static __init int svm_hardware_setup(void)

0 commit comments

Comments
 (0)