Author: tfaber
Date: Wed Oct 22 13:13:31 2014
New Revision: 64887
URL:
http://svn.reactos.org/svn/reactos?rev=64887&view=rev
Log:
[NTOS:KE]
- Issue the appropriate bug check codes when faulting in special pool
CORE-8680
Modified:
trunk/reactos/include/reactos/mc/bugcodes.mc
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/ke/bug.c
trunk/reactos/ntoskrnl/mm/ARM3/special.c
Modified: trunk/reactos/include/reactos/mc/bugcodes.mc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/mc/bugcode…
==============================================================================
--- trunk/reactos/include/reactos/mc/bugcodes.mc [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/mc/bugcodes.mc [iso-8859-1] Wed Oct 22 13:13:31 2014
@@ -1374,6 +1374,22 @@
DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS
.
+MessageId=0xCC
+Severity=Success
+Facility=System
+SymbolicName=PAGE_FAULT_IN_FREED_SPECIAL_POOL
+Language=English
+PAGE_FAULT_IN_FREED_SPECIAL_POOL
+.
+
+MessageId=0xCD
+Severity=Success
+Facility=System
+SymbolicName=PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+Language=English
+PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+.
+
MessageId=0xCE
Severity=Success
Facility=System
@@ -1404,6 +1420,22 @@
SymbolicName=DRIVER_PORTION_MUST_BE_NONPAGED
Language=English
The driver mistakenly marked a part of its image pageable instead of non-pageable.
+.
+
+MessageId=0xD5
+Severity=Success
+Facility=System
+SymbolicName=DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL
+Language=English
+DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL
+.
+
+MessageId=0xD6
+Severity=Success
+Facility=System
+SymbolicName=DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+Language=English
+DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION
.
MessageId=0xD7
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Wed Oct 22 13:13:31 2014
@@ -732,6 +732,11 @@
MmIsSpecialPoolAddress(
IN PVOID P);
+BOOLEAN
+NTAPI
+MmIsSpecialPoolAddressFree(
+ IN PVOID P);
+
PVOID
NTAPI
MmAllocateSpecialPool(
Modified: trunk/reactos/ntoskrnl/ke/bug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=6488…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] Wed Oct 22 13:13:31 2014
@@ -975,15 +975,31 @@
FALSE,
&IsSystem);
}
-
- /*
- * Now we should check if this happened in:
- * 1) Special Pool 2) Free Special Pool 3) Session Pool
- * and update the bugcheck code appropriately.
- */
-
- /* Check if we didn't have a driver base */
- if (!DriverBase)
+ else
+ {
+ /* Can't blame a driver, assume system */
+ IsSystem = TRUE;
+ }
+
+ /* FIXME: Check for session pool in addition to special pool */
+
+ /* Special pool has its own bug check codes */
+ if (MmIsSpecialPoolAddress((PVOID)BugCheckParameter1))
+ {
+ if (MmIsSpecialPoolAddressFree((PVOID)BugCheckParameter1))
+ {
+ KiBugCheckData[0] = IsSystem
+ ? PAGE_FAULT_IN_FREED_SPECIAL_POOL
+ : DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL;
+ }
+ else
+ {
+ KiBugCheckData[0] = IsSystem
+ ? PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+ : DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION;
+ }
+ }
+ else if (!DriverBase)
{
/* Find the driver that unloaded at this address */
KiBugCheckDriver = NULL; // FIXME: ROS can't locate
Modified: trunk/reactos/ntoskrnl/mm/ARM3/special.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/special.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/special.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/special.c [iso-8859-1] Wed Oct 22 13:13:31 2014
@@ -85,6 +85,26 @@
(P <= MmSpecialPoolEnd));
}
+BOOLEAN
+NTAPI
+MmIsSpecialPoolAddressFree(PVOID P)
+{
+ PMMPTE PointerPte;
+
+ ASSERT(MmIsSpecialPoolAddress(P));
+ PointerPte = MiAddressToPte(P);
+
+ if (PointerPte->u.Soft.PageFileHigh == SPECIAL_POOL_PAGED_PTE ||
+ PointerPte->u.Soft.PageFileHigh == SPECIAL_POOL_NONPAGED_PTE)
+ {
+ /* Guard page PTE */
+ return FALSE;
+ }
+
+ /* Free PTE */
+ return TRUE;
+}
+
VOID
NTAPI
MiInitializeSpecialPool(VOID)