From 3d53ee17616d9c028d2b537989c4cd2e1d08261b Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Tue, 6 Apr 2021 11:24:58 -0400 Subject: [PATCH] Fill uninitialized memory with int3 --- yjit_asm.c | 5 +++++ 1 file changed, 5 insertions(+) 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 #include +#include #include #include @@ -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;