Skip to content

KVM: arm64: nv: Fix permission checks for S1PTW faults

Oliver Upton kvmarm sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 6 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: arm64: Only consider S1PTW a write fault if HA is setarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/at.c+41 -255 replies
2/2KVM: arm64: nv: Treat S1PTW permission faults speciallyarch/arm64/kvm/nested.c+17 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] KVM: arm64: nv: Fix permission checks for S1PTW faults

Small series that papers over arch ambiguity around S1PTW permission faults.

As kvm_s2_handle_perm_fault() wasn't checking for S1PTW instruction aborts, it was incorrectly evaluating the execute permissions to decide where to send the fault.

Fixing that uncovers another issue in that kvm_is_write_fault() assumes any S1PTW permission fault was due to write. Nested screws this up since an L1 hypervisor could use write-only permissions at stage-2.

We end up papering over architecture ambiguity by potentially evaluating *both* read and write permissions for S1PTW, assuming any fault with HA set to require write permission (in addition to read).

Applies to kvmarm/fixes.

v1: https://lore.kernel.org/kvmarm/[email protected]/

Oliver Upton (2):
KVM: arm64: Only consider S1PTW a write fault if HA is set
KVM: arm64: nv: Treat S1PTW permission faults specially

 arch/arm64/include/asm/kvm_emulate.h | 22 +++++----------
 arch/arm64/include/asm/kvm_nested.h  |  2 ++
 arch/arm64/kvm/at.c                  | 42 +++++++++++++++++++++-------
 arch/arm64/kvm/nested.c              | 20 +++++++++++--
 4 files changed, 58 insertions(+), 28 deletions(-)

base-commit: d098bb75d14fde2f12155f1a95ec0168160867ce

Signature · 1 line
2.47.3