VirtualBox

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


Ignore:
Timestamp:
Jan 14, 2019 6:33:43 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128138
Message:

VMM/IEM: Nested VMX: bugref:9180 Fix intercepting recursive events while injecting an event through VM-entry.

File:
1 edited

Legend:

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

    r76743 r76800  
    24622462        return iemVmxAbort(pVCpu, VMXABORT_LOAD_HOST_MSR);
    24632463    }
    2464 
    2465     return rcStrict;
     2464    return VINF_SUCCESS;
    24662465}
    24672466
     
    28372836
    28382837    pVmcs->u32RoExitReason = uExitReason;
    2839 
    2840     /** @todo NSTVMX: IEMGetCurrentXcpt will be VM-exit interruption info. */
    2841     /** @todo NSTVMX: The source event should be recorded in IDT-vectoring info
    2842      *        during injection. */
     2838    Log3(("vmexit: uExitReason=%#RX32 uExitQual=%#RX64\n", uExitReason, pVmcs->u64RoExitQual));
    28432839
    28442840    /*
     
    28742870    }
    28752871
     2872    /* Restore the host (outer guest) state. */
    28762873    VBOXSTRICTRC rcStrict = iemVmxVmexitLoadHostState(pVCpu, uExitReason);
    2877     if (RT_FAILURE(rcStrict))
    2878         LogFunc(("Loading host-state failed. uExitReason=%u rc=%Rrc\n", uExitReason, VBOXSTRICTRC_VAL(rcStrict)));
     2874    if (RT_SUCCESS(rcStrict))
     2875    {
     2876        Assert(rcStrict == VINF_SUCCESS);
     2877        rcStrict = VINF_VMX_VMEXIT;
     2878    }
     2879    else
     2880        Log3(("vmexit: Loading host-state failed. uExitReason=%u rc=%Rrc\n", uExitReason, VBOXSTRICTRC_VAL(rcStrict)));
    28792881
    28802882    /* We're no longer in nested-guest execution mode. */
    28812883    pVCpu->cpum.GstCtx.hwvirt.vmx.fInVmxNonRootMode = false;
    28822884
    2883     Assert(rcStrict == VINF_SUCCESS);
     2885    /* Revert any IEM-only nested-guest execution policy if any. */
    28842886    IEM_VMX_R3_EXECPOLICY_IEM_ALL_DISABLE(pVCpu, "VM-exit");
    2885     return VINF_VMX_VMEXIT;
     2887    return rcStrict;
    28862888# endif
    28872889}
     
    40264028        {
    40274029            if (uVector == X86_XCPT_PF)
     4030            {
     4031                Assert(fFlags & IEM_XCPT_FLAGS_CR2);
    40284032                uExitQual = uCr2;
     4033            }
    40294034            else if (uVector == X86_XCPT_DB)
    40304035            {
     
    70877092    /*
    70887093     * Inject events.
     7094     * The event that is going to be made pending for injection is not subject to VMX intercepts,
     7095     * thus we flag ignoring of intercepts. However, recursive exceptions if any during delivery
     7096     * of the current event -are- subject to intercepts, hence this flag will be flipped during
     7097     * the actually delivery of this event.
     7098     *
    70897099     * See Intel spec. 26.5 "Event Injection".
    70907100     */
    70917101    PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
    7092     uint32_t const uEntryIntInfo = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs)->u32EntryIntInfo;
    7093     if (VMX_ENTRY_INT_INFO_IS_VALID(uEntryIntInfo))
    7094     {
    7095         /*
    7096          * The event that is going to be made pending for injection is not subject to VMX intercepts,
    7097          * thus we flag ignoring of intercepts. However, recursive exceptions if any during delivery
    7098          * of the current event -are- subject to intercepts, hence this flag will be flipped during
    7099          * the actually delivery of this event.
    7100          */
    7101         pVCpu->cpum.GstCtx.hwvirt.vmx.fInterceptEvents = false;
    7102 
     7102    uint32_t const uEntryIntInfo      = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs)->u32EntryIntInfo;
     7103    bool const     fEntryIntInfoValid = VMX_ENTRY_INT_INFO_IS_VALID(uEntryIntInfo);
     7104
     7105    pVCpu->cpum.GstCtx.hwvirt.vmx.fInterceptEvents = !fEntryIntInfoValid;
     7106    if (fEntryIntInfoValid)
     7107    {
    71037108        uint8_t const uType = VMX_ENTRY_INT_INFO_TYPE(uEntryIntInfo);
    71047109        if (uType == VMX_ENTRY_INT_INFO_TYPE_OTHER_EVENT)
     
    71217126    if (fPendingDbgXcpt)
    71227127    {
    7123         pVCpu->cpum.GstCtx.hwvirt.vmx.fInterceptEvents = true;
    71247128        uint32_t const uDbgXcptInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR, X86_XCPT_DB)
    71257129                                    | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_TYPE, VMX_ENTRY_INT_INFO_TYPE_HW_XCPT)
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