VirtualBox

Changeset 64301 in vbox for trunk/src


Ignore:
Timestamp:
Oct 17, 2016 2:28:31 PM (8 years ago)
Author:
vboxsync
Message:

Devices/VirtIO: additional check

File:
1 edited

Legend:

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

    r63562 r64301  
    144144        VQUEUESEG *pSeg;
    145145
     146        /*
     147         * Malicious guests may try to trick us into writing beyond aSegsIn or
     148         * aSegsOut boundaries by linking several descriptors into a loop. We
     149         * cannot possibly get a sequence of linked descriptors exceeding the
     150         * total number of descriptors in the ring (see @bugref{8620}).
     151         */
     152        if (pElem->nIn + pElem->nOut >= VRING_MAX_SIZE)
     153        {
     154            static volatile uint32_t s_cMessages  = 0;
     155            static volatile uint32_t s_cThreshold = 1;
     156            if (ASMAtomicIncU32(&s_cMessages) == ASMAtomicReadU32(&s_cThreshold))
     157            {
     158                LogRel(("%s: too many linked descriptors; check if the guest arranges descriptors in a loop.\n",
     159                        INSTANCE(pState)));
     160                if (ASMAtomicReadU32(&s_cMessages) != 1)
     161                    LogRel(("%s: (the above error has occured %u times so far)\n",
     162                            INSTANCE(pState), ASMAtomicReadU32(&s_cMessages)));
     163                ASMAtomicWriteU32(&s_cThreshold, ASMAtomicReadU32(&s_cThreshold) * 10);
     164            }
     165            break;
     166        }
     167       
    146168        vringReadDesc(pState, &pQueue->VRing, idx, &desc);
    147169        if (desc.u16Flags & VRINGDESC_F_WRITE)
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