From 093333740468ad0af68280d53c928ed4bacfeea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Wed, 18 Nov 2020 17:45:47 +0100 Subject: [PATCH] [NTOS/MM] Do not dirtify section pages for system-space maps Cc does it for itself. --- ntoskrnl/mm/section.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index 46bf5cb571d..f108533ed2e 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -3343,8 +3343,12 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, else { if (Process) + { MmDeleteRmap(Page, Process, Address); - MmUnsharePageEntrySectionSegment(MemoryArea, Segment, &Offset, Dirty, FALSE, NULL); + } + + /* We don't dirtify for System Space Maps. We let Cc manage that */ + MmUnsharePageEntrySectionSegment(MemoryArea, Segment, &Offset, Process ? Dirty : FALSE, FALSE, NULL); } } }