diff options
author | hexcoder <hexcoder-@users.noreply.github.com> | 2021-05-31 19:18:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 19:18:24 +0200 |
commit | 97a1f89881878db9bd6b4cd666b3447a63818dcf (patch) | |
tree | 46e844356f7cf88c08f9f9907caa11656a24f416 /utils/qemu_persistent_hook | |
parent | b246de789105750558f3d6f884ba61e54cb98441 (diff) | |
parent | 1a2da67ed0505c9ac0aa1048ba3d607f3c1aa639 (diff) | |
download | afl++-97a1f89881878db9bd6b4cd666b3447a63818dcf.tar.gz |
Merge branch 'dev' into going_atomic
Diffstat (limited to 'utils/qemu_persistent_hook')
-rw-r--r-- | utils/qemu_persistent_hook/read_into_rdi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/qemu_persistent_hook/read_into_rdi.c b/utils/qemu_persistent_hook/read_into_rdi.c index c1c6642f..14b2ed85 100644 --- a/utils/qemu_persistent_hook/read_into_rdi.c +++ b/utils/qemu_persistent_hook/read_into_rdi.c @@ -3,12 +3,12 @@ #include <stdio.h> #include <string.h> -void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base, - uint8_t *input_buf, uint32_t input_buf_len) { - #define g2h(x) ((void *)((unsigned long)(x) + guest_base)) #define h2g(x) ((uint64_t)(x)-guest_base) +void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base, + uint8_t *input_buf, uint32_t input_buf_len) { + // In this example the register RDI is pointing to the memory location // of the target buffer, and the length of the input is in RSI. // This can be seen with a debugger, e.g. gdb (and "disass main") @@ -19,11 +19,11 @@ void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base, memcpy(g2h(regs->rdi), input_buf, input_buf_len); regs->rsi = input_buf_len; +} + #undef g2h #undef h2g -} - int afl_persistent_hook_init(void) { // 1 for shared memory input (faster), 0 for normal input (you have to use |