[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-02-16 20:23:07 +01:00
parent 34f4b218de
commit 5280deecfa
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
2 changed files with 1 additions and 1 deletions

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);
}

View file

@ -68,7 +68,6 @@ MmZeroPageThread(VOID)
NULL,
NULL);
OldIrql = MiAcquirePfnLock();
MmZeroingPageThreadActive = TRUE;
while (TRUE)
{