From ac45b13b29cf2fb2ee4f848b4f3272620a2a2336 Mon Sep 17 00:00:00 2001 From: Romain Malmain Date: Wed, 10 Apr 2024 16:09:02 +0200 Subject: [PATCH] Change parameter order in backdoor --- accel/tcg/translator.c | 4 ++-- libafl_extras/hook.c | 2 +- libafl_extras/hook.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 272e4467f4..b75530da13 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -219,9 +219,9 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (backdoor == 0x44) { struct libafl_backdoor_hook* bhk = libafl_backdoor_hooks; while (bhk) { - TCGv_i64 tmp1 = tcg_constant_i64(bhk->data); + TCGv_i64 tmp0 = tcg_constant_i64(bhk->data); TCGv tmp2 = tcg_constant_tl(db->pc_next); - TCGTemp *args[3] = { tcgv_ptr_temp(tcg_env), tcgv_i64_temp(tmp1), tcgv_tl_temp(tmp2) }; + TCGTemp *args[3] = { tcgv_i64_temp(tmp0), tcgv_ptr_temp(tcg_env), tcgv_tl_temp(tmp2) }; tcg_gen_callN(&bhk->helper_info, NULL, args); diff --git a/libafl_extras/hook.c b/libafl_extras/hook.c index 2e0edbd72b..25809cfc0c 100644 --- a/libafl_extras/hook.c +++ b/libafl_extras/hook.c @@ -169,7 +169,7 @@ static TCGHelperInfo libafl_exec_backdoor_hook_info = { struct libafl_backdoor_hook* libafl_backdoor_hooks; size_t libafl_backdoor_hooks_num = 0; -size_t libafl_add_backdoor_hook(void (*exec)(CPUArchState* cpu, uint64_t data, target_ulong pc), +size_t libafl_add_backdoor_hook(void (*exec)(uint64_t data, CPUArchState* cpu, target_ulong pc), uint64_t data) { struct libafl_backdoor_hook* hook = calloc(sizeof(struct libafl_backdoor_hook), 1); diff --git a/libafl_extras/hook.h b/libafl_extras/hook.h index fa2c5cd075..24bb663c8b 100644 --- a/libafl_extras/hook.h +++ b/libafl_extras/hook.h @@ -41,7 +41,7 @@ int libafl_qemu_remove_hook(size_t num, int invalidate); struct libafl_hook* libafl_search_hook(target_ulong addr); struct libafl_backdoor_hook { - void (*exec)(CPUArchState* cpu, uint64_t data, target_ulong pc); + void (*exec)(uint64_t data, CPUArchState* cpu, target_ulong pc); uint64_t data; size_t num; TCGHelperInfo helper_info; @@ -50,7 +50,7 @@ struct libafl_backdoor_hook { extern struct libafl_backdoor_hook* libafl_backdoor_hooks; -size_t libafl_add_backdoor_hook(void (*exec)(CPUArchState* cpu, uint64_t data, target_ulong pc), +size_t libafl_add_backdoor_hook(void (*exec)(uint64_t data, CPUArchState* cpu, target_ulong pc), uint64_t data); int libafl_qemu_remove_backdoor_hook(size_t num, int invalidate);