https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5280deecfa288fe32a753…
commit 5280deecfa288fe32a7538347871da0cd47cd141
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sun Feb 16 20:23:07 2020 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Mon Apr 6 11:13:55 2020 +0200
[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.
---
ntoskrnl/mm/ARM3/pfnlist.c | 1 +
ntoskrnl/mm/ARM3/zeropage.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/ntoskrnl/mm/ARM3/pfnlist.c b/ntoskrnl/mm/ARM3/pfnlist.c
index f79a5013250..eac3a043418 100644
--- a/ntoskrnl/mm/ARM3/pfnlist.c
+++ b/ntoskrnl/mm/ARM3/pfnlist.c
@@ -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);
}
diff --git a/ntoskrnl/mm/ARM3/zeropage.c b/ntoskrnl/mm/ARM3/zeropage.c
index e2b96ca56a8..6d859f6806f 100644
--- a/ntoskrnl/mm/ARM3/zeropage.c
+++ b/ntoskrnl/mm/ARM3/zeropage.c
@@ -68,7 +68,6 @@ MmZeroPageThread(VOID)
NULL,
NULL);
OldIrql = MiAcquirePfnLock();
- MmZeroingPageThreadActive = TRUE;
while (TRUE)
{