From a93e065ebce692289cec49af0e686122be479fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 23 Feb 2021 11:07:35 +0100 Subject: [PATCH] [NTOS:MM] Do not chunk-read file when we are the modified-page-writer thread --- ntoskrnl/mm/section.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index ea56635b72f..b3e300a58cc 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -1200,8 +1200,10 @@ MmMakeSegmentResident( if (!NT_SUCCESS(Status)) return Status; - /* If the file is not random access, read a 64K Chunk. */ - if (!FlagOn(FileObject->Flags, FO_RANDOM_ACCESS)) + /* If the file is not random access and we are not the page out thread + * read a 64K Chunk. */ + if (((ULONG_PTR)IoGetTopLevelIrp() != FSRTL_MOD_WRITE_TOP_LEVEL_IRP) + && !FlagOn(FileObject->Flags, FO_RANDOM_ACCESS)) { RangeStart = Offset - (Offset % _64K); if (RangeEnd % _64K)