aboutsummaryrefslogtreecommitdiff
path: root/qbdi_mode/template.cpp
diff options
context:
space:
mode:
authorhac425 <hac425xxx@gmail.com>2019-11-09 15:18:24 +0000
committerhac425 <hac425xxx@gmail.com>2019-11-09 15:18:24 +0000
commitab8fb271f71c50f46fac86fb7ac09593542726b3 (patch)
tree02b0cb63a388357b6ebde3dac92ce36ab7ec2aa7 /qbdi_mode/template.cpp
parent574de9ff4cb2fdf2c28c32a3c2d7c5c773adb6ab (diff)
downloadafl++-ab8fb271f71c50f46fac86fb7ac09593542726b3.tar.gz
add support for android x86, x86-64 in qbdi mode
Diffstat (limited to 'qbdi_mode/template.cpp')
-rwxr-xr-xqbdi_mode/template.cpp16
1 files changed, 14 insertions, 2 deletions
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 <fcntl.h>
#include <dlfcn.h>
+#ifdef __ANDROID__
+#include "../include/android-ashmem.h"
+#endif
+#include <sys/ipc.h>
#include <sys/shm.h>
#include "../config.h"
+
+
+
#include <QBDI.h>
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);