https://git.reactos.org/?p=reactos.git;a=commitdiff;h=91edefa11e4d7230155dca...
commit 91edefa11e4d7230155dcaafe052a6fd10d7dd57 Author: Jérôme Gardou jerome.gardou@reactos.org AuthorDate: Wed Dec 2 11:40:25 2020 +0100 Commit: Jérôme Gardou jerome.gardou@reactos.org CommitDate: Wed Feb 3 09:41:22 2021 +0100
[NTOS:MM] Do not limit ourselves in reading or writing the file --- ntoskrnl/mm/section.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index 8df9b99cfb8..f3b30dedaed 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -214,16 +214,9 @@ MiWritePage(PMM_SECTION_SEGMENT Segment, PMDL Mdl = (PMDL)MdlBase; PFILE_OBJECT FileObject = Segment->FileObject; LARGE_INTEGER FileOffset; - PFSRTL_COMMON_FCB_HEADER Fcb = FileObject->FsContext;
FileOffset.QuadPart = Segment->Image.FileOffset + SegOffset;
- /* Check if we are not writing off-limit */ - if (FileOffset.QuadPart >= Fcb->AllocationSize.QuadPart) - { - return STATUS_SUCCESS; - } - RtlZeroMemory(MdlBase, sizeof(MdlBase)); MmInitializeMdl(Mdl, NULL, PAGE_SIZE); MmBuildMdlFromPages(Mdl, &Page); @@ -1179,18 +1172,15 @@ MiReadPage(PMEMORY_AREA MemoryArea, PMDL Mdl = (PMDL)MdlBase; PFILE_OBJECT FileObject = MemoryArea->SectionData.Segment->FileObject; LARGE_INTEGER FileOffset; - PFSRTL_COMMON_FCB_HEADER Fcb = FileObject->FsContext;
FileOffset.QuadPart = MemoryArea->SectionData.Segment->Image.FileOffset + SegOffset;
+ DPRINT("Reading file at offset %08x:%08x\n", FileOffset.HighPart, FileOffset.LowPart); + Status = MmRequestPageMemoryConsumer(MC_USER, FALSE, Page); if (!NT_SUCCESS(Status)) return Status;
- /* Check if we are beyond the file */ - if (FileOffset.QuadPart > Fcb->FileSize.QuadPart) - return STATUS_SUCCESS; - RtlZeroMemory(MdlBase, sizeof(MdlBase)); MmInitializeMdl(Mdl, NULL, PAGE_SIZE); MmBuildMdlFromPages(Mdl, Page); @@ -1204,6 +1194,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, KeWaitForSingleObject(&Event, WrPageIn, KernelMode, FALSE, NULL); Status = IoStatus.Status; } + if (Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) { MmUnmapLockedPages (Mdl->MappedSystemVa, Mdl); @@ -4539,6 +4530,7 @@ MmMakePagesResident( MmUnlockAddressSpace(AddressSpace);
/* FIXME: Read the whole range at once instead of one page at a time */ + /* Ignore file size, as Cc already checked on its side. */ Status = MiReadPage(MemoryArea, SegmentOffset.QuadPart, &Page); if (!NT_SUCCESS(Status)) {