Fix NaCl regression caused by pepper revision 28.

Patch from bradchen@chromium.org.

Prevents use of PROT_EXEC for NaCl builds

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/19729003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15744 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2c7b8cf5
......@@ -43,7 +43,13 @@ namespace internal {
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);
}
......
......@@ -594,7 +594,13 @@ void OS::SignalCodeMovingGC() {
}
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 @@ void* VirtualMemory::ReserveRegion(size_t size) {
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,
......
......@@ -84,7 +84,13 @@ intptr_t OS::CommitPageSize() {
#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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment