Skip to content

Commit 918e08d

Browse files
Marc Zyngiergregkh
authored andcommitted
KVM: arm64: Fully zero the vcpu state on reset
commit 85d7037 upstream. On vcpu reset, we expect all the registers to be brought back to their initial state, which happens to be a bunch of zeroes. However, some recent commit broke this, and is now leaving a bunch of registers (such as the FP state) with whatever was left by the guest. My bad. Zero the reset of the state (32bit SPSRs and FPSIMD state). Cc: stable@vger.kernel.org Fixes: e47c205 ("KVM: arm64: Make struct kvm_regs userspace-only") Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 168e82f commit 918e08d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎arch/arm64/kvm/reset.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
242242

243243
/* Reset core registers */
244244
memset(vcpu_gp_regs(vcpu), 0, sizeof(*vcpu_gp_regs(vcpu)));
245+
memset(&vcpu->arch.ctxt.fp_regs, 0, sizeof(vcpu->arch.ctxt.fp_regs));
246+
vcpu->arch.ctxt.spsr_abt = 0;
247+
vcpu->arch.ctxt.spsr_und = 0;
248+
vcpu->arch.ctxt.spsr_irq = 0;
249+
vcpu->arch.ctxt.spsr_fiq = 0;
245250
vcpu_gp_regs(vcpu)->pstate = pstate;
246251

247252
/* Reset system registers */

0 commit comments

Comments
 (0)