summaryrefslogtreecommitdiff
path: root/js/src/jit/ProcessExecutableMemory.h
diff options
context:
space:
mode:
authorJan de Mooij <jdemooij@mozilla.com>2018-04-10 15:00:49 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-04-19 12:01:40 +0200
commit9472136272f01b858412f2d9d7854d2daa82496f (patch)
tree3d446907848b183c3c49773ad0e976824c06d4b7 /js/src/jit/ProcessExecutableMemory.h
parentf243b7b4af1242c2b80726e462bac045d70c37f0 (diff)
downloaduxp-9472136272f01b858412f2d9d7854d2daa82496f.tar.gz
Bug 1444668 - Avoid allocating large AssemblerBuffers. r=luke, r=bbouvier, a=RyanVM
Diffstat (limited to 'js/src/jit/ProcessExecutableMemory.h')
-rw-r--r--js/src/jit/ProcessExecutableMemory.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/src/jit/ProcessExecutableMemory.h b/js/src/jit/ProcessExecutableMemory.h
index 078ce7cb75..a0e2fab985 100644
--- a/js/src/jit/ProcessExecutableMemory.h
+++ b/js/src/jit/ProcessExecutableMemory.h
@@ -17,6 +17,14 @@ namespace jit {
// alignment though.
static const size_t ExecutableCodePageSize = 64 * 1024;
+// Limit on the number of bytes of executable memory to prevent JIT spraying
+// attacks.
+#if JS_BITS_PER_WORD == 32
+static const size_t MaxCodeBytesPerProcess = 128 * 1024 * 1024;
+#else
+static const size_t MaxCodeBytesPerProcess = 1 * 1024 * 1024 * 1024;
+#endif
+
enum class ProtectionSetting {
Protected, // Not readable, writable, or executable.
Writable,