[NTOS:MM] Fix MmZeroingPageThreadActive race condition.

If a thread calls MiInsertPageInFreeList after the zero page thread has
woken up from its wait but before it acquired the PFN lock,
MmZeroingPageEvent might get set again even though there is no additional
work to be done.
By setting MmZeroingPageThreadActive together with the event, the variable
correctly indicates for future callers that the zero thread will process
newly added free pages.

This partially reverts r72990.
This commit is contained in:
Thomas Faber
2020-04-06 11:13:55 +02:00
parent 34f4b218de
commit 5280deecfa
2 changed files with 1 additions and 1 deletions
+1
View File
@@ -704,6 +704,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
if ((ListHead->Total >= 8) && !(MmZeroingPageThreadActive))
{
/* Set the event */
MmZeroingPageThreadActive = TRUE;
KeSetEvent(&MmZeroingPageEvent, IO_NO_INCREMENT, FALSE);
}
-1
View File
@@ -68,7 +68,6 @@ MmZeroPageThread(VOID)
NULL,
NULL);
OldIrql = MiAcquirePfnLock();
MmZeroingPageThreadActive = TRUE;
while (TRUE)
{