• Sean Christopherson's avatar
    KVM: VMX: Pull GUEST_CR3 from the VMCS iff CR3 load exiting is disabled · 81ca0e73
    Sean Christopherson authored
    
    
    Tweak the logic for grabbing vmcs.GUEST_CR3 in vmx_cache_reg() to look
    directly at the execution controls, as opposed to effectively inferring
    the controls based on vCPUs.  Inferring the controls isn't wrong, but it
    creates a very subtle dependency between the caching logic, the state of
    vcpu->arch.cr0 (via is_paging()), and the behavior of vmx_set_cr0().
    
    Using the execution controls doesn't completely eliminate the dependency
    in vmx_set_cr0(), e.g. neglecting to cache CR3 before enabling
    interception would still break the guest, but it does reduce the
    code dependency and mostly eliminate the logical dependency (that CR3
    loads are intercepted in certain scenarios).  Eliminating the subtle
    read of vcpu->arch.cr0 will also allow for additional cleanup in
    vmx_set_cr0().
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20210713163324.627647-26-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    81ca0e73
vmx.c 224 KB