[PATCH] KVM: arm64: Clear pending exception state before injecting a new one
Marc Zyngier
maz at kernel.org
Mon Jul 14 07:46:36 PDT 2025
Repeatedly injecting an exception from userspace without running
the vcpu between calls results in a nasty warning, as we're not
really keen on losing already pending exceptions.
But this precaution doesn't really apply to userspace, who can
do whatever it wants (within reason). So let's simply clear any
previous exception state before injecting a new one.
Note that this is done unconditionally, even if the injection
ultimately fails.
Reported-by: syzbot+4e09b1432de3774b86ae at syzkaller.appspotmail.com
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
arch/arm64/kvm/guest.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index e2702718d56d2..ac6b26e25e191 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -843,6 +843,8 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
u64 esr = events->exception.serror_esr;
int ret = 0;
+ vcpu_clear_flag(vcpu, EXCEPT_MASK);
+
if (ext_dabt_pending)
ret = kvm_inject_sea_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
--
2.39.2
More information about the linux-arm-kernel
mailing list