VirtualBox

Changeset 81628 in vbox for trunk/src/VBox/Devices/VirtIO


Ignore:
Timestamp:
Nov 2, 2019 7:40:09 AM (5 years ago)
Author:
vboxsync
Message:

Storage/DevVirtioSCSI.cpp Fixed leaks found with Sanitizer. Worked on save/live exec code but that is untested, due host crash on crash on Linux that needs to be fixed first. See BugRef:9440, Comment #119

Location:
trunk/src/VBox/Devices/VirtIO
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp

    r81402 r81628  
    278278         pVirtq->uUsedIdx,  QUEUENAME(qIdx), uUsedIdx));
    279279
     280    RTMemFree((void *)pDescChain->pSgPhysSend->paSegs);
     281    RTMemFree(pDescChain->pSgPhysSend);
    280282    RTMemFree((void *)pSgPhysReturn->paSegs);
    281283    RTMemFree(pSgPhysReturn);
     
    314316static void virtioQueueNotified(PVIRTIOSTATE pVirtio, uint16_t qIdx, uint16_t uNotifyIdx)
    315317{
    316     Assert(uNotifyIdx == qIdx);
    317     (void)uNotifyIdx;
     318    /* See VirtIO 1.0, section 4.1.5.2 It implies that qIdx and uNotifyIdx should match.
     319     * Disregarding this notification may cause throughput to stop, however there's no way to know
     320     * which was queue was intended for wake-up if the two parameters disagree. */
     321
     322    AssertMsg(uNotifyIdx == qIdx,
     323        ("Notification param disagreement. Guest kicked virtq %d's notify addr w/non-corresponding virtq idx %d\n",
     324            qIdx, uNotifyIdx));
     325
     326//    AssertMsgReturn(uNotifyIdx == qIdx,
     327//        ("Notification param disagreement. Guest kicked virtq %d's notify addr w/non-corresponding virtq idx %d\n",
     328//            qIdx, uNotifyIdx));
     329    RT_NOREF(uNotifyIdx);
    318330
    319331    PVIRTQSTATE pVirtq = &pVirtio->virtqState[qIdx];
    320332    Log6Func(("%s\n", pVirtq->szVirtqName));
    321     (void)pVirtq;
     333    RT_NOREF(pVirtq);
    322334
    323335    /** Inform client */
     
    470482    pVirtio->uISR                   = 0;
    471483
     484    virtioLowerInterrupt(pVirtio);
    472485
    473486    if (!pVirtio->fMsiSupport)  /* VirtIO 1.0, 4.1.4.3 and 4.1.5.1.2 */
     
    827840        uint16_t qIdx = uNotifyBaseOffset / VIRTIO_NOTIFY_OFFSET_MULTIPLIER;
    828841        uint16_t uAvailDescIdx = *(uint16_t *)pv;
     842
    829843        virtioQueueNotified(pVirtio, qIdx, uAvailDescIdx);
    830844    }
     
    12601274    rc = SSMR3PutU32(pSSM,    pVirtio->uDriverFeaturesSelect);
    12611275    rc = SSMR3PutU32(pSSM,    pVirtio->uNumQueues);
    1262     rc = SSMR3PutU32(pSSM,    pVirtio->cbDevSpecificCfg);
    1263     rc = SSMR3PutU64(pSSM,    pVirtio->uDeviceFeatures);
    12641276    rc = SSMR3PutU64(pSSM,    pVirtio->uDriverFeatures);
    1265     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->pDevSpecificCfg);
    1266     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnVirtioStatusChanged);
    1267     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnVirtioQueueNotified);
    1268     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnVirtioDevCapRead);
    1269     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnVirtioDevCapWrite);
    1270     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnSSMDevLiveExec);
    1271     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnSSMDevSaveExec);
    1272     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnSSMDevLoadExec);
    1273     rc = SSMR3PutU64(pSSM,    (uint64_t)pVirtio->virtioCallbacks.pfnSSMDevLoadDone);
    1274     rc = SSMR3PutGCPhys(pSSM, pVirtio->pGcPhysCommonCfg);
    1275     rc = SSMR3PutGCPhys(pSSM, pVirtio->pGcPhysNotifyCap);
    1276     rc = SSMR3PutGCPhys(pSSM, pVirtio->pGcPhysIsrCap);
    1277     rc = SSMR3PutGCPhys(pSSM, pVirtio->pGcPhysDeviceCap);
    1278     rc = SSMR3PutGCPhys(pSSM, pVirtio->pGcPhysPciCapBase);
    12791277
    12801278    for (uint16_t i = 0; i < pVirtio->uNumQueues; i++)
     
    13161314        rc = SSMR3GetU32(pSSM,   &pVirtio->uDriverFeaturesSelect);
    13171315        rc = SSMR3GetU32(pSSM,   &pVirtio->uNumQueues);
    1318         rc = SSMR3GetU32(pSSM,   &pVirtio->cbDevSpecificCfg);
    1319         rc = SSMR3GetU64(pSSM,   &pVirtio->uDeviceFeatures);
    13201316        rc = SSMR3GetU64(pSSM,   &pVirtio->uDriverFeatures);
    1321         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->pDevSpecificCfg);
    1322         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnVirtioStatusChanged);
    1323         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnVirtioQueueNotified);
    1324         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnVirtioDevCapRead);
    1325         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnVirtioDevCapWrite);
    1326         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnSSMDevLiveExec);
    1327         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnSSMDevSaveExec);
    1328         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnSSMDevLoadExec);
    1329         rc = SSMR3GetU64(pSSM,   (uint64_t *)&pVirtio->virtioCallbacks.pfnSSMDevLoadDone);
    1330         rc = SSMR3GetGCPhys(pSSM, &pVirtio->pGcPhysCommonCfg);
    1331         rc = SSMR3GetGCPhys(pSSM, &pVirtio->pGcPhysNotifyCap);
    1332         rc = SSMR3GetGCPhys(pSSM, &pVirtio->pGcPhysIsrCap);
    1333         rc = SSMR3GetGCPhys(pSSM, &pVirtio->pGcPhysDeviceCap);
    1334         rc = SSMR3GetGCPhys(pSSM, &pVirtio->pGcPhysPciCapBase);
     1317
    13351318
    13361319        for (uint16_t i = 0; i < pVirtio->uNumQueues; i++)
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0_impl.h

    r81122 r81628  
    465465{
    466466    AssertMsg(pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK, ("Called with guest driver not ready\n"));
     467    RT_UNTRUSTED_VALIDATED_FENCE(); /* VirtIO 1.0, Section 3.2.1.4.1 */
    467468    PDMDevHlpPCIPhysWrite(pVirtio->CTX_SUFF(pDevIns),
    468469                          pVirtio->pGcPhysQueueUsed[qIdx] + RT_UOFFSETOF(VIRTQ_USED_T, fFlags),
     
    473474{
    474475    uint16_t uAvailEventIdx;
     476    RT_UNTRUSTED_VALIDATED_FENCE(); /* VirtIO 1.0, Section 3.2.1.4.1 */
    475477    /** VirtIO 1.0 uAvailEventIdx (avail_event) immediately follows ring */
    476478    AssertMsg(pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK, ("Called with guest driver not ready\n"));
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