[PATCH 08/12] KVM: arm64: Force PTE mapping on fault resulting in a device mapping

Marc Zyngier maz at kernel.org
Fri Oct 30 12:40:13 EDT 2020


From: Santosh Shukla <sashukla at nvidia.com>

VFIO allows a device driver to resolve a fault by mapping a MMIO
range. This can be subsequently result in user_mem_abort() to
try and compute a huge mapping based on the MMIO pfn, which is
a sure recipe for things to go wrong.

Instead, force a PTE mapping when the pfn faulted in has a device
mapping.

Fixes: 6d674e28f642 ("KVM: arm/arm64: Properly handle faulting of device mappings")
Suggested-by: Marc Zyngier <maz at kernel.org>
Signed-off-by: Santosh Shukla <sashukla at nvidia.com>
[maz: rewritten commit message]
Signed-off-by: Marc Zyngier <maz at kernel.org>
Reviewed-by: Gavin Shan <gshan at redhat.com>
Cc: stable at vger.kernel.org
Link: https://lore.kernel.org/r/1603711447-11998-2-git-send-email-sashukla@nvidia.com
---
 arch/arm64/kvm/mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index e431d2d8e368..c7c6df6309d5 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -851,6 +851,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 
 	if (kvm_is_device_pfn(pfn)) {
 		device = true;
+		force_pte = true;
 	} else if (logging_active && !write_fault) {
 		/*
 		 * Only actually map the page as writable if this was a write
-- 
2.28.0




More information about the linux-arm-kernel mailing list