From 124ec8d297269b6b3066123782a7e92c802d2248 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Mon, 2 Dec 2019 14:34:21 +0100 Subject: code format (contributors, do it!) --- gcc_plugin/afl-gcc-pass.so.cc | 23 +++++++++++++---------- gcc_plugin/afl-gcc-rt.o.c | 12 ++++++------ 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'gcc_plugin') diff --git a/gcc_plugin/afl-gcc-pass.so.cc b/gcc_plugin/afl-gcc-pass.so.cc index 19e4dfba..ab7daebb 100644 --- a/gcc_plugin/afl-gcc-pass.so.cc +++ b/gcc_plugin/afl-gcc-pass.so.cc @@ -166,7 +166,7 @@ static unsigned int ext_call_instrument(function *fun) { fcall = gimple_build_call( fndecl, 1, cur_loc); /* generate the function _call_ to above built reference, with - *1* parameter -> the random const for the location */ + *1* parameter -> the random const for the location */ gimple_seq_add_stmt(&seq, fcall); /* and insert into a sequence */ /* Done - grab the entry to the block and insert sequence */ @@ -202,10 +202,9 @@ static unsigned int inline_instrument(function *fun) { basic_block bb; unsigned finst_blocks = 0; unsigned fcnt_blocks = 0; - tree one = build_int_cst(unsigned_char_type_node, 1); + tree one = build_int_cst(unsigned_char_type_node, 1); // tree zero = build_int_cst(unsigned_char_type_node, 0); - /* Set up global type declarations */ tree map_type = build_pointer_type(unsigned_char_type_node); tree map_ptr_g = @@ -417,8 +416,8 @@ class afl_pass : public gimple_opt_pass { if (!myWhitelist.empty()) { - bool instrumentBlock = false; - std::string instFilename; + bool instrumentBlock = false; + std::string instFilename; unsigned int instLine = 0; /* EXPR_FILENAME @@ -467,13 +466,17 @@ class afl_pass : public gimple_opt_pass { if (!instrumentBlock) { if (!be_quiet) { - if (!instFilename.empty()) - SAYF(cYEL "[!] " cBRI "Not in whitelist, skipping %s line %u...\n", - instFilename.c_str(), instLine); - else - SAYF(cYEL "[!] " cBRI "No filename information found, skipping it"); + + if (!instFilename.empty()) + SAYF(cYEL "[!] " cBRI "Not in whitelist, skipping %s line %u...\n", + instFilename.c_str(), instLine); + else + SAYF(cYEL "[!] " cBRI "No filename information found, skipping it"); + } + return 0; + } } diff --git a/gcc_plugin/afl-gcc-rt.o.c b/gcc_plugin/afl-gcc-rt.o.c index 1fb9e099..37cdbeb3 100644 --- a/gcc_plugin/afl-gcc-rt.o.c +++ b/gcc_plugin/afl-gcc-rt.o.c @@ -55,9 +55,9 @@ __thread u32 __afl_prev_loc; /* Trace a basic block with some ID */ void __afl_trace(const u32 x) { -#if 1 /* enable for neverZero feature. */ - __afl_area_ptr[__afl_prev_loc ^ x] += 1 - + ((u8)(1 + __afl_area_ptr[__afl_prev_loc ^ x]) == 0); +#if 1 /* enable for neverZero feature. */ + __afl_area_ptr[__afl_prev_loc ^ x] += + 1 + ((u8)(1 + __afl_area_ptr[__afl_prev_loc ^ x]) == 0); #else ++__afl_area_ptr[__afl_prev_loc ^ x]; #endif @@ -84,9 +84,9 @@ static void __afl_map_shm(void) { if (id_str) { #ifdef USEMMAP - const char* shm_file_path = id_str; + const char * shm_file_path = id_str; int shm_fd = -1; - unsigned char* shm_base = NULL; + unsigned char *shm_base = NULL; /* create the shared memory segment as if it was a file */ shm_fd = shm_open(shm_file_path, O_RDWR, 0600); @@ -265,7 +265,7 @@ int __afl_persistent_loop(unsigned int max_cnt) { } - return 0; + return 0; } -- cgit 1.4.1 From dbdd9dbbde2735fb604456fd05e3fa16566e9e49 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 2 Dec 2019 17:32:31 +0100 Subject: getting very close with travis --- .travis.yml | 6 +++--- gcc_plugin/afl-gcc-fast.c | 6 ++++++ test/test.sh | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'gcc_plugin') diff --git a/.travis.yml b/.travis.yml index 7c061446..d5b1fac3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,14 +36,14 @@ env: before_install: # export LLVM_DIR=${TRAVIS_BUILD_DIR}/${LLVM_PACKAGE} - echo Testing on $NAME - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then wget "$LINK""$NAME".tar.xz ; DIR=`pwd` ; pushd /usr/local ; sudo tar xJf "$DIR"/"$NAME".tar.xz ; popd ; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then wget "$LINK""$NAME".tar.xz ; export LLVM_CONFIG=`pwd`/"$NAME" ; tar xJf "$DIR"/"$NAME".tar.xz ; fi - if [ "$MODERN" = "yes" ]; then sudo apt update ; sudo apt upgrade ; sudo apt install -y libtool libtool-bin automake bison libglib2.0 build-essential clang gcc-7 gcc-7-plugin-dev libc++-7-dev ; fi - if [ "$MODERN" = "no" ]; then sudo apt update ; sudo apt install -y libtool $EXTRA automake bison libglib2.0 build-essential clang gcc gcc-"$GCC"-plugin-dev libc++-dev ; fi script: - gcc -v - clang -v - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then find / -name "llvm-config*" -o -name clang++ 2> /dev/null ; make source-only ; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then make source-only ; fi - if [ "$TRAVIS_OS_NAME" = "linux" -a "$TRAVIS_CPU_ARCH" = "amd64" ]; then make distrib ; fi - - if [ "$TRAVIS_CPU_ARCH" = "arm64" ] ; then make ; cd qemu_mode && sh ./build_qemu_support.sh ; fi + - if [ "$TRAVIS_CPU_ARCH" = "arm64" ] ; then make ; cd qemu_mode && sh ./build_qemu_support.sh ; cd .. ; fi - make tests diff --git a/gcc_plugin/afl-gcc-fast.c b/gcc_plugin/afl-gcc-fast.c index 68035944..6522aa69 100644 --- a/gcc_plugin/afl-gcc-fast.c +++ b/gcc_plugin/afl-gcc-fast.c @@ -325,6 +325,12 @@ int main(int argc, char** argv) { SAYF(cCYA "afl-gcc-fast" VERSION cRST " initially by , maintainer: hexcoder-\n"); + if (getenv("AFL_GCC_WHITELIST") == NULL) { + + SAYF(cYEL "Warning:" cRST " using afl-gcc-fast without using AFL_GCC_WHITELIST currently produces worse results than afl-gcc. Even better, use llvm_mode for now.\n"); + + } + } find_obj(argv[0]); diff --git a/test/test.sh b/test/test.sh index 14acc8fc..eea65cf5 100755 --- a/test/test.sh +++ b/test/test.sh @@ -450,7 +450,7 @@ test -e ../libradamsa.so && { $ECHO "$BLUE[*] Testing: qemu_mode" test -e ../afl-qemu-trace && { - gcc -no-pie -o test-instr ../test-instr.c + gcc -o test-instr ../test-instr.c gcc -o test-compcov test-compcov.c test -e test-instr -a -e test-compcov && { { -- cgit 1.4.1