summaryrefslogtreecommitdiff
path: root/yjit_asm.c
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-04-06 11:24:58 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:32 -0400
commit3d53ee17616d9c028d2b537989c4cd2e1d08261b (patch)
tree73e9f6bf35be0898b389c008d387cadb9fd3758c /yjit_asm.c
parent131fc9c074d464c6baa548ab89a1d1d1dcc5c571 (diff)
Fill uninitialized memory with int3
Diffstat (limited to 'yjit_asm.c')
-rw-r--r--yjit_asm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/yjit_asm.c b/yjit_asm.c
index fc8472f077..78c9255d65 100644
--- a/yjit_asm.c
+++ b/yjit_asm.c
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <stdarg.h>
#include <assert.h>
@@ -154,6 +155,10 @@ uint8_t* alloc_exec_mem(uint32_t mem_size)
exit(-1);
}
+ // Fill the executable memory with 0x13 so that
+ // executing uninitialized memory will fault
+ memset(mem_block, 0xCC, mem_size);
+
return mem_block;
#else
return NULL;