This is a note to let you know that I've just added the patch titled x86: KVM: SVM: always update the x2avic msr interception to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-kvm-svm-always-update-the-x2avic-msr-interception.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b65235f6e102354ccafda601eaa1c5bef5284d21 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky <mlevitsk@xxxxxxxxxx> Date: Thu, 28 Sep 2023 20:33:51 +0300 Subject: x86: KVM: SVM: always update the x2avic msr interception From: Maxim Levitsky <mlevitsk@xxxxxxxxxx> commit b65235f6e102354ccafda601eaa1c5bef5284d21 upstream. The following problem exists since x2avic was enabled in the KVM: svm_set_x2apic_msr_interception is called to enable the interception of the x2apic msrs. In particular it is called at the moment the guest resets its apic. Assuming that the guest's apic was in x2apic mode, the reset will bring it back to the xapic mode. The svm_set_x2apic_msr_interception however has an erroneous check for '!apic_x2apic_mode()' which prevents it from doing anything in this case. As a result of this, all x2apic msrs are left unintercepted, and that exposes the bare metal x2apic (if enabled) to the guest. Oops. Remove the erroneous '!apic_x2apic_mode()' check to fix that. This fixes CVE-2023-5090 Fixes: 4d1d7942e36a ("KVM: SVM: Introduce logic to (de)activate x2AVIC mode") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> Tested-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx> Message-Id: <20230928173354.217464-2-mlevitsk@xxxxxxxxxx> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/svm/svm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -829,8 +829,7 @@ void svm_set_x2apic_msr_interception(str if (intercept == svm->x2avic_msrs_intercepted) return; - if (!x2avic_enabled || - !apic_x2apic_mode(svm->vcpu.arch.apic)) + if (!x2avic_enabled) return; for (i = 0; i < MAX_DIRECT_ACCESS_MSRS; i++) { Patches currently in stable-queue which might be from mlevitsk@xxxxxxxxxx are queue-6.5/x86-kvm-svm-add-support-for-invalid-ipi-vector-interception.patch queue-6.5/x86-kvm-svm-refresh-avic-inhibition-in-svm_leave_nested.patch queue-6.5/x86-kvm-svm-always-update-the-x2avic-msr-interception.patch