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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.3
    • NTCore

    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

        1. sync_PEPROCESS.patch
          2 kB
          vshcherbyna
        2. V2_sync_PEPROCESS.patch
          1 kB
          vshcherbyna

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: