]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Disable preemption across AVIC load/put during APICv refresh
authorSean Christopherson <seanjc@google.com>
Tue, 1 Mar 2022 17:05:09 +0000 (09:05 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 1 Mar 2022 17:21:23 +0000 (12:21 -0500)
commit49dfb0ef35156e7ac9b4f6707c6ff7128d77d541
treeae1afcfc756c1caea6d1d07a30b5618cdaab8aa7
parent9dcf51f46a55fe67718002df511e28443c88cafb
KVM: SVM: Disable preemption across AVIC load/put during APICv refresh

Disable preemption when loading/putting the AVIC during an APICv refresh.
If the vCPU task is preempted and migrated ot a different pCPU, the
unprotected avic_vcpu_load() could set the wrong pCPU in the physical ID
cache/table.

Pull the necessary code out of avic_vcpu_{,un}blocking() and into a new
helper to reduce the probability of introducing this exact bug a third
time.

Fixes: b0941c5a85f3 ("KVM: SVM: call avic_vcpu_load/avic_vcpu_put when enabling/disabling AVIC")
Cc: stable@vger.kernel.org
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/avic.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h