mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-27 01:19:05 +00:00
js: Support for the MPROTECT security feature (PaX and NetBSD)
On such platforms, remapping memory that was once writable to executable is forbidden unless the initial mmap() is declared to change in such a way using the PROT_MPROTECT macro.
This commit is contained in:
@@ -644,7 +644,12 @@ WasmArrayRawBuffer::Allocate(uint32_t numBytes, Maybe<uint32_t> maxSize)
|
||||
return nullptr;
|
||||
}
|
||||
# else // XP_WIN
|
||||
void* data = MozTaggedAnonymousMmap(nullptr, (size_t) mappedSizeWithHeader, PROT_NONE,
|
||||
void* data = MozTaggedAnonymousMmap(nullptr, (size_t) mappedSizeWithHeader,
|
||||
#ifdef PROT_MPROTECT
|
||||
PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
|
||||
#else
|
||||
PROT_NONE,
|
||||
#endif
|
||||
MAP_PRIVATE | MAP_ANON, -1, 0, "wasm-reserved");
|
||||
if (data == MAP_FAILED)
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user