[ros-diffs] [sir_richard] 49431: [NTOS]: Protect Arty's changes with #ifdef NEWCC, otherwise this code ASSERTs and crashes as soon as a pageout operation is required. Since your advanced test/regression system...

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Tue Nov 2 14:38:56 UTC 2010


Author: sir_richard
Date: Tue Nov  2 14:38:52 2010
New Revision: 49431

URL: http://svn.reactos.org/svn/reactos?rev=49431&view=rev
Log:
[NTOS]: Protect Arty's changes with #ifdef NEWCC, otherwise this code ASSERTs and crashes as soon as a pageout operation is required. Since your advanced test/regression systems boot into configurations with 1GB+ RAM, you never even test these paths and one could put an ASSERT(FALSE) and you wouldn't even notice it (as proven).

Modified:
    trunk/reactos/ntoskrnl/mm/rmap.c

Modified: trunk/reactos/ntoskrnl/mm/rmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/rmap.c?rev=49431&r1=49430&r2=49431&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] Tue Nov  2 14:38:52 2010
@@ -10,7 +10,9 @@
 /* INCLUDES *****************************************************************/
 
 #include <ntoskrnl.h>
+#ifdef NEWCC
 #include "../cache/section/newmm.h"
+#endif
 #define NDEBUG
 #include <debug.h>
 
@@ -56,8 +58,6 @@
    ULONG Offset;
    NTSTATUS Status = STATUS_SUCCESS;
 
-   ASSERT(FALSE);
-
    ExAcquireFastMutex(&RmapListLock);
    entry = MmGetRmapListHeadPage(Page);
    if (entry == NULL)
@@ -197,7 +197,9 @@
    }
    while (current_entry != NULL)
    {
+#ifdef NEWCC
 	  if (!RMAP_IS_SEGMENT(current_entry->Address))
+#endif
 		  MmSetCleanPage(current_entry->Process, current_entry->Address);
 	  current_entry = current_entry->Next;
    }
@@ -219,7 +221,9 @@
    }
    while (current_entry != NULL)
    {
+#ifdef NEWCC
 	  if (!RMAP_IS_SEGMENT(current_entry->Address))
+#endif
 		  MmSetDirtyPage(current_entry->Process, current_entry->Address);
       current_entry = current_entry->Next;
    }
@@ -241,7 +245,10 @@
    }
    while (current_entry != NULL)
    {
-	  if (!RMAP_IS_SEGMENT(current_entry->Address) && 
+	  if (
+#ifdef NEWCC
+	      !RMAP_IS_SEGMENT(current_entry->Address) && 
+#endif
 		  MmIsDirtyPage(current_entry->Process, current_entry->Address))
       {
          ExReleaseFastMutex(&RmapListLock);
@@ -261,8 +268,9 @@
    PMM_RMAP_ENTRY current_entry;
    PMM_RMAP_ENTRY new_entry;
    ULONG PrevSize;
-
+#ifdef NEWCC
    if (!RMAP_IS_SEGMENT(Address))
+#endif
 	   Address = (PVOID)PAGE_ROUND_DOWN(Address);
 
    new_entry = ExAllocateFromNPagedLookasideList(&RmapLookasideList);
@@ -280,7 +288,10 @@
 #endif
 #endif
 
-   if (!RMAP_IS_SEGMENT(Address) && 
+   if (
+#ifdef NEWCC
+       !RMAP_IS_SEGMENT(Address) && 
+#endif
 	   MmGetPfnForProcess(Process, Address) != Page)
    {
       DPRINT1("Insert rmap (%d, 0x%.8X) 0x%.8X which doesn't match physical "
@@ -311,8 +322,9 @@
 #endif
    MmSetRmapListHeadPage(Page, new_entry);
    ExReleaseFastMutex(&RmapListLock);
-   
+#ifdef NEWCC
    if (!RMAP_IS_SEGMENT(Address)) 
+#endif
    {
 	   if (Process == NULL)
 	   {
@@ -352,7 +364,9 @@
    {
       previous_entry = current_entry;
       current_entry = current_entry->Next;
+#ifdef NEWCC
 	  if (!RMAP_IS_SEGMENT(current_entry->Address)) 
+#endif
 	  {
 		  if (DeleteMapping)
 		  {
@@ -370,10 +384,12 @@
 			  (void)InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, -PAGE_SIZE);
 		  }
 	  } 
+#ifdef NEWCC
 	  else 
 	  {
 		  ExFreeToNPagedLookasideList(&RmapLookasideList, previous_entry);
 	  }
+#endif
    }
 }
 
@@ -403,7 +419,10 @@
          }
          ExReleaseFastMutex(&RmapListLock);
          ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
-		 if (!RMAP_IS_SEGMENT(Address)) {
+#ifdef NEWCC
+		 if (!RMAP_IS_SEGMENT(Address))
+#endif
+		 {
 			 if (Process == NULL)
 			 {
 				 Process = PsInitialSystemProcess;
@@ -421,6 +440,7 @@
    KeBugCheck(MEMORY_MANAGEMENT);
 }
 
+#ifdef NEWCC
 PVOID
 NTAPI
 MmGetSegmentRmap(PFN_NUMBER Page, PULONG RawOffset)
@@ -478,3 +498,4 @@
    }
    ExReleaseFastMutex(&RmapListLock);
 }
+#endif




More information about the Ros-diffs mailing list