summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2026-10-28 12:02:59 -0700
committerSean Christopherson <seanjc@google.com>2026-11-09 17:02:28 -0800
commitfd3dd4d9c18638fdbeed2985681e90c1585e0ddd (patch)
treebb220efd52f577d648bf79ac547835c9ee735bf6 /scripts
parent5c430e211f4dafdd7ebcf83d7dcc69d5711b1132 (diff)
KVM: Drop kvm_vcpu_should_kick() and use kvm_request_needs_ipi()
Drop kvm_vcpu_should_kick() in favor of kvm_request_needs_ipi() to fix a bug where KVM will fail to wait for a vCPU to exit guest mode if the vCPU was already marked as EXITING_GUEST_MODE by a concurrent non-waiting kick. Because kvm_vcpu_should_kick() (was kvm_arch_vcpu_should_kick()) only waits (and sends an IPI to do so) if the target vCPU is fully IN_GUEST_MODE, the sending task will proceed even though it hasn't actually guaranteed the vCPU as fully exited the guest. The flaw is most problematic for SNP VMSA invalidation with in-place gmem conversion, as KVM invokes kvm_gmem_invalidate_start() => rmp_make_shared() (via kvm_gmem_make_shared() in quick succession when in-place conversion is enabled. I.e. if the target has been marked as EXITING_GUEST_MODE but has not yet received the other kicker's IPI, then updating the RMP will fail as the VMSA is still in-use and subsequent accesses to the page will encounter unexpected RMP #PFs. Note, the bug exists and affects VMSA invalidation even without in-place conversion, but is significantly more difficult to hit as PUNCH_HOLE and .release() have to wade through a lot more code and several locks to get from invalidation to kvm_gmem_free_folio(). Note #2, currently only x86 uses kvm_make_request_and_kick(), i.e. this is a glorified nop for all other architectures as the KVM_REQUEST_WAIT path is never taken. Fixes: 309d28576f0a ("KVM: SVM: Fix SNP AP destroy race with VMRUN") Fixes: d1a3c2162334 ("KVM: SEV: Forcefully invalidate SNP VMSA if its backing gmem page is zapped") Reported-by: Stefan Teodorescu <fane@google.com> Link: https://patch.msgid.link/20261028190259.1819571-8-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions