Skip to contentSkip to conversation

FAILED: patch "[PATCH] KVM: arm64: Force PTE mapping on fault resulting in a device" failed to apply to 5.9-stable tree

PATCH [email protected] 1 participant 1 message Nov 3, 2020

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 91a2c34b7d6fadc9c5d9433c620ea4c32ee7cae8 Mon Sep 17 00:00:00 2001
From: Santosh Shukla <[email protected]>
Date: Mon, 26 Oct 2020 16:54:07 +0530
Subject: [PATCH] KVM: arm64: Force PTE mapping on fault resulting in a device
mapping

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")
[maz: rewritten commit message]
arch/arm64/kvm/mmu.c +1 -0
index e431d2d8e368..c7c6df6309d5 100644
@@ -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