[PATCH 0/2] VM: Fix a benign race in kicking vCPUs

From: Sean Christopherson
Date: Fri Aug 20 2021 - 20:05:13 EST


Fix benign races when kicking vCPUs where the task doing the kicking can
consume a stale vcpu->cpu. The races are benign because of the
impliciations of task migration with respect to interrupts and being in
guest mode, but IMO they're worth fixing if only as an excuse to
document the flows.

Patch 2 is a tangentially related cleanup to prevent future me from
trying to get rid of the NULL check on the cpumask parameters, which
_looks_ like it can't ever be NULL, but has a subtle edge case due to the
way CONFIG_CPUMASK_OFFSTACK=y handles cpumasks.

Sean Christopherson (2):
KVM: Clean up benign vcpu->cpu data races when kicking vCPUs
KVM: Guard cpusmask NULL check with CONFIG_CPUMASK_OFFSTACK

virt/kvm/kvm_main.c | 46 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 37 insertions(+), 9 deletions(-)

--
2.33.0.rc2.250.ged5fa647cd-goog