]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: ensure that EFER.SVME is set when running nested guest or on nested vmexit
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 31 Mar 2021 10:28:01 +0000 (06:28 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 1 Apr 2021 09:11:35 +0000 (05:11 -0400)
commit1af12ab233737b271e6d5df4939eaf7225801c4a
tree860cb0fd3c84ff826ff267151bfe6c0bf17abd10
parent815c622c13c4cabfac51e05b966b12150e111fc8
KVM: SVM: ensure that EFER.SVME is set when running nested guest or on nested vmexit

Fixing nested_vmcb_check_save to avoid all TOC/TOU races
is a bit harder in released kernels, so do the bare minimum
by avoiding that EFER.SVME is cleared.  This is problematic
because svm_set_efer frees the data structures for nested
virtualization if EFER.SVME is cleared.

Also check that EFER.SVME remains set after a nested vmexit;
clearing it could happen if the bit is zero in the save area
that is passed to KVM_SET_NESTED_STATE (the save area of the
nested state corresponds to the nested hypervisor's state
and is restored on the next nested vmexit).

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