VirtualBox

Changeset 81947 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Nov 18, 2019 4:14:43 PM (5 years ago)
Author:
vboxsync
Message:

IOMAllMmioNew: Fixed bogus lock assertions with iomMmioHandlerNew on the stack - didn't check the status code. Duh. bugref:9218

File:
1 edited

Legend:

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

    r81462 r81947  
    858858     * for SMP VMs if we're unlucky and the guest isn't well behaved.
    859859     */
    860     IOM_LOCK_SHARED(pVM);  /** @todo Need lookup that doesn't require locking... */
    861     RTGCPHYS offIgn;
    862     uint16_t idxIgn = UINT16_MAX;
    863860# ifdef IN_RING0
    864     Assert(pRegEntry == iomMmioGetEntry(pVM, GCPhysFault, &offIgn, &idxIgn) || !pRegEntryR3->fMapped);
     861    Assert(pRegEntry && (GCPhysFault - pRegEntryR3->GCPhysMapping < pRegEntryR3->cbRegion || !pRegEntryR3->fMapped));
    865862# else
    866     Assert(pRegEntry == iomMmioGetEntry(pVM, GCPhysFault, &offIgn, &idxIgn) || !pRegEntry->fMapped);
     863    Assert(pRegEntry && (GCPhysFault - pRegEntry->GCPhysMapping   < pRegEntry->cbRegion   || !pRegEntry->fMapped));
    867864# endif
    868     IOM_UNLOCK_SHARED(pVM);
    869865#endif
    870866
     
    10461042 *
    10471043 * @returns VBox status code.  This API may return VINF_SUCCESS even if no
    1048  *          remapping is made,.
     1044 *          remapping is made.
    10491045 *
    10501046 * @param   pVM             The cross context VM structure.
     
    11021098     * to prevent remapping.  Shared suffices as we change nothing.
    11031099     */
    1104     IOM_LOCK_SHARED(pVM);
    1105 
    1106     RTGCPHYS const GCPhys = pRegEntry->fMapped ? pRegEntry->GCPhysMapping : NIL_RTGCPHYS;
    1107     AssertReturnStmt(GCPhys != NIL_RTGCPHYS, IOM_UNLOCK_SHARED(pVM), VERR_IOM_MMIO_REGION_NOT_MAPPED);
    1108     Assert(!(GCPhys & PAGE_OFFSET_MASK));
    1109 
    1110     /*
    1111      * Do the aliasing; page align the addresses since PGM is picky.
    1112      */
     1100    int rc = IOM_LOCK_SHARED(pVM);
     1101    if (rc == VINF_SUCCESS)
     1102    {
     1103        RTGCPHYS const GCPhys = pRegEntry->fMapped ? pRegEntry->GCPhysMapping : NIL_RTGCPHYS;
     1104        if (GCPhys != NIL_RTGCPHYS)
     1105        {
     1106            Assert(!(GCPhys & PAGE_OFFSET_MASK));
     1107
     1108            /*
     1109             * Do the aliasing; page align the addresses since PGM is picky.
     1110             */
    11131111#if 0 /** @todo fix when DevVGA is converted to new model.  */
    1114     int rc = PGMHandlerPhysicalPageAlias(pVM, GCPhys, GCPhys + (offRange & ~(RTGCPHYS)PAGE_OFFSET_MASK),
    1115                                          pDevIns, hMmio2, offMmio2);
     1112            rc = PGMHandlerPhysicalPageAlias(pVM, GCPhys, GCPhys + (offRange & ~(RTGCPHYS)PAGE_OFFSET_MASK),
     1113                                             pDevIns, hMmio2, offMmio2);
    11161114#else
    1117     AssertFailed();
    1118     int rc = VERR_NOT_IMPLEMENTED;
    1119     RT_NOREF(offMmio2, hMmio2);
    1120 #endif
    1121 
    1122     IOM_UNLOCK_SHARED(pVM);
    1123 
    1124     AssertRCReturn(rc, rc);
     1115            AssertFailed();
     1116            rc = VERR_NOT_IMPLEMENTED;
     1117            RT_NOREF(offMmio2, hMmio2);
     1118#endif
     1119        }
     1120        else
     1121            AssertFailedStmt(rc = VERR_IOM_MMIO_REGION_NOT_MAPPED);
     1122
     1123        IOM_UNLOCK_SHARED(pVM);
     1124    }
    11251125
    11261126/** @todo either ditch this or replace it with something that works in the
     
    11441144    Assert(rc == VINF_SUCCESS || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT);
    11451145#endif
    1146     return VINF_SUCCESS;
     1146    return rc;
    11471147}
    11481148
     
    11801180     * Check input address (it's HM calling, not the device, so no region handle).
    11811181     */
    1182     IOM_LOCK_SHARED(pVM);
    1183     RTGCPHYS offIgn;
    1184     uint16_t idxIgn = UINT16_MAX;
    1185     PIOMMMIOENTRYR0 pRegEntry = iomMmioGetEntry(pVM, GCPhys, &offIgn, &idxIgn);
    1186     IOM_UNLOCK_SHARED(pVM);
    1187     Assert(pRegEntry);
    1188     Assert(pRegEntry && !(pRegEntry->cbRegion & PAGE_OFFSET_MASK));
     1182    int rcSem = IOM_LOCK_SHARED(pVM);
     1183    if (rcSem == VINF_SUCCESS)
     1184    {
     1185        RTGCPHYS offIgn;
     1186        uint16_t idxIgn = UINT16_MAX;
     1187        PIOMMMIOENTRYR0 pRegEntry = iomMmioGetEntry(pVM, GCPhys, &offIgn, &idxIgn);
     1188        IOM_UNLOCK_SHARED(pVM);
     1189        Assert(pRegEntry);
     1190        Assert(pRegEntry && !(pRegEntry->cbRegion & PAGE_OFFSET_MASK));
     1191    }
    11891192# endif
    11901193
     
    12631266    Assert((pRegEntry->cbRegion & PAGE_OFFSET_MASK) == 0);
    12641267
    1265     IOM_LOCK_SHARED(pVM);
     1268    int rcSem = IOM_LOCK_SHARED(pVM);
    12661269    RTGCPHYS GCPhys = pRegEntry->fMapped ? pRegEntry->GCPhysMapping : NIL_RTGCPHYS;
    1267     IOM_UNLOCK_SHARED(pVM);
     1270    if (rcSem == VINF_SUCCESS)
     1271        IOM_UNLOCK_SHARED(pVM);
    12681272
    12691273    Assert(!(GCPhys              & PAGE_OFFSET_MASK));
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