Bug 1411170 - Asmjs cache memory need readable. r=luke
authoryuyin <yuyin-hf@loongson.cn>
Mon, 30 Oct 2017 19:34:00 -0400
changeset 389551 d99a96c8da9209124506be1760f7be6db23103bb
parent 389550 a137a0d96fb663b8f90af9f1ec985534c11d6e40
child 389552 fbf84e79c44c07102797f8f53694cb7481a982d6
push id96872
push userryanvm@gmail.com
push dateWed, 01 Nov 2017 12:42:05 +0000
treeherdermozilla-inbound@d99a96c8da92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1411170
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1411170 - Asmjs cache memory need readable. r=luke
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -7848,17 +7848,17 @@ ShellOpenAsmJSCacheEntryForWrite(HandleO
     if (!memory)
         return JS::AsmJSCache_InternalError;
     MOZ_ASSERT(*(uint32_t*)memory == 0);
 #else
     memory = mmap(nullptr, serializedSize, PROT_READ, MAP_SHARED, fd, 0);
     if (memory == MAP_FAILED)
         return JS::AsmJSCache_InternalError;
     MOZ_ASSERT(*(uint32_t*)memory == 0);
-    if (mprotect(memory, serializedSize, PROT_WRITE))
+    if (mprotect(memory, serializedSize, PROT_READ | PROT_WRITE))
         return JS::AsmJSCache_InternalError;
 #endif
 
     // The embedding added the cookie so strip it off of the buffer returned to
     // the JS engine. The asmJSCacheCookie will be written on close, below.
     *memoryOut = (uint8_t*)memory + sizeof(uint32_t);
     *handleOut = fd.forget();
     return JS::AsmJSCache_Success;