mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 16:31:07 +08:00
[NTOS:MM] Acquire MmSystemLoadLock in MiFindInitializationCode. CORE-16449
We might otherwise free the INIT section for an image that's in the process of being loaded by Mm.
This commit is contained in:
@@ -1466,8 +1466,13 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
||||
/* Assume failure */
|
||||
*StartVa = NULL;
|
||||
|
||||
/* Enter a critical region while we loop the list */
|
||||
/* Acquire the necessary lock while we loop the list */
|
||||
KeEnterCriticalRegion();
|
||||
KeWaitForSingleObject(&MmSystemLoadLock,
|
||||
WrVirtualMemory,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
|
||||
/* Loop all loaded modules */
|
||||
NextEntry = PsLoadedModuleList.Flink;
|
||||
@@ -1615,7 +1620,8 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
||||
NextEntry = NextEntry->Flink;
|
||||
}
|
||||
|
||||
/* Leave the critical region and return */
|
||||
/* Release the lock and return */
|
||||
KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user