diff --git a/ntoskrnl/mm/mmfault.c b/ntoskrnl/mm/mmfault.c index cfd6d756d15..5dbdc7a8ac2 100644 --- a/ntoskrnl/mm/mmfault.c +++ b/ntoskrnl/mm/mmfault.c @@ -22,7 +22,8 @@ NTSTATUS NTAPI MmpAccessFault(KPROCESSOR_MODE Mode, ULONG_PTR Address, - BOOLEAN FromMdl) + BOOLEAN FromMdl, + ULONG FaultCode) { PMMSUPPORT AddressSpace; MEMORY_AREA* MemoryArea; @@ -36,6 +37,14 @@ MmpAccessFault(KPROCESSOR_MODE Mode, return(STATUS_UNSUCCESSFUL); } + /* Instruction fetch and the page is present. + This means the page is NX and we cannot do anything to "fix" it. */ + if (MI_IS_INSTRUCTION_FETCH(FaultCode)) + { + DPRINT1("Page fault instruction fetch at %p\n", Address); + return STATUS_ACCESS_VIOLATION; + } + /* * Find the memory area for the faulting address */ @@ -285,7 +294,7 @@ Retry: if (!MI_IS_NOT_PRESENT_FAULT(FaultCode)) { /* Call access fault */ - Status = MmpAccessFault(Mode, (ULONG_PTR)Address, TrapInformation ? FALSE : TRUE); + Status = MmpAccessFault(Mode, (ULONG_PTR)Address, TrapInformation ? FALSE : TRUE, FaultCode); } else {