KVM: arm64: Don't translate FAR if invalid/unsafe
authorOliver Upton <oliver.upton@linux.dev>
Wed, 2 Apr 2025 20:17:25 +0000 (13:17 -0700)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 3 Apr 2025 07:28:51 +0000 (00:28 -0700)
commit26fbdf36922711f285fd185ad644f0acdf15959f
tree970efddf1a35f19ece2236cfa6f4d7de967b773a
parent1cf3e126f1528cdcaf77524f48e54ccbcb029473
KVM: arm64: Don't translate FAR if invalid/unsafe

Don't re-walk the page tables if an SEA occurred during the faulting
page table walk to avoid taking a fatal exception in the hyp.
Additionally, check that FAR_EL2 is valid for SEAs not taken on PTW
as the architecture doesn't guarantee it contains the fault VA.

Finally, fix up the rest of the abort path by checking for SEAs early
and bugging the VM if we get further along with an UNKNOWN fault IPA.

Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250402201725.2963645-4-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/esr.h
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/kvm_ras.h
arch/arm64/kvm/hyp/include/hyp/fault.h
arch/arm64/kvm/hyp/nvhe/mem_protect.c
arch/arm64/kvm/mmu.c