https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c0590f5de0fd4747fbe78…
commit c0590f5de0fd4747fbe78bbfea21d9972daeacf7
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Sep 23 21:26:37 2024 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Oct 10 17:37:56 2024 +0300
[NTOS:MM] Fix PTE protection for executable CoW pages
Fixes Blender x64.
See
https://jira.reactos.org/browse/CORE-19761
---
ntoskrnl/mm/section.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 1949d026149..f935e6f30c1 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -1509,7 +1509,12 @@ MmAlterViewAttributes(PMMSUPPORT AddressSpace,
*/
Page = MmGetPfnForProcess(Process, Address);
- Protect = PAGE_READONLY;
+ /* Choose protection based on what was requested */
+ if (NewProtect == PAGE_EXECUTE_READWRITE)
+ Protect = PAGE_EXECUTE_READ;
+ else
+ Protect = PAGE_READONLY;
+
if (IS_SWAP_FROM_SSE(Entry) || PFN_FROM_SSE(Entry) != Page)
{
Protect = NewProtect;