VirtualBox

Changeset 95161 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 1, 2022 11:38:16 AM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 Fixes to VMX APIC-access page fault handler.

File:
1 edited

Legend:

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

    r94842 r95161  
    24422442    pVmcs->u64RoExitQual.u = u64ExitQual;
    24432443
    2444     LogFlow(("vmexit: reason=%#RX32 qual=%#RX64 cs:rip=%04x:%#RX64 cr0=%#RX64 cr3=%#RX64 cr4=%#RX64\n", uExitReason,
     2444    LogFlow(("vmexit: reason=%u qual=%#RX64 cs:rip=%04x:%#RX64 cr0=%#RX64 cr3=%#RX64 cr4=%#RX64\n", uExitReason,
    24452445             pVmcs->u64RoExitQual.u, pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.cr0,
    24462446             pVCpu->cpum.GstCtx.cr3, pVCpu->cpum.GstCtx.cr4));
     
    43724372static bool iemVmxVirtApicIsMemAccessIntercepted(PVMCPUCC pVCpu, uint16_t offAccess, size_t cbAccess, uint32_t fAccess) RT_NOEXCEPT
    43734373{
     4374    Assert(cbAccess > 0);
    43744375    PCVMXVVMCS const pVmcs = &pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs;
    43754376
     
    98969897
    98979898{
    9898     RT_NOREF4(pVM, pRegFrame, pvFault, uUser);
     9899    RT_NOREF3(pVM, pRegFrame, uUser);
    98999900
    99009901    /*
     
    99039904     * Failing to do so lands us with endless EPT misconfiguration VM-exits.
    99049905     */
    9905     RTGCPHYS const GCPhysAccessBase = GCPhysFault & ~(RTGCPHYS)GUEST_PAGE_OFFSET_MASK;
     9906    RTGCPHYS const GCPhysPage = GCPhysFault & ~(RTGCPHYS)GUEST_PAGE_OFFSET_MASK;
    99069907    if (CPUMIsGuestInVmxNonRootMode(IEM_GET_CTX(pVCpu)))
    99079908    {
    99089909        Assert(CPUMIsGuestVmxProcCtls2Set(IEM_GET_CTX(pVCpu), VMX_PROC_CTLS2_VIRT_APIC_ACCESS));
    9909         Assert(CPUMGetGuestVmxApicAccessPageAddrEx(IEM_GET_CTX(pVCpu)) == GCPhysAccessBase);
     9910        Assert(CPUMGetGuestVmxApicAccessPageAddrEx(IEM_GET_CTX(pVCpu)) == GCPhysPage);
    99109911
    99119912        /*
     
    99209921            fAccess = IEM_ACCESS_DATA_R;
    99219922
    9922         uint16_t const offAccess = GCPhysFault & GUEST_PAGE_OFFSET_MASK;
    9923         bool const fIntercept = iemVmxVirtApicIsMemAccessIntercepted(pVCpu, offAccess, 0 /* cbAccess */, fAccess);
     9923        RTGCPHYS const GCPhysNestedFault = (RTGCPHYS)pvFault;
     9924        uint16_t const offAccess         = GCPhysNestedFault & GUEST_PAGE_OFFSET_MASK;
     9925        bool const fIntercept = iemVmxVirtApicIsMemAccessIntercepted(pVCpu, offAccess, 1 /* cbAccess */, fAccess);
    99249926        if (fIntercept)
    99259927        {
     
    99449946             */
    99459947            AssertLogRelMsgReturn(HmExitAux.Vmx.uReason == VMX_EXIT_EPT_VIOLATION,
    9946                                   ("Unexpected call to the VMX APIC-access page #PF handler for %#RGp (off=%u) uReason=%#RX32\n",
    9947                                    GCPhysAccessBase, offAccess, HmExitAux.Vmx.uReason), VERR_IEM_IPE_9);
     9948                                  ("Unexpected call to the VMX APIC-access page #PF handler for %#RGp (Nested=%#RGp, GCPhysAddr%#RGp) off=%u uReason=%u\n",
     9949                                   GCPhysPage, GCPhysNestedFault, HmExitAux.Vmx.u64GuestPhysAddr, offAccess, HmExitAux.Vmx.uReason), VERR_IEM_IPE_9);
    99489950
    99499951            /*
     
    1000310005    }
    1000410006
    10005     LogFunc(("Accessed outside VMX non-root mode, deregistering page handler for %#RGp\n", GCPhysAccessBase));
    10006     int rc = PGMHandlerPhysicalDeregister(pVM, GCPhysAccessBase);
     10007    LogFunc(("Accessed outside VMX non-root mode, deregistering page handler for %#RGp\n", GCPhysPage));
     10008    int const rc = PGMHandlerPhysicalDeregister(pVM, GCPhysPage);
    1000710009    if (RT_FAILURE(rc))
    1000810010        return rc;
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