mirror of
https://github.com/reactos/reactos.git
synced 2026-06-01 08:50:24 +08:00
[NTOS] Zero data unconditionally after segment end, unless section is created with SEC_RESERVE
Use a SEC_RESERVE section in Cc
This commit is contained in:
@@ -1286,7 +1286,7 @@ CcRosInitializeFileCache (
|
||||
NULL,
|
||||
&SharedCacheMap->SectionSize,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
SEC_RESERVE,
|
||||
NULL,
|
||||
FileObject);
|
||||
|
||||
|
||||
@@ -1208,7 +1208,8 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if ((MemoryArea->VadNode.u.VadFlags.VadType == VadImageMap) && ((SegOffset + PAGE_SIZE) > MemoryArea->SectionData.Segment->RawLength.QuadPart))
|
||||
if (!MemoryArea->SectionData.Section->u.Flags.Reserve
|
||||
&& ((SegOffset + PAGE_SIZE) > MemoryArea->SectionData.Segment->RawLength.QuadPart))
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PUCHAR PageMap;
|
||||
@@ -2209,6 +2210,8 @@ MmCreateDataFileSection(PSECTION *SectionObject,
|
||||
|
||||
if (AllocationAttributes & SEC_NO_CHANGE)
|
||||
Section->u.Flags.NoChange = 1;
|
||||
if (AllocationAttributes & SEC_RESERVE)
|
||||
Section->u.Flags.Reserve = 1;
|
||||
|
||||
if (!GotFileHandle)
|
||||
{
|
||||
@@ -4832,13 +4835,16 @@ MmExtendSection(
|
||||
PMM_SECTION_SEGMENT Segment = (PMM_SECTION_SEGMENT)Section->Segment;
|
||||
Section->SizeOfSection = *NewSize;
|
||||
|
||||
MmLockSectionSegment(Segment);
|
||||
if (Segment->RawLength.QuadPart < NewSize->QuadPart)
|
||||
if (!Section->u.Flags.Reserve)
|
||||
{
|
||||
Segment->RawLength = *NewSize;
|
||||
Segment->Length.QuadPart = (NewSize->QuadPart + PAGE_SIZE - 1) & ~((LONGLONG)PAGE_SIZE);
|
||||
MmLockSectionSegment(Segment);
|
||||
if (Segment->RawLength.QuadPart < NewSize->QuadPart)
|
||||
{
|
||||
Segment->RawLength = *NewSize;
|
||||
Segment->Length.QuadPart = (NewSize->QuadPart + PAGE_SIZE - 1) & ~((LONGLONG)PAGE_SIZE);
|
||||
}
|
||||
MmUnlockSectionSegment(Segment);
|
||||
}
|
||||
MmUnlockSectionSegment(Segment);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user