KVM: arm/arm64: check power_off in critical section before VCPU run
authorEric Auger <eric.auger@linaro.org>
Fri, 25 Sep 2015 21:41:16 +0000 (23:41 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 22 Oct 2015 21:01:46 +0000 (23:01 +0200)
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>
arch/arm/kvm/arm.c

index d04deeb1d4e01633c212c2b3a86e7881c79fe005..3b3384c37e2412a0608eebf3fb5a7caffe209666 100644 (file)
@@ -560,7 +560,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
                        run->exit_reason = KVM_EXIT_INTR;
                }
 
-               if (ret <= 0 || need_new_vmid_gen(vcpu->kvm)) {
+               if (ret <= 0 || need_new_vmid_gen(vcpu->kvm) ||
+                       vcpu->arch.power_off) {
                        local_irq_enable();
                        kvm_timer_sync_hwstate(vcpu);
                        kvm_vgic_sync_hwstate(vcpu);