Skip to content

Commit

Permalink
[NTOS:MM] Fix PTE protection for executable CoW pages
Browse files Browse the repository at this point in the history
  • Loading branch information
tkreuzer committed Oct 10, 2024
1 parent 52265ae commit c0590f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ntoskrnl/mm/section.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c0590f5

Please sign in to comment.