зеркало из https://github.com/mozilla/gecko-dev.git
Bug 998997 - Use PROT_NONE on POSIX and PAGE_NOACCESS on Windows when protecting JIT code. (r=luke)
This commit is contained in:
Родитель
00f0b8ed2f
Коммит
37a4de0a84
|
@ -99,9 +99,10 @@ ExecutablePool::toggleAllCodeAsAccessible(bool accessible)
|
|||
size_t size = m_freePtr - begin;
|
||||
|
||||
if (size) {
|
||||
int flags = accessible
|
||||
? PROT_READ | PROT_WRITE | PROT_EXEC
|
||||
: PROT_READ | PROT_WRITE;
|
||||
// N.B. Some systems, like 32bit Mac OS 10.6, implicitly add PROT_EXEC
|
||||
// when mprotect'ing memory with any flag other than PROT_NONE. Be
|
||||
// sure to use PROT_NONE when making inaccessible.
|
||||
int flags = accessible ? PROT_READ | PROT_WRITE | PROT_EXEC : PROT_NONE;
|
||||
if (mprotect(begin, size, flags))
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
|
|
@ -116,8 +116,10 @@ ExecutablePool::toggleAllCodeAsAccessible(bool accessible)
|
|||
size_t size = m_freePtr - begin;
|
||||
|
||||
if (size) {
|
||||
// N.B. DEP is not on automatically in Windows XP, so be sure to use
|
||||
// PAGE_NOACCESS instead of PAGE_READWRITE when making inaccessible.
|
||||
DWORD oldProtect;
|
||||
int flags = accessible ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
|
||||
int flags = accessible ? PAGE_EXECUTE_READWRITE : PAGE_NOACCESS;
|
||||
if (!VirtualProtect(begin, size, flags, &oldProtect))
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// |jit-test| exitstatus: 6;
|
||||
|
||||
timeout(1);
|
||||
for(;;);
|
Загрузка…
Ссылка в новой задаче