KVM: SVM: load control fields from VMCB12 before checking them
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 31 Mar 2021 10:24:43 +0000 (06:24 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 1 Apr 2021 09:09:31 +0000 (05:09 -0400)
commita58d9166a756a0f4a6618e4f593232593d6df134
treec002769f24a16115567ec82cdd84994bcda72d52
parent2c85ebc57b3e1817b6ce1a6b703928e113a90442
KVM: SVM: load control fields from VMCB12 before checking them

Avoid races between check and use of the nested VMCB controls.  This
for example ensures that the VMRUN intercept is always reflected to the
nested hypervisor, instead of being processed by the host.  Without this
patch, it is possible to end up with svm->nested.hsave pointing to
the MSR permission bitmap for nested guests.

This bug is CVE-2021-29657.

Reported-by: Felix Wilhelm <fwilhelm@google.com>
Cc: stable@vger.kernel.org
Fixes: 2fcf4876ada ("KVM: nSVM: implement on demand allocation of the nested state")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/nested.c