Author: tkreuzer
Date: Fri Jan 23 18:54:02 2009
New Revision: 39054
URL:
http://svn.reactos.org/svn/reactos?rev=39054&view=rev
Log:
Mm: Fix page protection flags checks.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/anonmem.c
trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Fri Jan 23 18:54:02 2009
@@ -139,6 +139,16 @@
PAGE_GUARD | \
PAGE_NOACCESS | \
PAGE_NOCACHE)
+
+#define PAGE_FLAGS_VALID_FOR_SECTION \
+ (PAGE_READONLY | \
+ PAGE_READWRITE | \
+ PAGE_WRITECOPY | \
+ PAGE_EXECUTE | \
+ PAGE_EXECUTE_READ | \
+ PAGE_EXECUTE_READWRITE | \
+ PAGE_EXECUTE_WRITECOPY | \
+ PAGE_NOACCESS)
#define PAGE_IS_READABLE \
(PAGE_READONLY | \
Modified: trunk/reactos/ntoskrnl/mm/anonmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/anonmem.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] Fri Jan 23 18:54:02 2009
@@ -569,7 +569,7 @@
Protect);
/* Check for valid protection flags */
- if (!(Protect & PAGE_FLAGS_VALID_FROM_USER_MODE))
+ if (!Protect || Protect & ~PAGE_FLAGS_VALID_FROM_USER_MODE)
{
DPRINT1("Invalid page protection\n");
return STATUS_INVALID_PAGE_PROTECTION;
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Fri Jan 23 18:54:02 2009
@@ -4538,10 +4538,7 @@
ASSERT(Process);
- if (!(Protect & (PAGE_READONLY | PAGE_READWRITE |
- PAGE_WRITECOPY | PAGE_EXECUTE |
- PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE |
- PAGE_EXECUTE_WRITECOPY | PAGE_NOACCESS)))
+ if (!Protect || Protect & ~PAGE_FLAGS_VALID_FOR_SECTION)
{
return STATUS_INVALID_PAGE_PROTECTION;
}