VirtualBox

Ignore:
Timestamp:
Jan 28, 2015 1:44:00 PM (10 years ago)
Author:
vboxsync
Message:

Support: added SUPR3LockDownLoader()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r53843 r54013  
    148148static int                  supdrvIOCtl_LdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRLOAD pReq);
    149149static int                  supdrvIOCtl_LdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRFREE pReq);
     150static int                  supdrvIOCtl_LdrLockDown(PSUPDRVDEVEXT pDevExt);
    150151static int                  supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq);
    151152static int                  supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq);
     
    17101711        }
    17111712
     1713        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_LOCK_DOWN):
     1714        {
     1715            /* validate */
     1716            REQ_CHECK_SIZES(SUP_IOCTL_LDR_LOCK_DOWN);
     1717
     1718            /* execute */
     1719            pReqHdr->rc = supdrvIOCtl_LdrLockDown(pDevExt);
     1720            return 0;
     1721        }
     1722
    17121723        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_GET_SYMBOL):
    17131724        {
     
    45574568    /* (not found - add it!) */
    45584569
     4570    /* If the loader interface is locked down, make userland fail early */
     4571    if (pDevExt->fLdrLockedDown)
     4572    {
     4573        supdrvLdrUnlock(pDevExt);
     4574        Log(("supdrvIOCtl_LdrOpen: Not adding '%s' to image list, loader interface is locked down!\n", pReq->u.In.szName));
     4575        return VERR_PERMISSION_DENIED;
     4576    }
     4577
    45594578    /*
    45604579     * Allocate memory.
     
    47224741    }
    47234742
     4743    /* If the loader interface is locked down, don't load new images */
     4744    if (pDevExt->fLdrLockedDown)
     4745    {
     4746        supdrvLdrUnlock(pDevExt);
     4747        Log(("SUP_IOCTL_LDR_LOAD: Not loading '%s' image bits, loader interface is locked down!\n", pImage->szName));
     4748        return VERR_PERMISSION_DENIED;
     4749    }
     4750
    47244751    switch (pReq->u.In.eEPType)
    47254752    {
     
    49845011
    49855012/**
     5013 * Lock down the image loader interface.
     5014 *
     5015 * @returns IPRT status code.
     5016 * @param   pDevExt     Device globals.
     5017 */
     5018static int supdrvIOCtl_LdrLockDown(PSUPDRVDEVEXT pDevExt)
     5019{
     5020    LogFlow(("supdrvIOCtl_LdrLockDown:\n"));
     5021
     5022    supdrvLdrLock(pDevExt);
     5023    if (!pDevExt->fLdrLockedDown)
     5024    {
     5025        pDevExt->fLdrLockedDown = true;
     5026        Log(("supdrvIOCtl_LdrLockDown: Image loader interface locked down\n"));
     5027    }
     5028    supdrvLdrUnlock(pDevExt);
     5029
     5030    return VINF_SUCCESS;
     5031}
     5032
     5033
     5034/**
    49865035 * Gets the address of a symbol in an open image.
    49875036 *
     
    52525301    PSUPDRVLDRIMAGE pImagePrev;
    52535302    LogFlow(("supdrvLdrFree: pImage=%p\n", pImage));
     5303
     5304    /*
     5305     * Warn if we're releasing images while the image loader interface is
     5306     * locked down -- we won't be able to reload them!
     5307     */
     5308    if (pDevExt->fLdrLockedDown)
     5309        Log(("supdrvLdrFree: Warning: unloading '%s' image, while loader interface is locked down!\n", pImage->szName));
    52545310
    52555311    /* find it - arg. should've used doubly linked list. */
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