mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:13:01 +00:00
[NTOSKRNL]: Drop the reference on the PDE for kernel stack pages being deleted, now that zekflop has made all PDEs ARM3-owned.
svn path=/trunk/; revision=55882
This commit is contained in:
parent
270acce7b4
commit
2c7855ed9d
1 changed files with 12 additions and 13 deletions
|
@ -201,7 +201,7 @@ MmDeleteTeb(IN PEPROCESS Process,
|
||||||
|
|
||||||
/* Delete the pages */
|
/* Delete the pages */
|
||||||
MiDeleteVirtualAddresses((ULONG_PTR)Teb, TebEnd, NULL);
|
MiDeleteVirtualAddresses((ULONG_PTR)Teb, TebEnd, NULL);
|
||||||
|
|
||||||
/* Release the working set */
|
/* Release the working set */
|
||||||
MiUnlockProcessWorkingSet(Process, Thread);
|
MiUnlockProcessWorkingSet(Process, Thread);
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ MmDeleteKernelStack(IN PVOID StackBase,
|
||||||
PMMPTE PointerPte;
|
PMMPTE PointerPte;
|
||||||
PFN_NUMBER PageFrameNumber, PageTableFrameNumber;
|
PFN_NUMBER PageFrameNumber, PageTableFrameNumber;
|
||||||
PFN_COUNT StackPages;
|
PFN_COUNT StackPages;
|
||||||
PMMPFN Pfn1;//, Pfn2;
|
PMMPFN Pfn1, Pfn2;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
|
||||||
|
@ -256,15 +256,14 @@ MmDeleteKernelStack(IN PVOID StackBase,
|
||||||
/* Get the PTE's page */
|
/* Get the PTE's page */
|
||||||
PageFrameNumber = PFN_FROM_PTE(PointerPte);
|
PageFrameNumber = PFN_FROM_PTE(PointerPte);
|
||||||
Pfn1 = MiGetPfnEntry(PageFrameNumber);
|
Pfn1 = MiGetPfnEntry(PageFrameNumber);
|
||||||
#if 1 // ARM3 might not own the page table, so don't take this risk. Leak it instead!
|
|
||||||
/* Now get the page of the page table mapping it */
|
/* Now get the page of the page table mapping it */
|
||||||
PageTableFrameNumber = Pfn1->u4.PteFrame;
|
PageTableFrameNumber = Pfn1->u4.PteFrame;
|
||||||
//Pfn2 = MiGetPfnEntry(PageTableFrameNumber);
|
Pfn2 = MiGetPfnEntry(PageTableFrameNumber);
|
||||||
|
|
||||||
/* Remove a shared reference, since the page is going away */
|
/* Remove a shared reference, since the page is going away */
|
||||||
DPRINT("SystemPTE PDE: %lx\n", PageTableFrameNumber);
|
MiDecrementShareCount(Pfn2, PageTableFrameNumber);
|
||||||
//MiDecrementShareCount(Pfn2, PageTableFrameNumber);
|
|
||||||
#endif
|
|
||||||
/* Set the special pending delete marker */
|
/* Set the special pending delete marker */
|
||||||
MI_SET_PFN_DELETED(Pfn1);
|
MI_SET_PFN_DELETED(Pfn1);
|
||||||
|
|
||||||
|
@ -925,7 +924,7 @@ MiInitializeWorkingSetList(IN PEPROCESS CurrentProcess)
|
||||||
Pfn1 = MiGetPfnEntry(CurrentProcess->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT);
|
Pfn1 = MiGetPfnEntry(CurrentProcess->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT);
|
||||||
ASSERT(Pfn1->u4.PteFrame == MiGetPfnEntryIndex(Pfn1));
|
ASSERT(Pfn1->u4.PteFrame == MiGetPfnEntryIndex(Pfn1));
|
||||||
Pfn1->u1.Event = (PKEVENT)CurrentProcess;
|
Pfn1->u1.Event = (PKEVENT)CurrentProcess;
|
||||||
|
|
||||||
/* Map the process working set in kernel space */
|
/* Map the process working set in kernel space */
|
||||||
sysPte = MiReserveSystemPtes(1, SystemPteSpace);
|
sysPte = MiReserveSystemPtes(1, SystemPteSpace);
|
||||||
MI_MAKE_HARDWARE_PTE_KERNEL(&tempPte, sysPte, MM_READWRITE, CurrentProcess->WorkingSetPage);
|
MI_MAKE_HARDWARE_PTE_KERNEL(&tempPte, sysPte, MM_READWRITE, CurrentProcess->WorkingSetPage);
|
||||||
|
@ -1365,7 +1364,7 @@ MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
|
||||||
PFN_NUMBER PageFrameIndex;
|
PFN_NUMBER PageFrameIndex;
|
||||||
|
|
||||||
//ASSERT(Process->CommitCharge == 0);
|
//ASSERT(Process->CommitCharge == 0);
|
||||||
|
|
||||||
/* Acquire the PFN lock */
|
/* Acquire the PFN lock */
|
||||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
|
|
||||||
|
@ -1382,7 +1381,7 @@ MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
|
||||||
MiDecrementShareCount(Pfn1, Process->WorkingSetPage);
|
MiDecrementShareCount(Pfn1, Process->WorkingSetPage);
|
||||||
ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
|
ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
|
||||||
MiReleaseSystemPtes(MiAddressToPte(Process->Vm.VmWorkingSetList), 1, SystemPteSpace);
|
MiReleaseSystemPtes(MiAddressToPte(Process->Vm.VmWorkingSetList), 1, SystemPteSpace);
|
||||||
|
|
||||||
/* Now map hyperspace and its page table */
|
/* Now map hyperspace and its page table */
|
||||||
PageFrameIndex = Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT;
|
PageFrameIndex = Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT;
|
||||||
Pfn1 = MiGetPfnEntry(PageFrameIndex);
|
Pfn1 = MiGetPfnEntry(PageFrameIndex);
|
||||||
|
@ -1393,14 +1392,14 @@ MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
|
||||||
MiDecrementShareCount(Pfn2, Pfn1->u4.PteFrame);
|
MiDecrementShareCount(Pfn2, Pfn1->u4.PteFrame);
|
||||||
MiDecrementShareCount(Pfn1, PageFrameIndex);
|
MiDecrementShareCount(Pfn1, PageFrameIndex);
|
||||||
ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
|
ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
|
||||||
|
|
||||||
/* Finally, nuke the PDE itself */
|
/* Finally, nuke the PDE itself */
|
||||||
PageFrameIndex = Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT;
|
PageFrameIndex = Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT;
|
||||||
Pfn1 = MiGetPfnEntry(PageFrameIndex);
|
Pfn1 = MiGetPfnEntry(PageFrameIndex);
|
||||||
MI_SET_PFN_DELETED(Pfn1);
|
MI_SET_PFN_DELETED(Pfn1);
|
||||||
MiDecrementShareCount(Pfn1, PageFrameIndex);
|
MiDecrementShareCount(Pfn1, PageFrameIndex);
|
||||||
MiDecrementShareCount(Pfn1, PageFrameIndex);
|
MiDecrementShareCount(Pfn1, PageFrameIndex);
|
||||||
|
|
||||||
/* Page table is now dead. Bye bye... */
|
/* Page table is now dead. Bye bye... */
|
||||||
ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
|
ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
|
||||||
}
|
}
|
||||||
|
@ -1415,7 +1414,7 @@ MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
|
||||||
|
|
||||||
/* No support for sessions yet */
|
/* No support for sessions yet */
|
||||||
ASSERT(Process->Session == 0);
|
ASSERT(Process->Session == 0);
|
||||||
|
|
||||||
/* Clear out the PDE pages */
|
/* Clear out the PDE pages */
|
||||||
Process->Pcb.DirectoryTableBase[0] = 0;
|
Process->Pcb.DirectoryTableBase[0] = 0;
|
||||||
Process->Pcb.DirectoryTableBase[1] = 0;
|
Process->Pcb.DirectoryTableBase[1] = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue