Skip to content

Commit 29e495b

Browse files
committed
KVM: x86/mmu: Always walk guest PTEs with WRITE access when unprotecting
When getting a gpa from a gva to unprotect the associated gfn when an event is awating reinjection, walk the guest PTEs for WRITE as there's no point in unprotecting the gfn if the guest is unable to write the page, i.e. if write-protection can't trigger emulation. Note, the entire flow should be guarded on the access being a write, and even better should be conditioned on actually triggering a write-protect fault. This will be addressed in a future commit. Reviewed-by: Yuan Yao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent b7e9488 commit 29e495b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,7 @@ static int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva)
27512751
if (vcpu->arch.mmu->root_role.direct)
27522752
return 0;
27532753

2754-
gpa = kvm_mmu_gva_to_gpa_read(vcpu, gva, NULL);
2754+
gpa = kvm_mmu_gva_to_gpa_write(vcpu, gva, NULL);
27552755
if (gpa == INVALID_GPA)
27562756
return 0;
27572757

0 commit comments

Comments
 (0)