VirtualBox

Changeset 86426 in vbox


Ignore:
Timestamp:
Oct 2, 2020 3:47:58 PM (4 years ago)
Author:
vboxsync
Message:

VMM/PDMLdr: Don't try release .r0 objects till PDMR3TermUVM is called, then the VM structure + ring-0 object will be freed and VMMR0.r0 no longer in use. bugref:9841

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r84493 r86426  
    884884     * Free modules.
    885885     */
    886     pdmR3LdrTermU(pVM->pUVM);
     886    pdmR3LdrTermU(pVM->pUVM, false /*fFinal*/);
    887887
    888888    /*
     
    916916     * the first time, which is why we do it.
    917917     */
    918     pdmR3LdrTermU(pUVM);
     918    pdmR3LdrTermU(pUVM, true /*fFinal*/);
    919919
    920920    Assert(pUVM->pdm.s.pCritSects == NULL);
  • trunk/src/VBox/VMM/VMMR3/PDMLdr.cpp

    r82968 r86426  
    122122 *
    123123 * @param   pUVM        The user mode VM structure.
     124 * @param   fFinal      This is clear when in the PDMR3Term/vmR3Destroy call
     125 *                      chain, and set when called from PDMR3TermUVM.
    124126 *
    125127 * @remarks This is normally called twice during termination.
    126128 */
    127 void pdmR3LdrTermU(PUVM pUVM)
     129void pdmR3LdrTermU(PUVM pUVM, bool fFinal)
    128130{
    129131    /*
     
    147149        {
    148150            case PDMMOD_TYPE_R0:
    149             {
    150                 Assert(pModule->ImageBase);
    151                 int rc2 = SUPR3FreeModule((void *)(uintptr_t)pModule->ImageBase);
    152                 AssertRC(rc2);
    153                 pModule->ImageBase = 0;
    154                 break;
    155             }
     151                if (fFinal)
     152                {
     153                    Assert(pModule->ImageBase);
     154                    int rc2 = SUPR3FreeModule((void *)(uintptr_t)pModule->ImageBase);
     155                    AssertRC(rc2);
     156                    pModule->ImageBase = 0;
     157                    break;
     158                }
     159
     160                /* Postpone ring-0 module till the PDMR3TermUVM() phase as VMMR0.r0 is still
     161                   busy when we're called the first time very very early in vmR3Destroy().  */
     162                pModule = pModule->pNext;
     163                continue;
    156164
    157165#ifdef VBOX_WITH_RAW_MODE_KEEP
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r85126 r86426  
    16081608
    16091609int         pdmR3LdrInitU(PUVM pUVM);
    1610 void        pdmR3LdrTermU(PUVM pUVM);
     1610void        pdmR3LdrTermU(PUVM pUVM, bool fFinal);
    16111611char       *pdmR3FileR3(const char *pszFile, bool fShared);
    16121612int         pdmR3LoadR3U(PUVM pUVM, const char *pszFilename, const char *pszName);
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