]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Set ESR_ELx.IL for injected undefined exceptions at EL2
authorFuad Tabba <tabba@google.com>
Thu, 18 Jun 2026 12:16:37 +0000 (13:16 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 22 Jun 2026 09:44:08 +0000 (10:44 +0100)
inject_undef64() constructs an ESR with EC=0 (Unknown) but does not set
IL. The architecture mandates IL=1 for EC=0 unconditionally (ARM DDI
0487, ESR_ELx.IL description), so the injected syndrome is one that
conforming hardware cannot produce.

Set ESR_ELx_IL in the constructed syndrome.

Fixes: e5d40a5a97c1 ("KVM: arm64: pkvm: Add a generic synchronous exception injection primitive")
Reported-by: sashiko <sashiko@sashiko.dev>
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260618121643.4105064-2-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/sys_regs.c

index 1a7d5cd16d72302b917164e78edbcd98cb551e52..b1411fb541397e0cdc471cab51d53ef73d364385 100644 (file)
@@ -279,7 +279,7 @@ static void inject_sync64(struct kvm_vcpu *vcpu, u64 esr)
  */
 static void inject_undef64(struct kvm_vcpu *vcpu)
 {
-       inject_sync64(vcpu, (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT));
+       inject_sync64(vcpu, (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT) | ESR_ELx_IL);
 }
 
 static u64 read_id_reg(const struct kvm_vcpu *vcpu,