VirtualBox

Ignore:
Timestamp:
Jun 15, 2018 8:36:17 PM (7 years ago)
Author:
vboxsync
Message:

Runtime/RTFuzz: Started to extend the master command to provide a network interface for controlling the fuzzing process. The interface uses JSON requests and responses to control the fuzzing process, like creating a new fuzzing run and suspending, resuming and stopping it. The JSON request contains everything required (except for the binary itself) for easier control of multiple masters on different hosts via a central control mechanism (later integration into the validation kit).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/fuzz/fuzz-observer.cpp

    r72465 r72571  
    880880
    881881        if (RT_SUCCESS(rc))
     882        {
    882883            pThis->paObsThreads = paObsThreads;
     884            pThis->cThreads     = cThreads;
     885        }
    883886        else
    884887            RTMemFree(paObsThreads);
     
    957960    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    958961
    959     /* Wait for the master thread to terminate. */
    960     if (pThis->hThreadGlobal != NIL_RTTHREAD)
    961     {
    962         ASMAtomicXchgBool(&pThis->fShutdown, true);
    963         RTThreadWait(pThis->hThreadGlobal, RT_INDEFINITE_WAIT, NULL);
    964     }
    965 
    966     /* Clean up the workers. */
    967     if (pThis->paObsThreads)
    968     {
    969         for (unsigned i = 0; i < pThis->cThreads; i++)
    970         {
    971             PRTFUZZOBSTHRD pThrd = &pThis->paObsThreads[i];
    972             ASMAtomicXchgBool(&pThrd->fShutdown, true);
    973             RTThreadWait(pThrd->hThread, RT_INDEFINITE_WAIT, NULL);
    974             if (pThrd->hFuzzInput)
    975                 RTFuzzInputRelease(pThrd->hFuzzInput);
    976         }
    977         RTMemFree(pThis->paObsThreads);
    978         pThis->paObsThreads = NULL;
    979     }
     962    RTFuzzObsExecStop(hFuzzObs);
    980963
    981964    /* Clean up all acquired resources. */
     
    11451128RTDECL(int) RTFuzzObsExecStop(RTFUZZOBS hFuzzObs)
    11461129{
    1147     RT_NOREF(hFuzzObs);
    1148     return VERR_NOT_IMPLEMENTED;
    1149 }
    1150 
     1130    PRTFUZZOBSINT pThis = hFuzzObs;
     1131    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     1132
     1133    /* Wait for the master thread to terminate. */
     1134    if (pThis->hThreadGlobal != NIL_RTTHREAD)
     1135    {
     1136        ASMAtomicXchgBool(&pThis->fShutdown, true);
     1137        RTSemEventSignal(pThis->hEvtGlobal);
     1138        RTThreadWait(pThis->hThreadGlobal, RT_INDEFINITE_WAIT, NULL);
     1139        pThis->hThreadGlobal = NIL_RTTHREAD;
     1140    }
     1141
     1142    /* Destroy the workers. */
     1143    if (pThis->paObsThreads)
     1144    {
     1145        for (unsigned i = 0; i < pThis->cThreads; i++)
     1146        {
     1147            PRTFUZZOBSTHRD pThrd = &pThis->paObsThreads[i];
     1148            ASMAtomicXchgBool(&pThrd->fShutdown, true);
     1149            RTThreadUserSignal(pThrd->hThread);
     1150            RTThreadWait(pThrd->hThread, RT_INDEFINITE_WAIT, NULL);
     1151            if (pThrd->hFuzzInput)
     1152                RTFuzzInputRelease(pThrd->hFuzzInput);
     1153        }
     1154
     1155        RTMemFree(pThis->paObsThreads);
     1156        pThis->paObsThreads = NULL;
     1157        pThis->cThreads     = 0;
     1158    }
     1159
     1160    RTSemEventDestroy(pThis->hEvtGlobal);
     1161    pThis->hEvtGlobal = NIL_RTSEMEVENT;
     1162    return VINF_SUCCESS;
     1163}
     1164
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