]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: nv: Write ESR_EL2 for injected nested SError exceptions
authorFuad Tabba <tabba@google.com>
Mon, 15 Jun 2026 13:11:16 +0000 (14:11 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 17 Jun 2026 11:58:40 +0000 (12:58 +0100)
kvm_inject_el2_exception() writes ESR_EL2 for synchronous exceptions
but not for SError. enter_exception64() does not write ESR_ELx for any
exception type, so the constructed syndrome is dropped. A guest L2
hypervisor taking a nested SError observes stale ESR_EL2.

This affects both kvm_inject_nested_serror() and the EASE path in
kvm_inject_nested_sea().

Write ESR_EL2 for except_type_serror, matching except_type_sync.

Fixes: 77ee70a07357 ("KVM: arm64: nv: Honor SError exception routing / masking")
Reported-by: sashiko <sashiko@sashiko.dev>
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260615131116.390977-1-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
arch/arm64/kvm/emulate-nested.c

index e688bc5139c1ff45a57f5f66f973a6d237be0b83..76c3e6c1144c8c46698d11feebe5902d997a8f62 100644 (file)
@@ -2826,6 +2826,7 @@ static void kvm_inject_el2_exception(struct kvm_vcpu *vcpu, u64 esr_el2,
                break;
        case except_type_serror:
                kvm_pend_exception(vcpu, EXCEPT_AA64_EL2_SERR);
+               vcpu_write_sys_reg(vcpu, esr_el2, ESR_EL2);
                break;
        default:
                WARN_ONCE(1, "Unsupported EL2 exception injection %d\n", type);