Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-12001

[PATCH] Fix un-synchronized access to PEPROCESS in QsiSystemProcessInformation(...)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: 0.4.3
    • Component/s: NTCore
    • Labels:

      Description

      Hello,

      I've been hunting zombie processes in ReactOS and I noticed that we do not protect at all a process when enumerating in QsiSystemProcessInformation(...):

      do
              {
                  SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
       
                  if ((Process->ProcessExiting) &&
                      (Process->Pcb.Header.SignalState) &&
                      !(Process->ActiveThreads) &&
                      (IsListEmpty(&Process->Pcb.ThreadListHead)))
                  {
                      DPRINT1("Process %p (%s:%p) is a zombie\n",
                              Process, Process->ImageFileName, Process->UniqueProcessId);
                      CurrentSize = 0;
                      ImageNameMaximumLength = 0;
                      goto Skip;
                  }

      and also when checking condition for initialized ThreadListEntry in PspDeleteThread(...):

      /* Check if the thread list is valid */
          if (Thread->ThreadListEntry.Flink)
          {
              /* Lock the thread's process */
              KeEnterCriticalRegion();
              ExAcquirePushLockExclusive(&Process->ProcessLock);
       
              /* Remove us from the list */
              RemoveEntryList(&Thread->ThreadListEntry);
       
              /* Release the lock */
              ExReleasePushLockExclusive(&Process->ProcessLock);
              KeLeaveCriticalRegion();
          }

      The attached patch fixes both problems.

        Attachments

          Activity

            People

            • Assignee:
              ThFabba ThFabba
              Reporter:
              vshcherbyna vshcherbyna
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: