Revision: 16604
Author:   [email protected]
Date:     Tue Sep 10 05:54:15 2013 UTC
Log:      Use PAGE_NOACCESS for guard pages in Windows.

Up until now we used PAGE_GUARD for guard pages in Windows, which
will raise a STATUS_GUARD_PAGE_VIOLATION exception on first access
and grant regular access afterwards. This behavior is required to
implement automatic stack checking, or more generally to implement
applications that monitor the growth of large dynamic data structures.

However, this is not what we want for our guard pages, which are
used as a security mechanism. What we really want is PAGE_NOACCESS
here, which is the Windows-equivalent of PROT_NONE that we use on
all other platforms.

[email protected]

Review URL: https://codereview.chromium.org/23458022
http://code.google.com/p/v8/source/detail?r=16604

Modified:
 /branches/bleeding_edge/src/platform-cygwin.cc
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform-win32.cc

=======================================
--- /branches/bleeding_edge/src/platform-cygwin.cc Thu Sep 5 08:17:57 2013 UTC +++ /branches/bleeding_edge/src/platform-cygwin.cc Tue Sep 10 05:54:15 2013 UTC
@@ -344,7 +344,7 @@
   if (NULL == VirtualAlloc(address,
                            OS::CommitPageSize(),
                            MEM_COMMIT,
-                           PAGE_READONLY | PAGE_GUARD)) {
+                           PAGE_NOACCESS)) {
     return false;
   }
   return true;
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc Wed Sep 4 10:41:51 2013 UTC +++ /branches/bleeding_edge/src/platform-posix.cc Tue Sep 10 05:54:15 2013 UTC
@@ -152,7 +152,7 @@
 void OS::Guard(void* address, const size_t size) {
 #if defined(__CYGWIN__)
   DWORD oldprotect;
-  VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect);
+  VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect);
 #else
   mprotect(address, size, PROT_NONE);
 #endif
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Thu Sep 5 08:17:57 2013 UTC +++ /branches/bleeding_edge/src/platform-win32.cc Tue Sep 10 05:54:15 2013 UTC
@@ -865,7 +865,7 @@

 void OS::Guard(void* address, const size_t size) {
   DWORD oldprotect;
-  VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect);
+  VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect);
 }


@@ -1441,7 +1441,7 @@
   if (NULL == VirtualAlloc(address,
                            OS::CommitPageSize(),
                            MEM_COMMIT,
-                           PAGE_READONLY | PAGE_GUARD)) {
+                           PAGE_NOACCESS)) {
     return false;
   }
   return true;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to