VirtualBox

Changeset 99164 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Mar 24, 2023 6:20:40 AM (21 months ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:10318 Fixed vmlaunch/vmresume emulation to save/restore non-zero secondary processor-based execution VM-controls when the 'activate secondary controls' bit is not set.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp

    r98797 r99164  
    26372637        Log(("vmexit: Loading host-state failed. uExitReason=%u rc=%Rrc\n", uExitReason, VBOXSTRICTRC_VAL(rcStrict)));
    26382638
     2639    /*
     2640     * Restore non-zero Secondary-processor based VM-execution controls
     2641     * when the "activate secondary controls" bit was not set.
     2642     */
     2643    if (pVmcs->u32RestoreProcCtls2)
     2644    {
     2645        Assert(!(pVmcs->u32ProcCtls & VMX_PROC_CTLS_USE_SECONDARY_CTLS));
     2646        pVmcs->u32ProcCtls2        = pVmcs->u32RestoreProcCtls2;
     2647        pVmcs->u32RestoreProcCtls2 = 0;
     2648    }
     2649
    26392650    if (VM_IS_HM_ENABLED(pVCpu->CTX_SUFF(pVM)))
    26402651    {
     
    63946405                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_ProcCtls2Allowed1);
    63956406        }
    6396         else
     6407        else if (pVmcs->u32ProcCtls2)
    63976408        {
    63986409            /*
    63996410             * If the "activate secondary controls" is clear, then the secondary processor-based VM-execution controls
    6400              * is treated as 0. We must not fail/assert here. Microsoft Hyper-V relies on this behavior.
     6411             * is treated as 0.
    64016412             *
    64026413             * See Intel spec. 26.2.1.1 "VM-Execution Control Fields".
     6414             *
     6415             * Since this is a rather rare occurrence (only observed for a few VM-entries with Microsoft Hyper-V
     6416             * enabled Windows Server 2008 R2 guest), it's not worth changing every place that reads this control to
     6417             * also check the "activate secondary controls" bit. Instead, we temporarily save the guest programmed
     6418             * control here, zero out the value the rest of our code uses and restore the guest programmed value
     6419             * on VM-exit.
    64036420             */
    6404             pVmcs->u32ProcCtls2 = 0;
     6421            pVmcs->u32RestoreProcCtls2 = pVmcs->u32ProcCtls2;
     6422            pVmcs->u32ProcCtls2        = 0;
    64056423        }
    64066424
     
    78127830     * See Intel spec. 24.11.4 "Software Access to Related Structures".
    78137831     */
    7814     PVMXVVMCS const pVmcs = &pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs;
    7815     Assert(pVmcs);
    78167832    Assert(IEM_VMX_HAS_CURRENT_VMCS(pVCpu));
    78177833
     
    78367852             */
    78377853            iemVmxVmentrySaveNmiBlockingFF(pVCpu);
     7854
     7855            PVMXVVMCS pVmcs = &pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs;
     7856            Assert(pVmcs);
    78387857
    78397858            rc = iemVmxVmentryCheckGuestState(pVCpu, pszInstr);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette