From f2bf75cfd3ce105735b802458978779c887d1885 Mon Sep 17 00:00:00 2001 From: Ajax Date: Tue, 17 Nov 2015 10:08:58 +0100 Subject: Symbexec: fix parallelism with memory accesses --- miasm2/ir/symbexec.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'miasm2/ir') diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py index f51baf9f..162f566c 100644 --- a/miasm2/ir/symbexec.py +++ b/miasm2/ir/symbexec.py @@ -384,10 +384,7 @@ class symbexec(object): # test if mem lookup is known tmp = m2_expr.ExprMem(a, e.dst.size) dst = tmp - if self.func_write and isinstance(dst.arg, m2_expr.ExprInt): - self.func_write(self, dst, src, pool_out) - else: - pool_out[dst] = src + pool_out[dst] = src elif isinstance(e.dst, m2_expr.ExprId): pool_out[e.dst] = src @@ -398,7 +395,6 @@ class symbexec(object): def eval_ir(self, ir): mem_dst = [] - # src_dst = [(x.src, x.dst) for x in ir] src_dst = self.eval_ir_expr(ir) eval_cache = dict(self.symbols.items()) for dst, src in src_dst: @@ -411,10 +407,11 @@ class symbexec(object): new_val.is_term = True self.symbols[new_mem] = new_val src_o = self.expr_simp(src) - # print 'SRCo', src_o - # src_o.is_term = True self.symbols[dst] = src_o if isinstance(dst, m2_expr.ExprMem): + if self.func_write and isinstance(dst.arg, m2_expr.ExprInt): + self.func_write(self, dst, src_o, {}) + del self.symbols[dst] mem_dst.append(dst) return mem_dst -- cgit 1.4.1 From b56bafa0e4723ad42eecbdc7d26e17fdec5d9041 Mon Sep 17 00:00:00 2001 From: Ajax Date: Tue, 17 Nov 2015 10:13:09 +0100 Subject: Symbexec: func_write callback doesn't need anymore last arg It was used as a destination cache --- miasm2/ir/symbexec.py | 2 +- miasm2/jitter/jitcore_python.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'miasm2/ir') diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py index 162f566c..9ac79b1f 100644 --- a/miasm2/ir/symbexec.py +++ b/miasm2/ir/symbexec.py @@ -410,7 +410,7 @@ class symbexec(object): self.symbols[dst] = src_o if isinstance(dst, m2_expr.ExprMem): if self.func_write and isinstance(dst.arg, m2_expr.ExprInt): - self.func_write(self, dst, src_o, {}) + self.func_write(self, dst, src_o) del self.symbols[dst] mem_dst.append(dst) return mem_dst diff --git a/miasm2/jitter/jitcore_python.py b/miasm2/jitter/jitcore_python.py index 96db3a2b..187647b3 100644 --- a/miasm2/jitter/jitcore_python.py +++ b/miasm2/jitter/jitcore_python.py @@ -76,12 +76,11 @@ class JitCore_Python(jitcore.JitCore): return m2_expr.ExprInt(int(value[::-1].encode("hex"), 16), expr_mem.size) - def func_write(self, symb_exec, dest, data, mem_cache): + def func_write(self, symb_exec, dest, data): """Memory read wrapper for symbolic execution @symb_exec: symbexec instance @dest: ExprMem instance - @data: Expr instance - @mem_cache: dict""" + @data: Expr instance""" # Get the content to write data = expr_simp(data) -- cgit 1.4.1