Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: arm/arm64: check power_off in critical section before VCPU run

In case a vcpu off PSCI call is called just after we executed the
vcpu_sleep check, we can enter the guest although power_off
is set. Let's check the power_off state in the critical section,
just before entering the guest.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reported-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

authored by

Eric Auger and committed by
Christoffer Dall
101d3da0 4f5f1dc0

+2 -1
+2 -1
arch/arm/kvm/arm.c
··· 560 560 run->exit_reason = KVM_EXIT_INTR; 561 561 } 562 562 563 - if (ret <= 0 || need_new_vmid_gen(vcpu->kvm)) { 563 + if (ret <= 0 || need_new_vmid_gen(vcpu->kvm) || 564 + vcpu->arch.power_off) { 564 565 local_irq_enable(); 565 566 kvm_timer_sync_hwstate(vcpu); 566 567 kvm_vgic_sync_hwstate(vcpu);