VirtualBox

Changeset 6422 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jan 21, 2008 6:11:53 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27388
Message:

Outlined how to handle the requests on solaris.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c

    r6411 r6422  
    725725     * driver, i.e. the request is just a fixed size header containing the buffer pointer and size of the
    726726     * real request (SUPREQHDR). Trying to save the extra ddi_copyin isn't worth the effort and inflexibility. */
     727#if 0
     728    /*
     729     * Read and validate the request wrapper.
     730     */
     731    VBGLBIGREQ ReqWrap;
     732    if (IOCPARM_LEN(Cmd) != sizeof(ReqWrap))
     733    {
     734        Log((DEVICE_NAME ": VBoxAddSolarisIOCtl: bad request %#x\n", Cmd));
     735        return ENOTTY;
     736    }
     737
     738    rc = ddi_copyin((void *)pArg, &ReqWrap, sizeof(ReqWrap), Mode);
     739    if (RT_UNLIKELY(rc))
     740    {
     741        Log((DEVICE_NAME ": VBoxAddSolarisIOCtl: ddi_copyin failed to read header pArg=%p Cmd=%d. rc=%d.\n", pArg, Cmd, rc));
     742        return EINVAL;
     743    }
     744
     745    if (ReqWrap.u32Magic != VBGLBIGREQ_MAGIC)
     746    {
     747        Log((DEVICE_NAME ": VBoxAddSolarisIOCtl: bad magic %#x; pArg=%p Cmd=%d.\n", ReqWrap.u32Magic, pArg, Cmd));
     748        return EINVAL;
     749    }
     750    if (RT_UNLIKELY(   ReqWrap.cbData == 0
     751                    || ReqWrap.cbData > _1M*16))
     752    {
     753        Log((DEVICE_NAME ": VBoxAddSolarisIOCtl: bad size %#x; pArg=%p Cmd=%d.\n", ReqWrap.cbData, pArg, Cmd));
     754        return EINVAL;
     755    }
     756
     757#else
    727758    uint32_t cbBuf = 0;
    728759    int rc = 0;
     
    842873        cbBuf += Hdr.cParms * sizeof(HGCMFunctionParameter);
    843874    }
     875#endif
    844876
    845877    /*
    846878     * Read the request.
    847879     */
     880#if 0
     881    void *pvBuf = RTMemTmpAlloc(ReqWrap.cbData);
     882#else
    848883    void *pvBuf = RTMemTmpAlloc(cbBuf);
     884#endif
    849885    if (RT_UNLIKELY(!pvBuf))
    850886    {
     
    853889    }
    854890
     891#if 0
     892    rc = ddi_copyin((void *)pArg, (void *)(uintptr_t)ReqWrap.pvData, ReqWrap.cbData, Mode);
     893#else
    855894    rc = ddi_copyin((void *)pArg, pvBuf, cbBuf, Mode);
     895#endif
    856896    if (RT_UNLIKELY(rc))
    857897    {
     
    879919            cbDataReturned = cbBuf;
    880920        }
     921#if 0
     922        rc = ddi_copyout(pvBuf, (void *)(uintptr_t)ReqWrap.pvData, cbDataReturned, Mode);
     923#else
    881924        rc = ddi_copyout(pvBuf, (void *)pArg, cbDataReturned, Mode);
     925#endif
    882926        if (RT_UNLIKELY(rc))
    883927        {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette