[NTOS/CC] Be more precise when notifying Mm about dirty pages

This commit is contained in:
Jérôme Gardou 2020-12-02 12:30:48 +01:00
parent c295d6b229
commit c74cbf0c0b
3 changed files with 15 additions and 3 deletions

View file

@ -586,6 +586,11 @@ CcCopyWrite (
Buffer = (PVOID)((ULONG_PTR)Buffer + VacbLength);
CurrentOffset += VacbLength;
Length -= VacbLength;
/* Tell Mm */
Status = MmMakePagesDirty(NULL, Add2Ptr(Vacb->BaseAddress, VacbOffset), VacbLength);
if (!NT_SUCCESS(Status))
ExRaiseStatus(Status);
}
_SEH2_FINALLY
{
@ -829,6 +834,11 @@ CcZeroData (
WriteOffset.QuadPart += VacbLength;
Length -= VacbLength;
/* Tell Mm */
Status = MmMakePagesDirty(NULL, Add2Ptr(Vacb->BaseAddress, VacbOffset), VacbLength);
if (!NT_SUCCESS(Status))
ExRaiseStatus(Status);
}
_SEH2_FINALLY
{

View file

@ -540,6 +540,11 @@ CcSetDirtyPinnedData (
CCTRACE(CC_API_DEBUG, "Bcb=%p Lsn=%p\n",
Bcb, Lsn);
/* Tell Mm */
MmMakePagesDirty(NULL,
Add2Ptr(iBcb->Vacb->BaseAddress, iBcb->PFCB.MappedFileOffset.QuadPart - iBcb->Vacb->FileOffset.QuadPart),
iBcb->PFCB.MappedLength);
if (!iBcb->Vacb->Dirty)
{
CcRosMarkDirtyVacb(iBcb->Vacb);

View file

@ -420,9 +420,6 @@ CcRosMarkDirtyVacb (
CcScheduleLazyWriteScan(FALSE);
}
KeReleaseQueuedSpinLock(LockQueueMasterLock, oldIrql);
/* Tell Mm */
MmMakePagesDirty(NULL, Vacb->BaseAddress, Length);
}
VOID