OSDN Git Service

KVM: arm64: Fix read-side race on updates to vcpu reset state
authorOliver Upton <oupton@google.com>
Wed, 18 Aug 2021 20:21:30 +0000 (20:21 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 19 Aug 2021 08:08:56 +0000 (09:08 +0100)
commit6654f9dfcb88fea3b9affc180dc3c04333d0f306
treefd54c1cfff1f8bd1d13672699fc2b32b657f3aed
parentc500bee1c5b2f1d59b1081ac879d73268ab0ff17
KVM: arm64: Fix read-side race on updates to vcpu reset state

KVM correctly serializes writes to a vCPU's reset state, however since
we do not take the KVM lock on the read side it is entirely possible to
read state from two different reset requests.

Cure the race for now by taking the KVM lock when reading the
reset_state structure.

Fixes: 358b28f09f0a ("arm/arm64: KVM: Allow a VCPU to fully reset itself")
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210818202133.1106786-2-oupton@google.com
arch/arm64/kvm/reset.c