KVM: nVMX: vmcs12 revision_id is always VMCS12_REVISION even when copied from eVMCS
authorLiran Alon <liran.alon@oracle.com>
Tue, 13 Nov 2018 15:44:46 +0000 (17:44 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 27 Nov 2018 11:50:30 +0000 (12:50 +0100)
commit52ad7eb3d668867f9ee2e34d715cfb4860d36a93
tree98b16b079ee9c6e7b54b0556781b294a5a4220c2
parent72aeb60c52bf74a0eeec77d6b41ce40145697d76
KVM: nVMX: vmcs12 revision_id is always VMCS12_REVISION even when copied from eVMCS

vmcs12 represents the per-CPU cache of L1 active vmcs12.

This cache can be loaded by one of the following:
1) Guest making a vmcs12 active by exeucting VMPTRLD
2) Guest specifying eVMCS in VP assist page and executing
VMLAUNCH/VMRESUME.

Either way, vmcs12 should have revision_id of VMCS12_REVISION.
Which is not equal to eVMCS revision_id which specifies used
VersionNumber of eVMCS struct (e.g. KVM_EVMCS_VERSION).

Specifically, this causes an issue in restoring a nested VM state
because vmx_set_nested_state() verifies that vmcs12->revision_id
is equal to VMCS12_REVISION which was not true in case vmcs12
was populated from an eVMCS by vmx_get_nested_state() which calls
copy_enlightened_to_vmcs12().

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c