]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: x86: Ensure vcpu->mode is loaded from memory in kvm_vcpu_exit_request()
authorSean Christopherson <seanjc@google.com>
Wed, 28 Aug 2024 23:20:13 +0000 (16:20 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 1 Nov 2024 16:21:46 +0000 (09:21 -0700)
commit3ffe874ea3eb4c674334c92303a72c76a1141c42
tree0d7ce585af4a9a9ec78e949f6590f57a444c5a5c
parent6e44d2427b70911514663989963a114d466ca79d
KVM: x86: Ensure vcpu->mode is loaded from memory in kvm_vcpu_exit_request()

Wrap kvm_vcpu_exit_request()'s load of vcpu->mode with READ_ONCE() to
ensure the variable is re-loaded from memory, as there is no guarantee the
caller provides the necessary annotations to ensure KVM sees a fresh value,
e.g. the VM-Exit fastpath could theoretically reuse the pre-VM-Enter value.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Link: https://lore.kernel.org/r/20240828232013.768446-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c