[PATCH v2 0/8] KVM: arm64: Fix kvm_reset_vcpu() and SError handling for nested virt

Dan Carpenter dan at pereq.eu
Tue Nov 24 22:56:15 PST 2026


Our formal proof work at Pereq found a way to trigger a WARN() by
injecting two SErrors.  Then Sashiko found several related bugs
and testing uncovered a few more.   The original patch is the same,
it's just that I have added others as well.

I have included a selftest for kvm_reset_vcpu().  I have a selftest
for SError as well but I have a question about that so I'm going to
send it seperately later.

Signed-off-by: Dan Carpenter <dan at pereq.eu>
---
Changes in v2:
- All the patches before [PATCH 7/8] are new to fix other related bugs
- Link to v1: https://patch.msgid.link/20261123-double_exception-v1-1-cd82b59a232d@pereq.eu

To: Marc Zyngier <maz at kernel.org>
To: Oliver Upton <oupton at kernel.org>
To: Fuad Tabba <fuad.tabba at linux.dev>
To: Joey Gouly <joey.gouly at arm.com>
To: Steffen Eiden <seiden at linux.ibm.com>
To: Suzuki K Poulose <suzuki.poulose at arm.com>
To: Zenghui Yu <yuzenghui at huawei.com>
To: Catalin Marinas <catalin.marinas at arm.com>
To: Will Deacon <will at kernel.org>
To: Mark Rutland <mark.rutland at arm.com>
To: Christoffer Dall <c.dall at virtualopensystems.com>
To: Rusty Russell <rusty at rustcorp.com.au>
To: Marcelo Tosatti <mtosatti at redhat.com>
To: Sebastian Ott <sebott at redhat.com>
To: Eric Auger <eric.auger at redhat.com>
To: James Morse <james.morse at arm.com>
To: Paolo Bonzini <pbonzini at redhat.com>
To: Sean Christopherson <seanjc at google.com>
To: Shuah Khan <shuah at kernel.org>
Cc: Karthik Bhargavan <karthik at pereq.eu>
Cc: Clément Blaudeau <clement at cryspen.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: kvmarm at lists.linux.dev
Cc: linux-kernel at vger.kernel.org
Cc: kvm at vger.kernel.org
Cc: linux-kselftest at vger.kernel.org

---
Dan Carpenter (8):
      KVM: arm64: Drop an incomplete MMIO access when resetting a vcpu
      KVM: arm64: Reset SP_EL1, ELR_EL1 and SPSR_EL1 when resetting a vcpu
      KVM: arm64: Discard a pending SError when resetting a vcpu
      KVM: arm64: nv: Discard nested SError in kvm_reset_vcpu()
      KVM: arm64: nv: Replace a pending SError when injecting a new one
      KVM: arm64: nv: Don't deliver a pending SError to the wrong guest
      KVM: arm64: nv: Re-inject a stored SError after the exit is handled
      KVM: arm64: selftests: Test that a vcpu reset clears the vcpu's state

 arch/arm64/include/asm/kvm_emulate.h           |   1 +
 arch/arm64/kvm/arm.c                           |   1 +
 arch/arm64/kvm/emulate-nested.c                |  14 ++
 arch/arm64/kvm/inject_fault.c                  |  10 ++
 arch/arm64/kvm/nested.c                        |  16 +-
 arch/arm64/kvm/reset.c                         |   8 +
 tools/testing/selftests/kvm/Makefile.kvm       |   1 +
 tools/testing/selftests/kvm/arm64/vcpu_reset.c | 210 +++++++++++++++++++++++++
 8 files changed, 251 insertions(+), 10 deletions(-)
---
base-commit: adcad7f4e6332cff3d6d7165f41584899f598534
change-id: 20261120-double_exception-a34dcc521118

Best regards,
--  
Dan Carpenter <dan at pereq.eu>




More information about the linux-arm-kernel mailing list