aboutsummaryrefslogtreecommitdiff
path: root/examples/afl_untracer
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-15 08:36:51 +0200
committerGitHub <noreply@github.com>2020-05-15 08:36:51 +0200
commit87a693d1a956fd0fcb0ebbdecff24053b69e8560 (patch)
tree34578ae146ad79b7748363f23fe022a8e6c1a76d /examples/afl_untracer
parent1317433a51a7f7336c82c80a592835ddda9ef60f (diff)
parent49bd24144a881f4f55ef1a3db9a7f129a6670488 (diff)
downloadafl++-2.65c.tar.gz
Merge pull request #360 from AFLplusplus/dev2.65c
new code formatting + applied
Diffstat (limited to 'examples/afl_untracer')
-rw-r--r--examples/afl_untracer/afl-untracer.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/examples/afl_untracer/afl-untracer.c b/examples/afl_untracer/afl-untracer.c
index af16a6bf..664e691c 100644
--- a/examples/afl_untracer/afl-untracer.c
+++ b/examples/afl_untracer/afl-untracer.c
@@ -34,7 +34,7 @@
#define _GNU_SOURCE
#ifdef __ANDROID__
-#include "android-ashmem.h"
+ #include "android-ashmem.h"
#endif
#include "config.h"
#include "types.h"
@@ -58,14 +58,14 @@
#include <sys/types.h>
#if defined(__linux__)
-#include <sys/ucontext.h>
+ #include <sys/ucontext.h>
#elif defined(__APPLE__) && defined(__LP64__)
-#include <mach-o/dyld_images.h>
+ #include <mach-o/dyld_images.h>
#elif defined(__FreeBSD__)
-#include <sys/sysctl.h>
-#include <sys/user.h>
+ #include <sys/sysctl.h>
+ #include <sys/user.h>
#else
-#error "Unsupported platform"
+ #error "Unsupported platform"
#endif
#define MEMORY_MAP_DECREMENT 0x200000000000
@@ -446,15 +446,15 @@ static void __afl_end_testcase(int status) {
}
#ifdef __aarch64__
-#define SHADOW(addr) \
- ((uint64_t *)(((uintptr_t)addr & 0xfffffffffffffff8) - \
- MEMORY_MAP_DECREMENT - \
- ((uintptr_t)addr & 0x7) * 0x10000000000))
+ #define SHADOW(addr) \
+ ((uint64_t *)(((uintptr_t)addr & 0xfffffffffffffff8) - \
+ MEMORY_MAP_DECREMENT - \
+ ((uintptr_t)addr & 0x7) * 0x10000000000))
#else
-#define SHADOW(addr) \
- ((uint32_t *)(((uintptr_t)addr & 0xfffffffffffffffc) - \
- MEMORY_MAP_DECREMENT - \
- ((uintptr_t)addr & 0x3) * 0x10000000000))
+ #define SHADOW(addr) \
+ ((uint32_t *)(((uintptr_t)addr & 0xfffffffffffffffc) - \
+ MEMORY_MAP_DECREMENT - \
+ ((uintptr_t)addr & 0x3) * 0x10000000000))
#endif
void setup_trap_instrumentation() {
@@ -583,7 +583,7 @@ void setup_trap_instrumentation() {
#else
// this will be ARM and AARCH64
// for ARM we will need to identify if the code is in thumb or ARM
-#error "non x86_64/aarch64 not supported yet"
+ #error "non x86_64/aarch64 not supported yet"
//__arm__:
// linux thumb: 0xde01
// linux arm: 0xe7f001f0
@@ -622,20 +622,20 @@ static void sigtrap_handler(int signum, siginfo_t *si, void *context) {
ctx->uc_mcontext->__ss.__rip -= 1;
addr = ctx->uc_mcontext->__ss.__rip;
#elif defined(__linux__)
-#if defined(__x86_64__) || defined(__i386__)
+ #if defined(__x86_64__) || defined(__i386__)
ctx->uc_mcontext.gregs[REG_RIP] -= 1;
addr = ctx->uc_mcontext.gregs[REG_RIP];
-#elif defined(__aarch64__)
+ #elif defined(__aarch64__)
ctx->uc_mcontext.pc -= 4;
addr = ctx->uc_mcontext.pc;
-#else
-#error "Unsupported processor"
-#endif
+ #else
+ #error "Unsupported processor"
+ #endif
#elif defined(__FreeBSD__) && defined(__LP64__)
ctx->uc_mcontext.mc_rip -= 1;
addr = ctx->uc_mcontext.mc_rip;
#else
-#error "Unsupported platform"
+ #error "Unsupported platform"
#endif
// fprintf(stderr, "TRAP at context addr = %lx, fault addr = %lx\n", addr,