[前][次][番号順一覧][スレッド一覧]

ruby-changes:68892

From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:15:05 +0900 (JST)
Subject: [ruby-changes:68892] 3d53ee1761 (master): Fill uninitialized memory with int3

https://git.ruby-lang.org/ruby.git/commit/?id=3d53ee1761

From 3d53ee17616d9c028d2b537989c4cd2e1d08261b Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Tue, 6 Apr 2021 11:24:58 -0400
Subject: 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 @@ https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L3
 
 #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) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L155
         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;
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]