]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Restart instruction upon race in __kvm_at_s12()
authorOliver Upton <oupton@kernel.org>
Tue, 2 Jun 2026 23:54:49 +0000 (16:54 -0700)
committerMarc Zyngier <maz@kernel.org>
Wed, 3 Jun 2026 20:06:43 +0000 (21:06 +0100)
__kvm_at_s*() are expected to return -EAGAIN if the page table walk
raced with a concurrent update to a page table descriptor, which is
interpreted as a signal to restart the trapping instruction.

While this mostly works, __kvm_at_s12() silently eats the return from
__kvm_at_s1e01() and consumes an uninitialized PAR value. Propagate the
nonzero return instead.

Fixes: 92c6443222ca ("KVM: arm64: Propagate PTW errors up to AT emulation")
Signed-off-by: Oliver Upton <oupton@kernel.org>
Link: https://patch.msgid.link/20260602235450.103057-5-oupton@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/at.c

index 119a603e636e8190b0a528c8d4056cec030b2fbd..6cc5892023dd9e6b68c67453d6f0b73bc3ebbbe7 100644 (file)
@@ -1557,7 +1557,10 @@ int __kvm_at_s12(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
                return 0;
        }
 
-       __kvm_at_s1e01(vcpu, op, vaddr);
+       ret = __kvm_at_s1e01(vcpu, op, vaddr);
+       if (ret)
+               return ret;
+
        par = vcpu_read_sys_reg(vcpu, PAR_EL1);
        if (par & SYS_PAR_EL1_F)
                return 0;