mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 10:38:07 +00:00
aflpp libfuzzer driver for qemu mode
This commit is contained in:
21
examples/aflpp_driver/aflpp_qemu_driver_hook.c
Normal file
21
examples/aflpp_driver/aflpp_qemu_driver_hook.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define g2h(x) ((void *)((unsigned long)(x) + guest_base))
|
||||
|
||||
#define REGS_RDI 7
|
||||
#define REGS_RSI 6
|
||||
|
||||
void afl_persistent_hook(uint64_t *regs, uint64_t guest_base,
|
||||
uint8_t* input_buf, uint32_t input_len) {
|
||||
|
||||
memcpy(g2h(regs[REGS_RDI]), input_buf, input_len);
|
||||
regs[REGS_RSI] = input_len;
|
||||
|
||||
}
|
||||
|
||||
int afl_persistent_hook_init(void) {
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
Reference in New Issue
Block a user