]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: x86: Apply retry protection to "unprotect on failure" path
authorSean Christopherson <seanjc@google.com>
Sat, 31 Aug 2024 00:15:32 +0000 (17:15 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 10 Sep 2024 03:16:32 +0000 (20:16 -0700)
commitdabc4ff70c35756bc107bc5d035d0f0746396a9a
tree16505c94d9f0eac43b94b73dcff3b6031d3fa410
parent19ab2c8be070160be70a88027b3b93106fef7b89
KVM: x86: Apply retry protection to "unprotect on failure" path

Use kvm_mmu_unprotect_gfn_and_retry() in reexecute_instruction() to pick
up protection against infinite loops, e.g. if KVM somehow manages to
encounter an unsupported instruction and unprotecting the gfn doesn't
allow the vCPU to make forward progress.  Other than that, the retry-on-
failure logic is a functionally equivalent, open coded version of
kvm_mmu_unprotect_gfn_and_retry().

Note, the emulation failure path still isn't fully protected, as KVM
won't update the retry protection fields if no shadow pages are zapped
(but this change is still a step forward).  That flaw will be addressed
in a future patch.

Reviewed-by: Yuan Yao <yuan.yao@intel.com>
Link: https://lore.kernel.org/r/20240831001538.336683-18-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c