https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8227c5d380fa1fbee6649…
commit 8227c5d380fa1fbee6649e4dbb686447ab8e7ff1
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Jan 1 18:11:26 2023 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Sep 26 18:04:19 2023 +0300
[NTOS] Implement support for opting out of NX policy
Fixes crash in ntdll_winetest info on x64.
---
ntoskrnl/mm/ARM3/pagfault.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c
index b9a855662d9..14460552b1c 100644
--- a/ntoskrnl/mm/ARM3/pagfault.c
+++ b/ntoskrnl/mm/ARM3/pagfault.c
@@ -2333,14 +2333,26 @@ UserFault:
}
}
+#if _MI_HAS_NO_EXECUTE
/* Check for execution of non-executable memory */
if (MI_IS_INSTRUCTION_FETCH(FaultCode) &&
!MI_IS_PAGE_EXECUTABLE(&TempPte))
{
+ /* Check if execute enable was set */
+ if (CurrentProcess->Pcb.Flags.ExecuteEnable)
+ {
+ /* Fix up the PTE to be executable */
+ TempPte.u.Hard.NoExecute = 0;
+ MI_UPDATE_VALID_PTE(PointerPte, TempPte);
+ MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
+ return STATUS_SUCCESS;
+ }
+
/* Return the status */
MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
return STATUS_ACCESS_VIOLATION;
}
+#endif
/* The fault has already been resolved by a different thread */
MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);