From f67ab25a161731048c86e03f6beed7c01103c387 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Wed, 22 Oct 2014 12:29:31 +0000 Subject: [PATCH] [NTOS:MM] - Generate PAGE_FAULT_IN_NONPAGED_AREA bugcheck for PTEs that have their protection set to zero. This gives a more useful error description than the infamous 'TempPte.u.Long != 0' assertion*. CORE-8679 #resolve * and is also What Windows Does(TM) svn path=/trunk/; revision=64885 --- reactos/ntoskrnl/mm/ARM3/pagfault.c | 33 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pagfault.c b/reactos/ntoskrnl/mm/ARM3/pagfault.c index ffe6f6af81e..8b20e2fc403 100644 --- a/reactos/ntoskrnl/mm/ARM3/pagfault.c +++ b/reactos/ntoskrnl/mm/ARM3/pagfault.c @@ -935,15 +935,15 @@ MiResolveTransitionFault(IN PVOID FaultingAddress, /* See if we should wait before terminating the fault */ if (Pfn1->u3.e1.ReadInProgress == 1) { - DPRINT1("The page is currently being read!\n"); - ASSERT(Pfn1->u1.Event != NULL); - *InPageBlock = Pfn1->u1.Event; - if (PointerPte == Pfn1->PteAddress) - { - DPRINT1("And this if for this particular PTE.\n"); - /* The PTE will be made valid by the thread serving the fault */ - return STATUS_SUCCESS; // FIXME: Maybe something more descriptive - } + DPRINT1("The page is currently being read!\n"); + ASSERT(Pfn1->u1.Event != NULL); + *InPageBlock = Pfn1->u1.Event; + if (PointerPte == Pfn1->PteAddress) + { + DPRINT1("And this if for this particular PTE.\n"); + /* The PTE will be made valid by the thread serving the fault */ + return STATUS_SUCCESS; // FIXME: Maybe something more descriptive + } } /* Windows checks there's some free pages and this isn't an in-page error */ @@ -1424,8 +1424,8 @@ MiDispatchFault(IN BOOLEAN StoreInstruction, if (InPageBlock != NULL) { - /* The page is being paged in by another process */ - KeWaitForSingleObject(InPageBlock, WrPageIn, KernelMode, FALSE, NULL); + /* The page is being paged in by another process */ + KeWaitForSingleObject(InPageBlock, WrPageIn, KernelMode, FALSE, NULL); } ASSERT(OldIrql == KeGetCurrentIrql()); @@ -1833,6 +1833,17 @@ _WARN("Session space stuff is not implemented yet!") (ULONG_PTR)TrapInformation, 1); } + + /* Check for no protecton at all */ + if (TempPte.u.Soft.Protection == MM_ZERO_ACCESS) + { + /* Bugcheck the system! */ + KeBugCheckEx(PAGE_FAULT_IN_NONPAGED_AREA, + (ULONG_PTR)Address, + StoreInstruction, + (ULONG_PTR)TrapInformation, + 0); + } } /* Check for demand page */