mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[NTOS:MM]
- Use MmExpansionLock to synchronize changes to MmProcessList. Should fix random crashes in MmDeleteProcessAddressSpace. CORE-10111 #resolve svn path=/trunk/; revision=69031
This commit is contained in:
parent
007c3df2e3
commit
57bd950d25
4 changed files with 30 additions and 23 deletions
|
@ -634,6 +634,8 @@ extern SIZE_T MmSystemLockPagesCount;
|
|||
extern ULONG_PTR MmSubsectionBase;
|
||||
extern LARGE_INTEGER MmCriticalSectionTimeout;
|
||||
extern LIST_ENTRY MmWorkingSetExpansionHead;
|
||||
extern KSPIN_LOCK MmExpansionLock;
|
||||
extern PETHREAD MiExpansionLockOwner;
|
||||
|
||||
FORCEINLINE
|
||||
BOOLEAN
|
||||
|
@ -1330,6 +1332,29 @@ MiLockProcessWorkingSetForFault(IN PEPROCESS Process,
|
|||
}
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
KIRQL
|
||||
MiAcquireExpansionLock(VOID)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
|
||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||
KeAcquireSpinLock(&MmExpansionLock, &OldIrql);
|
||||
ASSERT(MiExpansionLockOwner == NULL);
|
||||
MiExpansionLockOwner = PsGetCurrentThread();
|
||||
return OldIrql;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
MiReleaseExpansionLock(KIRQL OldIrql)
|
||||
{
|
||||
ASSERT(MiExpansionLockOwner == PsGetCurrentThread());
|
||||
MiExpansionLockOwner = NULL;
|
||||
KeReleaseSpinLock(&MmExpansionLock, OldIrql);
|
||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||
}
|
||||
|
||||
//
|
||||
// Returns the ProtoPTE inside a VAD for the given VPN
|
||||
//
|
||||
|
|
|
@ -1178,7 +1178,9 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
|
|||
Pfn1->PteAddress = (PMMPTE)PDE_BASE;
|
||||
|
||||
/* Insert us into the Mm process list */
|
||||
OldIrql = MiAcquireExpansionLock();
|
||||
InsertTailList(&MmProcessList, &Process->MmProcessLinks);
|
||||
MiReleaseExpansionLock(OldIrql);
|
||||
|
||||
/* Get a PTE to map the page directory */
|
||||
PointerPte = MiReserveSystemPtes(1, SystemPteSpace);
|
||||
|
|
|
@ -35,29 +35,6 @@ PETHREAD MiExpansionLockOwner;
|
|||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
FORCEINLINE
|
||||
KIRQL
|
||||
MiAcquireExpansionLock(VOID)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
|
||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||
KeAcquireSpinLock(&MmExpansionLock, &OldIrql);
|
||||
ASSERT(MiExpansionLockOwner == NULL);
|
||||
MiExpansionLockOwner = PsGetCurrentThread();
|
||||
return OldIrql;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
MiReleaseExpansionLock(KIRQL OldIrql)
|
||||
{
|
||||
ASSERT(MiExpansionLockOwner == PsGetCurrentThread());
|
||||
MiExpansionLockOwner = NULL;
|
||||
KeReleaseSpinLock(&MmExpansionLock, OldIrql);
|
||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MiInitializeSessionWsSupport(VOID)
|
||||
|
|
|
@ -575,13 +575,16 @@ NTSTATUS
|
|||
NTAPI
|
||||
MmDeleteProcessAddressSpace(PEPROCESS Process)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PVOID Address;
|
||||
|
||||
DPRINT("MmDeleteProcessAddressSpace(Process %p (%s))\n", Process,
|
||||
Process->ImageFileName);
|
||||
|
||||
#ifndef _M_AMD64
|
||||
OldIrql = MiAcquireExpansionLock();
|
||||
RemoveEntryList(&Process->MmProcessLinks);
|
||||
MiReleaseExpansionLock(OldIrql);
|
||||
#endif
|
||||
MmLockAddressSpace(&Process->Vm);
|
||||
|
||||
|
|
Loading…
Reference in a new issue