VirtualBox

Changeset 25308 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Dec 10, 2009 4:48:49 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
55874
Message:

SUPDrv: Lock down the natively loaded image.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r25307 r25308  
    435435    /** The section object for the loaded image (fNative=true). */
    436436    void                           *pvNtSectionObj;
     437    /** Lock object. */
     438    RTR0MEMOBJ                      hMemLock;
    437439#endif
    438440    /** Whether it's loaded by the native loader or not. */
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r25300 r25308  
    614614int  VBOXCALL   supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
    615615{
     616    pImage->pvNtSectionObj = NULL;
     617    pImage->hMemLock = NIL_RTR0MEMOBJ;
     618
    616619#ifdef VBOX_WITHOUT_NATIVE_R0_LOADER
    617620    NOREF(pDevExt); NOREF(pszFilename); NOREF(pImage);
     
    663666            if (pImage->cbImageBits == Info.ImageLength)
    664667            {
    665                 /** @todo do we need to lock down the image? */
    666                 rc = VINF_SUCCESS;
     668                /*
     669                 * Lock down the entire image, just to be on the safe side.
     670                 */
     671                rc = RTR0MemObjLockKernel(&pImage->hMemLock, pImage->pvImage, pImage->cbImageBits, RTMEM_PROT_READ);
     672                if (RT_FAILURE(rc))
     673                {
     674                    pImage->hMemLock = NIL_RTR0MEMOBJ;
     675                    supdrvOSLdrUnload(pDevExt, pImage);
     676                }
    667677            }
    668678            else
     
    752762    if (pImage->pvNtSectionObj)
    753763    {
     764        if (pImage->hMemLock != NIL_RTR0MEMOBJ)
     765        {
     766            RTR0MemObjFree(pImage->hMemLock, false /*fFreeMappings*/);
     767            pImage->hMemLock = NIL_RTR0MEMOBJ;
     768        }
     769
    754770        NTSTATUS rc = ZwSetSystemInformation(MY_SystemUnloadGdiDriverInformation,
    755771                                             &pImage->pvNtSectionObj, sizeof(pImage->pvNtSectionObj));
     772        pImage->pvNtSectionObj = NULL;
    756773    }
    757774    NOREF(pDevExt);
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