]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 20 Jun 2017 10:17:24 +0000 (12:17 +0200)
commit564f040c32285af4f1ea34d969cf63f67dc6ef56
treeed43998bb15ea80bd09406af8d6596d81ebf85a3
parent266dd7c0e34c004c5d624283286fa08b21578b30
KVM: arm/arm64: fix races in kvm_psci_vcpu_on

BugLink: http://bugs.launchpad.net/bugs/1692900
commit 6c7a5dce22b3f3cc44be098e2837fa6797edb8b8 upstream.

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>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
arch/arm/kvm/psci.c