KVM: x86/mmu: Always walk guest PTEs with WRITE access when unprotecting
authorSean Christopherson <seanjc@google.com>
Sat, 31 Aug 2024 00:15:28 +0000 (17:15 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 10 Sep 2024 03:16:28 +0000 (20:16 -0700)
commit29e495bdf847ac6ad0e0d03e5db39a3ed9f12858
treeca39bc1349c668ced079ec46b0cc66054f91daee
parentb7e948898e772ac900950c0dac4ca90e905cd0c0
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 <yuan.yao@intel.com>
Link: https://lore.kernel.org/r/20240831001538.336683-14-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c