With TCR_EL2.HA set and AF clear, the VNCR stage-1 walk tries to update the leaf descriptor. If the table is in a read-only memslot, __kvm_at_swap_desc() returns -EPERM and walk_s1() records an SEA on the table walk. The VNCR walk uses the EL2&0 regime, so nested stage-2 permissions do not enter into this case. kvm_handle_vncr_abort() ignores -EPERM and re-enters the guest, which takes the same abort again. Handle -EPERM and inject the recorded SEA. On Neoverse-N2 the unpatched case took about 1.3 million exits in five seconds. With the fix the guest received a level-3 table-walk SEA. Reported-by: Sashiko Closes: https://lore.kernel.org/all/sashiko-outbox-230439@kernel.org/ Fixes: bff8aa213dee ("KVM: arm64: Implement HW access flag management in stage-1 SW PTW") Reviewed-by: Yuan Yao Signed-off-by: Jia He --- arch/arm64/kvm/nested.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index ff78d2784db5..867bcdd69382 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -1718,6 +1718,7 @@ int kvm_handle_vncr_abort(struct kvm_vcpu *vcpu) case -EINVAL: case -ENOENT: case -EACCES: + case -EPERM: /* * Translation failed, inject the corresponding * exception back to EL2. -- 2.34.1