OSDN Git Service

KVM: arm/arm64: Fix vgic init race
authorChristoffer Dall <christoffer.dall@arm.com>
Tue, 3 Jul 2018 20:54:14 +0000 (22:54 +0200)
committerMarc Zyngier <marc.zyngier@arm.com>
Sat, 21 Jul 2018 15:02:07 +0000 (16:02 +0100)
commit1d47191de7e15900f8fbfe7cccd7c6e1c2d7c31a
tree2595c1920c0bda904e609e1d504afca86f7d2963
parentde73708915adc1b3f05e617a86da6b2d68fae141
KVM: arm/arm64: Fix vgic init race

The vgic_init function can race with kvm_arch_vcpu_create() which does
not hold kvm_lock() and we therefore have no synchronization primitives
to ensure we're doing the right thing.

As the user is trying to initialize or run the VM while at the same time
creating more VCPUs, we just have to refuse to initialize the VGIC in
this case rather than silently failing with a broken VCPU.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/vgic/vgic-init.c