• Vitaly Kuznetsov's avatar
    KVM: nVMX: Release enlightened VMCS on VMCLEAR · 3b19b81a
    Vitaly Kuznetsov authored
    Unlike VMREAD/VMWRITE/VMPTRLD, VMCLEAR is a valid instruction when
    enlightened VMCS is in use. TLFS has the following brief description:
    "The L1 hypervisor can execute a VMCLEAR instruction to transition an
    enlightened VMCS from the active to the non-active state". Normally,
    this change can be ignored as unmapping active eVMCS can be postponed
    until the next VMLAUNCH instruction but in case nested state is migrated
    with KVM_GET_NESTED_STATE/KVM_SET_NESTED_STATE, keeping eVMCS mapped
    may result in its synchronization with VMCS12 and this is incorrect:
    L1 hypervisor is free to reuse inactive eVMCS memory for something else.
    
    Inactive eVMCS after VMCLEAR can just be unmapped.
    Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210526132026.270394-7-vkuznets@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    3b19b81a
nested.c 205 KB