]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm/arm64: fix races in kvm_psci_vcpu_on
authorAndrew Jones <drjones@redhat.com>
Tue, 18 Apr 2017 15:59:58 +0000 (17:59 +0200)
committerChristoffer Dall <cdall@linaro.org>
Wed, 19 Apr 2017 15:28:11 +0000 (17:28 +0200)
commite23b18dd58aa82d1602929d2816f4d57ef9dc979
treedbda1126626c9f9455038d7c082def0b4c1dfbce
parent6f91aba42091a9626ff9892c7d2c880b24427da5
KVM: arm/arm64: fix races in kvm_psci_vcpu_on

Fix potential races in kvm_psci_vcpu_on() by taking the kvm->lock
mutex.  In general, it's a bad idea to allow more than one PSCI_CPU_ON
to process the same target VCPU at the same time.  One such problem
that may arise is that one PSCI_CPU_ON could be resetting the target
vcpu, which fills the entire sys_regs array with a temporary value
including the MPIDR register, while another looks up the VCPU based
on the MPIDR value, resulting in no target VCPU found.  Resolves both
races found with the kvm-unit-tests/arm/psci unit test.

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Reported-by: Levente Kurusa <lkurusa@redhat.com>
Suggested-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Christoffer Dall <cdall@linaro.org>
arch/arm/kvm/psci.c