Revision: 15744
Author:   [email protected]
Date:     Thu Jul 18 05:18:35 2013
Log:      Fix NaCl regression caused by pepper revision 28.

Patch from [email protected].

Prevents use of PROT_EXEC for NaCl builds

[email protected]

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

Modified:
 /branches/bleeding_edge/src/deoptimizer.cc
 /branches/bleeding_edge/src/platform-linux.cc
 /branches/bleeding_edge/src/platform-posix.cc

=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Fri Jul 12 00:26:00 2013
+++ /branches/bleeding_edge/src/deoptimizer.cc  Thu Jul 18 05:18:35 2013
@@ -43,7 +43,13 @@
 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) {
   return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(),
                                   OS::CommitPageSize(),
+#if defined(__native_client__)
+  // The Native Client port of V8 uses an interpreter,
+  // so code pages don't need PROT_EXEC.
+                                  NOT_EXECUTABLE,
+#else
                                   EXECUTABLE,
+#endif
                                   NULL);
 }

=======================================
--- /branches/bleeding_edge/src/platform-linux.cc       Fri Jul 12 05:02:26 2013
+++ /branches/bleeding_edge/src/platform-linux.cc       Thu Jul 18 05:18:35 2013
@@ -594,7 +594,13 @@
   }
   void* addr = mmap(OS::GetRandomMmapAddr(),
                     size,
+#if defined(__native_client__)
+                    // The Native Client port of V8 uses an interpreter,
+                    // so code pages don't need PROT_EXEC.
+                    PROT_READ,
+#else
                     PROT_READ | PROT_EXEC,
+#endif
                     MAP_PRIVATE,
                     fileno(f),
                     0);
@@ -717,7 +723,13 @@


bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
+#if defined(__native_client__)
+  // The Native Client port of V8 uses an interpreter,
+  // so code pages don't need PROT_EXEC.
+  int prot = PROT_READ | PROT_WRITE;
+#else
   int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
+#endif
   if (MAP_FAILED == mmap(base,
                          size,
                          prot,
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc       Thu Jul 11 04:37:08 2013
+++ /branches/bleeding_edge/src/platform-posix.cc       Thu Jul 18 05:18:35 2013
@@ -84,7 +84,13 @@
 #ifndef __CYGWIN__
 // Get rid of writable permission on code allocations.
 void OS::ProtectCode(void* address, const size_t size) {
+#if defined(__native_client__)
+  // The Native Client port of V8 uses an interpreter, so
+  // code pages don't need PROT_EXEC.
+  mprotect(address, size, PROT_READ);
+#else
   mprotect(address, size, PROT_READ | PROT_EXEC);
+#endif
 }


--
--
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