From ab8fb271f71c50f46fac86fb7ac09593542726b3 Mon Sep 17 00:00:00 2001 From: hac425 Date: Sat, 9 Nov 2019 15:18:24 +0000 Subject: add support for android x86, x86-64 in qbdi mode --- qbdi_mode/template.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'qbdi_mode/template.cpp') diff --git a/qbdi_mode/template.cpp b/qbdi_mode/template.cpp index 6c118a12..85b46d2f 100755 --- a/qbdi_mode/template.cpp +++ b/qbdi_mode/template.cpp @@ -10,10 +10,17 @@ #include #include +#ifdef __ANDROID__ +#include "../include/android-ashmem.h" +#endif +#include #include #include "../config.h" + + + #include using namespace QBDI; @@ -49,7 +56,6 @@ int afl_setup(void) { /* Fork server logic, invoked once we hit _start. */ - static void afl_forkserver() { @@ -141,8 +147,14 @@ QBDI_NOINLINE int fuzz_func() static QBDI::VMAction bbcallback(QBDI::VMInstanceRef vm, const QBDI::VMState *state, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) { // errno = SAVED_ERRNO; +#ifdef __x86_64__ unsigned long pc = gprState->rip; - // printf("%p\n", pc); +#elif defined(i386) + unsigned long pc = gprState->eip; +#elif defined(__arm__) + unsigned long pc = gprState->pc; +#endif + if(pc >= module_base && pc <= module_end){ unsigned long offset = pc - module_base; printf("\toffset:%p\n", offset); -- cgit 1.4.1