mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:03:00 +00:00
[NTOS:MM] Acquire PsLoadedModuleResource when walking PsLoadedModuleList. CORE-16449
This commit is contained in:
parent
a30edc324e
commit
ba9bf73d48
2 changed files with 7 additions and 3 deletions
|
@ -1466,13 +1466,14 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
||||||
/* Assume failure */
|
/* Assume failure */
|
||||||
*StartVa = NULL;
|
*StartVa = NULL;
|
||||||
|
|
||||||
/* Acquire the necessary lock while we loop the list */
|
/* Acquire the necessary locks while we loop the list */
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
KeWaitForSingleObject(&MmSystemLoadLock,
|
KeWaitForSingleObject(&MmSystemLoadLock,
|
||||||
WrVirtualMemory,
|
WrVirtualMemory,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
ExAcquireResourceExclusiveLite(&PsLoadedModuleResource, TRUE);
|
||||||
|
|
||||||
/* Loop all loaded modules */
|
/* Loop all loaded modules */
|
||||||
NextEntry = PsLoadedModuleList.Flink;
|
NextEntry = PsLoadedModuleList.Flink;
|
||||||
|
@ -1620,7 +1621,8 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the lock and return */
|
/* Release the locks and return */
|
||||||
|
ExReleaseResourceLite(&PsLoadedModuleResource);
|
||||||
KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE);
|
KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE);
|
||||||
KeLeaveCriticalRegion();
|
KeLeaveCriticalRegion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,8 @@ MmInitSystem(IN ULONG Phase,
|
||||||
/* Initialize the balance set manager */
|
/* Initialize the balance set manager */
|
||||||
MmInitBsmThread();
|
MmInitBsmThread();
|
||||||
|
|
||||||
/* Loop the boot loaded images */
|
/* Loop the boot loaded images (under lock) */
|
||||||
|
ExAcquireResourceExclusiveLite(&PsLoadedModuleResource, TRUE);
|
||||||
for (ListEntry = PsLoadedModuleList.Flink;
|
for (ListEntry = PsLoadedModuleList.Flink;
|
||||||
ListEntry != &PsLoadedModuleList;
|
ListEntry != &PsLoadedModuleList;
|
||||||
ListEntry = ListEntry->Flink)
|
ListEntry = ListEntry->Flink)
|
||||||
|
@ -284,6 +285,7 @@ MmInitSystem(IN ULONG Phase,
|
||||||
/* Set up the image protection */
|
/* Set up the image protection */
|
||||||
MiWriteProtectSystemImage(DataTableEntry->DllBase);
|
MiWriteProtectSystemImage(DataTableEntry->DllBase);
|
||||||
}
|
}
|
||||||
|
ExReleaseResourceLite(&PsLoadedModuleResource);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue