linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] KVM: arm64: Remove stage 2 read fault check
@ 2025-09-08  6:48 Wei-Lin Chang
  2025-09-08 18:23 ` Oliver Upton
  0 siblings, 1 reply; 2+ messages in thread
From: Wei-Lin Chang @ 2025-09-08  6:48 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel
  Cc: Marc Zyngier, Oliver Upton, Joey Gouly, Suzuki K Poulose,
	Zenghui Yu, Catalin Marinas, Wei-Lin Chang, Will Deacon

In the non-NV case, read permission is always granted when mapping
stage-2, so checking for it doesn't bring much. On the other hand,
shadow stage-2 for NV guests could potentially have non-readable
mappings when we align the permissions with those that L1 set for L2, we
shouldn't be checking for read faults in this case either.

So just remove this check.

Suggested-by: Oliver Upton <oliver.upton@linux.dev>
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Wei-Lin Chang <r09922117@csie.ntu.edu.tw>
---

Changes in v2, thanks to those listed in the Suggested-by tags:
  - remove the read fault check instead of skipping it for NV
  - Link to v1: https://lore.kernel.org/kvmarm/20250822031853.2007437-1-r09922117@csie.ntu.edu.tw/

---
 arch/arm64/kvm/mmu.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index 1c78864767c5c..fb239cd9f7a67 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -1508,11 +1508,6 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 	exec_fault = kvm_vcpu_trap_is_exec_fault(vcpu);
 	VM_BUG_ON(write_fault && exec_fault);
 
-	if (fault_is_perm && !write_fault && !exec_fault) {
-		kvm_err("Unexpected L2 read permission error\n");
-		return -EFAULT;
-	}
-
 	if (!is_protected_kvm_enabled())
 		memcache = &vcpu->arch.mmu_page_cache;
 	else
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] KVM: arm64: Remove stage 2 read fault check
  2025-09-08  6:48 [PATCH v2] KVM: arm64: Remove stage 2 read fault check Wei-Lin Chang
@ 2025-09-08 18:23 ` Oliver Upton
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Upton @ 2025-09-08 18:23 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel, Wei-Lin Chang
  Cc: Oliver Upton, Marc Zyngier, Joey Gouly, Suzuki K Poulose,
	Zenghui Yu, Catalin Marinas, Will Deacon

On Mon, 08 Sep 2025 14:48:06 +0800, Wei-Lin Chang wrote:
> In the non-NV case, read permission is always granted when mapping
> stage-2, so checking for it doesn't bring much. On the other hand,
> shadow stage-2 for NV guests could potentially have non-readable
> mappings when we align the permissions with those that L1 set for L2, we
> shouldn't be checking for read faults in this case either.
> 
> So just remove this check.
> 
> [...]

Applied to fixes, thanks!

[1/1] KVM: arm64: Remove stage 2 read fault check
      https://git.kernel.org/kvmarm/kvmarm/c/756491dd8329

--
Best,
Oliver


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-09  2:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08  6:48 [PATCH v2] KVM: arm64: Remove stage 2 read fault check Wei-Lin Chang
2025-09-08 18:23 ` Oliver Upton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).