https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c6853581c5203a52cd882…
commit c6853581c5203a52cd8825428e56f2cfcfe4c9f5
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Wed Feb 26 10:33:32 2025 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Mar 4 15:24:53 2025 +0200
[NTOS:MM] Fix broken ASSERT
There is no guarantee that all pages in the requested range actually exist.
---
ntoskrnl/mm/freelist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ntoskrnl/mm/freelist.c b/ntoskrnl/mm/freelist.c
index 6f2f99bfc3c..0147fb09a90 100644
--- a/ntoskrnl/mm/freelist.c
+++ b/ntoskrnl/mm/freelist.c
@@ -318,7 +318,7 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress,
// Get the PFN entry for this page
//
Pfn1 = MiGetPfnEntry(Page);
- ASSERT(Pfn1);
+ if (!Pfn1) continue;
//
// Make sure it's free and if this is our first pass, zeroed
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7c23a2e38e9c49828364a…
commit 7c23a2e38e9c49828364a7b02c2116fd0964b94e
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Mar 3 20:29:36 2025 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Mar 3 20:30:54 2025 +0100
[NTOS:MM] Split MmVerifyImageIsOkForMpUse() into an auxiliary inlined helper.
This helper is used when an existing NtHeader is already available.
---
ntoskrnl/mm/ARM3/sysldr.c | 43 ++++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/sysldr.c b/ntoskrnl/mm/ARM3/sysldr.c
index 2cdfc365cc7..eb1544babbf 100644
--- a/ntoskrnl/mm/ARM3/sysldr.c
+++ b/ntoskrnl/mm/ARM3/sysldr.c
@@ -2716,30 +2716,39 @@ MiEnablePagingOfDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
if (PointerPte) MiSetPagingOfDriver(PointerPte, LastPte);
}
+FORCEINLINE
BOOLEAN
-NTAPI
-MmVerifyImageIsOkForMpUse(IN PVOID BaseAddress)
+MiVerifyImageIsOkForMpUse(
+ _In_ PIMAGE_NT_HEADERS NtHeaders)
{
- PIMAGE_NT_HEADERS NtHeader;
- PAGED_CODE();
-
- /* Get NT Headers */
- NtHeader = RtlImageNtHeader(BaseAddress);
- if (NtHeader)
+ /* Fail if we have 2+ CPUs, but the image is only safe for UP */
+ if ((KeNumberProcessors > 1) &&
+ (NtHeaders->FileHeader.Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY))
{
- /* Check if this image is only safe for UP while we have 2+ CPUs */
- if ((KeNumberProcessors > 1) &&
- (NtHeader->FileHeader.Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY))
- {
- /* Fail */
- return FALSE;
- }
+ return FALSE;
}
-
- /* Otherwise, it's safe */
+ /* Otherwise, it's safe to use */
return TRUE;
}
+// TODO: Use this function to verify that the loaded boot drivers
+// (in ExpLoadBootSymbols) are compatible with MP.
+BOOLEAN
+NTAPI
+MmVerifyImageIsOkForMpUse(
+ _In_ PVOID BaseAddress)
+{
+ PIMAGE_NT_HEADERS NtHeaders;
+ PAGED_CODE();
+
+ /* Get the NT headers. If none, suppose the image
+ * is safe to use, otherwise invoke the helper. */
+ NtHeaders = RtlImageNtHeader(BaseAddress);
+ if (!NtHeaders)
+ return TRUE;
+ return MiVerifyImageIsOkForMpUse(NtHeaders);
+}
+
NTSTATUS
NTAPI
MmCheckSystemImage(IN HANDLE ImageHandle,