On Fri, 10 May 2024 02:23:52 -0700, Breno Leitao wrote:
Use {READ,WRITE}_ONCE() to access kvm->last_boosted_vcpu to ensure the loads and stores are atomic. In the extremely unlikely scenario the compiler tears the stores, it's theoretically possible for KVM to attempt to get a vCPU using an out-of-bounds index, e.g. if the write is split into multiple 8-bit stores, and is paired with a 32-bit load on a VM with 257 vCPUs:
[...]
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() https://github.com/kvm-x86/linux/commit/2b0844082557