about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--libdislocator/libdislocator.so.c4
-rw-r--r--libtokencap/libtokencap.so.c13
-rw-r--r--llvm_mode/LLVMInsTrim.so.cc1
-rw-r--r--llvm_mode/afl-llvm-lto-instrim.so.cc2
-rw-r--r--llvm_mode/afl-llvm-lto-instrumentation.so.cc3
-rw-r--r--llvm_mode/afl-llvm-lto-whitelist.so.cc1
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc1
-rw-r--r--src/afl-performance.c3
-rwxr-xr-xtest/test.sh31
9 files changed, 33 insertions, 26 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c
index 063e3590..7a70fd15 100644
--- a/libdislocator/libdislocator.so.c
+++ b/libdislocator/libdislocator.so.c
@@ -40,8 +40,8 @@
 #if (defined(__linux__) && !defined(__ANDROID__)) || defined(__HAIKU__)
   #include <unistd.h>
   #ifdef __linux__
-   #include <sys/syscall.h>
-   #include <malloc.h>
+    #include <sys/syscall.h>
+    #include <malloc.h>
   #endif
   #ifdef __NR_getrandom
     #define arc4random_buf(p, l)                       \
diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c
index 88b5c041..600d2a5d 100644
--- a/libtokencap/libtokencap.so.c
+++ b/libtokencap/libtokencap.so.c
@@ -33,7 +33,7 @@
 #include "../types.h"
 #include "../config.h"
 
-#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \
+#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ &&      \
     !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__ && \
     !defined(__HAIKU__)
   #error "Sorry, this library is unsupported in this platform for now!"
@@ -233,18 +233,19 @@ static void __tokencap_load_mappings(void) {
   }
 
   munmap(buf, len);
-  #elif defined __HAIKU__
+#elif defined __HAIKU__
   image_info ii;
-  int32_t group = 0;
+  int32_t    group = 0;
 
   while (get_next_image_info(0, &group, &ii) == B_OK) {
 
-    __tokencap_ro[__tokencap_ro_cnt].st = ii.text; 
-    __tokencap_ro[__tokencap_ro_cnt].en = ((char *)ii.text) + ii.text_size; 
+    __tokencap_ro[__tokencap_ro_cnt].st = ii.text;
+    __tokencap_ro[__tokencap_ro_cnt].en = ((char *)ii.text) + ii.text_size;
 
-      if (++__tokencap_ro_cnt == MAX_MAPPINGS) break;
+    if (++__tokencap_ro_cnt == MAX_MAPPINGS) break;
 
   }
+
 #endif
 
 }
diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc
index ced1f383..991127a7 100644
--- a/llvm_mode/LLVMInsTrim.so.cc
+++ b/llvm_mode/LLVMInsTrim.so.cc
@@ -103,6 +103,7 @@ struct InsTrim : public ModulePass {
   bool runOnModule(Module &M) override {
 
     char be_quiet = 0;
+    setvbuf(stdout, NULL, _IONBF, 0);
 
     if ((isatty(2) && !getenv("AFL_QUIET")) || getenv("AFL_DEBUG") != NULL) {
 
diff --git a/llvm_mode/afl-llvm-lto-instrim.so.cc b/llvm_mode/afl-llvm-lto-instrim.so.cc
index 27504e8d..5f9731c2 100644
--- a/llvm_mode/afl-llvm-lto-instrim.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrim.so.cc
@@ -113,6 +113,8 @@ struct InsTrimLTO : public ModulePass {
     char  be_quiet = 0;
     char *ptr;
 
+    setvbuf(stdout, NULL, _IONBF, 0);
+
     if ((isatty(2) && !getenv("AFL_QUIET")) || getenv("AFL_DEBUG") != NULL) {
 
       SAYF(cCYA "InsTrimLTO" VERSION cRST
diff --git a/llvm_mode/afl-llvm-lto-instrumentation.so.cc b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
index cbe68171..0d3015d7 100644
--- a/llvm_mode/afl-llvm-lto-instrumentation.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
@@ -109,6 +109,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
   IntegerType *Int64Ty = IntegerType::getInt64Ty(C);
 
   /* Show a banner */
+  setvbuf(stdout, NULL, _IONBF, 0);
 
   if ((isatty(2) && !getenv("AFL_QUIET")) || debug) {
 
@@ -162,7 +163,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
 
   }
 
-  if (debug) { fprintf(stderr, "map address is %lu\n", map_addr); }
+  if (debug) { fprintf(stderr, "map address is 0x%lx\n", map_addr); }
 
   /* Get/set the globals for the SHM region. */
 
diff --git a/llvm_mode/afl-llvm-lto-whitelist.so.cc b/llvm_mode/afl-llvm-lto-whitelist.so.cc
index 33d40da8..b1f791f4 100644
--- a/llvm_mode/afl-llvm-lto-whitelist.so.cc
+++ b/llvm_mode/afl-llvm-lto-whitelist.so.cc
@@ -111,6 +111,7 @@ bool AFLwhitelist::runOnModule(Module &M) {
   /* Show a banner */
 
   char be_quiet = 0;
+  setvbuf(stdout, NULL, _IONBF, 0);
 
   if ((isatty(2) && !getenv("AFL_QUIET")) || getenv("AFL_DEBUG") != NULL) {
 
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index 82dece75..7997df51 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -140,6 +140,7 @@ bool AFLCoverage::runOnModule(Module &M) {
   /* Show a banner */
 
   char be_quiet = 0;
+  setvbuf(stdout, NULL, _IONBF, 0);
 
   if (getenv("AFL_DEBUG")) debug = 1;
 
diff --git a/src/afl-performance.c b/src/afl-performance.c
index 757bbe1e..a3febdbf 100644
--- a/src/afl-performance.c
+++ b/src/afl-performance.c
@@ -36,7 +36,8 @@ static inline uint64_t rotl(const uint64_t x, int k) {
 void rand_set_seed(afl_state_t *afl, s64 init_seed) {
 
   afl->init_seed = init_seed;
-  afl->rand_seed[0] = hash64((void *)&afl->init_seed, sizeof(afl->init_seed), HASH_CONST);
+  afl->rand_seed[0] =
+      hash64((void *)&afl->init_seed, sizeof(afl->init_seed), HASH_CONST);
   afl->rand_seed[1] = afl->rand_seed[0] ^ 0x1234567890abcdef;
   afl->rand_seed[2] = afl->rand_seed[0] & 0x0123456789abcdef;
   afl->rand_seed[3] = afl->rand_seed[0] | 0x01abcde43f567908;
diff --git a/test/test.sh b/test/test.sh
index 109f21cc..0cf796be 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -459,24 +459,23 @@ test -e ../afl-clang-lto -a -e ../afl-llvm-lto-instrumentation.so && {
   }
   rm -f test-instr.plain
 
-# Disabled whitelist until I have a different solution -mh
-#  echo foobar.c > whitelist.txt
-#  AFL_LLVM_WHITELIST=whitelist.txt ../afl-clang-lto -o test-compcov test-compcov.c > test.out 2>&1
-#  test -e test-compcov && {
-#    grep -q "No instrumentation targets found" test.out && {
-#      $ECHO "$GREEN[+] llvm_mode LTO whitelist feature works correctly"
-#    } || {
-#      $ECHO "$RED[!] llvm_mode LTO whitelist feature failed"
-#      CODE=1
-#    }
-#  } || {
-#    $ECHO "$RED[!] llvm_mode LTO whitelist feature compilation failed"
-#    CODE=1
-#  }
-#  rm -f test-compcov test.out whitelist.txt
+  echo foobar.c > whitelist.txt
+  AFL_DEBUG=1 AFL_LLVM_WHITELIST=whitelist.txt ../afl-clang-lto -o test-compcov test-compcov.c > test.out 2>&1
+  test -e test-compcov && {
+    grep -q "No instrumentation targets found" test.out && {
+      $ECHO "$GREEN[+] llvm_mode LTO whitelist feature works correctly"
+    } || {
+      $ECHO "$RED[!] llvm_mode LTO whitelist feature failed"
+      CODE=1
+    }
+  } || {
+    $ECHO "$RED[!] llvm_mode LTO whitelist feature compilation failed"
+    CODE=1
+  }
+  rm -f test-compcov test.out whitelist.txt
   ../afl-clang-lto -o test-persistent ../examples/persistent_demo/persistent_demo.c > /dev/null 2>&1
   test -e test-persistent && {
-    echo foo | ../afl-showmap -o /dev/null -q -r ./test-persistent && {
+    echo foo | ../afl-showmap -m none -o /dev/null -q -r ./test-persistent && {
       $ECHO "$GREEN[+] llvm_mode LTO persistent mode feature works correctly"
     } || {
       $ECHO "$RED[!] llvm_mode LTO persistent mode feature failed to work"