VirtualBox

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


Ignore:
Timestamp:
Nov 22, 2021 12:14:41 PM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 When CR3 is updated (PGMFlushTLB or PGMUpdateCR3) we need to translate it to a guest-physical address if it's a nested-guest physical address when EPT paging is enabled.

File:
1 edited

Legend:

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

    r92541 r92547  
    18581858                              PPGMPTWALKGST pGstWalk)
    18591859{
     1860    AssertPtr(pWalk);
     1861    AssertPtr(pGstWalk);
    18601862    switch (enmSlatMode)
    18611863    {
     
    24002402     * Remap the CR3 content and adjust the monitoring if CR3 was actually changed.
    24012403     */
     2404    RTGCPHYS const GCPhysOldCR3 = pVCpu->pgm.s.GCPhysCR3;
     2405    RTGCPHYS       GCPhysCR3    = pgmGetGuestMaskedCr3(pVCpu, cr3);
     2406#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     2407    if (   !fPdpesMapped
     2408        && CPUMIsGuestVmxEptPagingEnabled(pVCpu))
     2409    {
     2410        PGMPTWALK    Walk;
     2411        PGMPTWALKGST GstWalk;
     2412        int const rc = pgmGstSlatWalkPhys(pVCpu, PGMSLAT_EPT, GCPhysCR3, &Walk, &GstWalk);
     2413        if (RT_SUCCESS(rc))
     2414            GCPhysCR3 = Walk.GCPhys;
     2415        else
     2416        {
     2417            AssertMsgFailed(("Failed to load CR3 at %#RX64. rc=%Rrc\n", GCPhysCR3, rc));
     2418            return rc;
     2419        }
     2420    }
     2421#endif
    24022422    int rc = VINF_SUCCESS;
    2403     RTGCPHYS const GCPhysOldCR3 = pVCpu->pgm.s.GCPhysCR3;
    2404     RTGCPHYS const GCPhysCR3    = pgmGetGuestMaskedCr3(pVCpu, cr3);
    24052423    if (GCPhysOldCR3 != GCPhysCR3)
    24062424    {
     
    24842502     * Remap the CR3 content and adjust the monitoring if CR3 was actually changed.
    24852503     */
     2504    RTGCPHYS GCPhysCR3 = pgmGetGuestMaskedCr3(pVCpu, cr3);
     2505#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     2506    if (   !fPdpesMapped
     2507        && CPUMIsGuestVmxEptPagingEnabled(pVCpu))
     2508    {
     2509        PGMPTWALK    Walk;
     2510        PGMPTWALKGST GstWalk;
     2511        int const rc = pgmGstSlatWalkPhys(pVCpu, PGMSLAT_EPT, GCPhysCR3, &Walk, &GstWalk);
     2512        if (RT_SUCCESS(rc))
     2513            GCPhysCR3 = Walk.GCPhys;
     2514        else
     2515        {
     2516            AssertMsgFailed(("Failed to load CR3 at %#RX64. rc=%Rrc\n", GCPhysCR3, rc));
     2517            return VERR_PGM_PAE_PDPE_RSVD;
     2518        }
     2519    }
     2520#endif
    24862521    int rc = VINF_SUCCESS;
    2487     RTGCPHYS const GCPhysCR3 = pgmGetGuestMaskedCr3(pVCpu, cr3);
    24882522    if (pVCpu->pgm.s.GCPhysCR3 != GCPhysCR3)
    24892523    {
     
    27232757        else
    27242758        {
    2725             /** @todo Raise EPT violation VM-exit. */
    2726             return VERR_NOT_IMPLEMENTED;
     2759            AssertMsgFailed(("Failed to load CR3 at %#RX64. rc=%Rrc\n", GCPhysCR3, rc));
     2760            return rc;
    27272761        }
    27282762    }
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