VirtualBox

Changeset 79528 in vbox


Ignore:
Timestamp:
Jul 4, 2019 2:07:03 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131812
Message:

VMM/IEM: Nested VMX: bugref:9180 Clear the VM-entry interruption info. valid bit when also injecting an MTF event.
Clear the VM-entry interruption info. valid bit on VM-exit unconditionally as well, not just when injecting an event
to cover for error VM-exits like invalid-guest state. Added comment about a couple of features that implicitly require
unrestricted guest execution to be present.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

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

    r79518 r79528  
    24622462    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ALL);
    24632463
    2464     /* Ensure VM-entry interruption information valid bit isn't set. */
    2465     Assert(!VMX_ENTRY_INT_INFO_IS_VALID(pVmcs->u32EntryIntInfo));
     2464    /*
     2465     * Ensure VM-entry interruption information valid bit is cleared.
     2466     *
     2467     * We do it here on every VM-exit so that even premature VM-exits (e.g. those caused
     2468     * by invalid-guest state or machine-check exceptions) also clear this bit.
     2469     *
     2470     * See Intel spec. 27.2 "Recording VM-exit Information And Updating VM-entry control fields".
     2471     */
     2472    if (VMX_ENTRY_INT_INFO_IS_VALID(pVmcs->u32EntryIntInfo))
     2473        pVmcs->u32EntryIntInfo &= ~VMX_ENTRY_INT_INFO_VALID;
    24662474
    24672475    /*
     
    24712479    pVmcs->u32RoExitReason = uExitReason;
    24722480    pVmcs->u64RoExitQual.u = u64ExitQual;
     2481
    24732482    Log3(("vmexit: uExitReason=%#RX32 u64ExitQual=%#RX64 cs:rip=%04x:%#RX64\n", uExitReason, pVmcs->u64RoExitQual.u,
    24742483          pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip));
     
    70657074
    70667075    int rc = TRPMAssertTrap(pVCpu, uVector, enmTrapType);
    7067     AssertRCReturn(rc, rc);
    7068 
    7069     if (fErrCodeValid)
    7070         TRPMSetErrorCode(pVCpu, uErrCode);
    7071 
    7072     if (   enmTrapType == TRPM_TRAP
    7073         && uVector     == X86_XCPT_PF)
    7074         TRPMSetFaultAddress(pVCpu, GCPtrFaultAddress);
    7075     else if (enmTrapType == TRPM_SOFTWARE_INT)
    7076         TRPMSetInstrLength(pVCpu, cbInstr);
    7077 
    7078     return VINF_SUCCESS;
     7076    if (RT_SUCCESS(rc))
     7077    {
     7078        if (fErrCodeValid)
     7079            TRPMSetErrorCode(pVCpu, uErrCode);
     7080
     7081        if (   enmTrapType == TRPM_TRAP
     7082            && uVector     == X86_XCPT_PF)
     7083            TRPMSetFaultAddress(pVCpu, GCPtrFaultAddress);
     7084        else if (enmTrapType == TRPM_SOFTWARE_INT)
     7085            TRPMSetInstrLength(pVCpu, cbInstr);
     7086    }
     7087
     7088    return rc;
    70797089}
    70807090
     
    71057115    if (fEntryIntInfoValid)
    71067116    {
     7117        int rc;
    71077118        uint8_t const uType = VMX_ENTRY_INT_INFO_TYPE(uEntryIntInfo);
    71087119        if (uType == VMX_ENTRY_INT_INFO_TYPE_OTHER_EVENT)
     
    71107121            Assert(VMX_ENTRY_INT_INFO_VECTOR(uEntryIntInfo) == VMX_ENTRY_INT_INFO_VECTOR_MTF);
    71117122            VMCPU_FF_SET(pVCpu, VMCPU_FF_VMX_MTF);
    7112             return VINF_SUCCESS;
    7113         }
    7114 
    7115         int rc = iemVmxVmentryInjectTrpmEvent(pVCpu, uEntryIntInfo, pVmcs->u32EntryXcptErrCode, pVmcs->u32EntryInstrLen,
     7123            rc = VINF_SUCCESS;
     7124        }
     7125        else
     7126        {
     7127            rc = iemVmxVmentryInjectTrpmEvent(pVCpu, uEntryIntInfo, pVmcs->u32EntryXcptErrCode, pVmcs->u32EntryInstrLen,
    71167128                                              pVCpu->cpum.GstCtx.cr2);
    7117         if (RT_SUCCESS(rc))
    7118         {
    7119             /*
    7120              * We need to clear the VM-entry interruption information field's valid bit on VM-exit.
    7121              *
    7122              * However, we do it here on VM-entry because while it continues to not be visible to
    7123              * guest software until VM-exit, when HM looks at the VMCS to continue nested-guest
    7124              * execution using hardware-assisted VT-x, it can simply copy the VM-entry interruption
    7125              * information field.
    7126              *
    7127              * See Intel spec. 24.8.3 "VM-Entry Controls for Event Injection".
    7128              */
    7129             pVmcs->u32EntryIntInfo &= ~VMX_ENTRY_INT_INFO_VALID;
    7130         }
     7129        }
     7130
     7131        /*
     7132         * We need to clear the VM-entry interruption information field's valid bit on VM-exit.
     7133         *
     7134         * However, we do it here on VM-entry as well because while it isn't visible to guest
     7135         * software until VM-exit, when and if HM looks at the VMCS to continue nested-guest
     7136         * execution using hardware-assisted VT-x, it will not be try to inject the event again.
     7137         *
     7138         * See Intel spec. 24.8.3 "VM-Entry Controls for Event Injection".
     7139         */
     7140        pVmcs->u32EntryIntInfo &= ~VMX_ENTRY_INT_INFO_VALID;
    71317141        return rc;
    71327142    }
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r79519 r79528  
    18601860    EmuFeat.fVmxSecondaryExecCtls     = 1;
    18611861    EmuFeat.fVmxVirtApicAccess        = 0;
    1862     EmuFeat.fVmxEpt                   = 0;
     1862    EmuFeat.fVmxEpt                   = 0;  /* Cannot be disabled if unrestricted guest is enabled. */
    18631863    EmuFeat.fVmxDescTableExit         = 1;
    18641864    EmuFeat.fVmxRdtscp                = 1;
     
    18911891    EmuFeat.fVmxExitLoadEferMsr       = 1;
    18921892    EmuFeat.fVmxSavePreemptTimer      = 0;
    1893     EmuFeat.fVmxExitSaveEferLma       = 1;
     1893    EmuFeat.fVmxExitSaveEferLma       = 1;  /* Cannot be disabled if unrestricted guest is enabled. */
    18941894    EmuFeat.fVmxIntelPt               = 0;
    18951895    EmuFeat.fVmxVmwriteAll            = 0;  /** @todo NSTVMX: enable this when nested VMCS shadowing is enabled. */
Note: See TracChangeset for help on using the changeset viewer.

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