From f4389677838c6ba997bd14f8ff1a40c36007be0f Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Thu, 26 May 2022 23:57:34 +0200 Subject: [PATCH] extend libafl_exec_jmp_hook --- accel/tcg/translate-all.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 27da5c1245..0e9278301b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -81,7 +81,7 @@ void libafl_gen_cmp(target_ulong pc, TCGv op0, TCGv op1, MemOp ot); void (*libafl_exec_edge_hook)(uint64_t id); uint64_t (*libafl_gen_edge_hook)(uint64_t src, uint64_t dst); -void (*libafl_exec_jmp_hook)(uint64_t src, uint64_t dst); +void (*libafl_exec_jmp_hook)(uint64_t src, uint64_t dst, uint64_t id); uint64_t (*libafl_gen_jmp_hook)(uint64_t src, uint64_t dst); static TCGHelperInfo libafl_exec_edge_hook_info = { @@ -94,7 +94,7 @@ static int exec_edge_hook_added = 0; static TCGHelperInfo libafl_exec_jmp_hook_info = { .func = NULL, .name = "libafl_exec_jmp_hook", \ .flags = dh_callflag(void), \ - .typemask = dh_typemask(void, 0) | dh_typemask(i64, 2) + .typemask = dh_typemask(void, 0) | dh_typemask(i64, 3) }; static int exec_jmp_hook_added = 0; @@ -1810,8 +1810,9 @@ void libafl_gen_jmp(target_ulong src, target_ulong dst) } TCGv_i64 tmp0 = tcg_const_i64(src); TCGv_i64 tmp1 = tcg_const_i64(dst); - TCGTemp *tmp2[2] = { tcgv_i64_temp(tmp0), tcgv_i64_temp(tmp1) }; - tcg_gen_callN(libafl_exec_jmp_hook, NULL, 2, tmp2); + TCGv_i64 tmp2 = tcg_const_i64(libafl_id); + TCGTemp *tmp3[3] = { tcgv_i64_temp(tmp0), tcgv_i64_temp(tmp1), tcgv_i64_temp(tmp2) }; + tcg_gen_callN(libafl_exec_jmp_hook, NULL, 3, tmp3); tcg_temp_free_i64(tmp0); }