diff options
author | Yifan Lu | 2016-10-05 23:09:11 -0700 |
---|---|---|
committer | Yifan Lu | 2016-10-05 23:09:11 -0700 |
commit | 60aee49bc717e68b79e3102497cbb9435623fc7a (patch) | |
tree | 35dc88bc502cdb64acbfdf95454d94e0f3733cd7 /lib/hook-functions.c | |
parent | Changed malloc in substitute_hook_functions to alloca (diff) | |
download | substitute-60aee49bc717e68b79e3102497cbb9435623fc7a.tar.gz |
Support using a different VMA for the hook dest
Diffstat (limited to '')
-rw-r--r-- | lib/hook-functions.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/hook-functions.c b/lib/hook-functions.c index d7b925f..4fc61e0 100644 --- a/lib/hook-functions.c +++ b/lib/hook-functions.c @@ -182,7 +182,8 @@ int substitute_hook_functions(const struct substitute_function_hook *hooks, #endif hi->code = code; hi->arch_dis_ctx = arch; - uintptr_t pc_patch_start = (uintptr_t) code; + uintptr_t pc_patch_start = hook->func_addr ? + hook->func_addr : (uintptr_t) code; int patch_size; bool need_intro_trampoline; if ((ret = check_intro_trampoline(&trampoline_ptr, &trampoline_addr, |