diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/afl-as.h | 12 | ||||
-rw-r--r-- | include/afl-fuzz.h | 16 | ||||
-rw-r--r-- | include/alloc-inl.h | 52 | ||||
-rw-r--r-- | include/android-ashmem.h | 8 | ||||
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | include/debug.h | 200 | ||||
-rw-r--r-- | include/forkserver.h | 8 | ||||
-rw-r--r-- | include/hash.h | 4 | ||||
-rw-r--r-- | include/types.h | 16 |
9 files changed, 163 insertions, 157 deletions
diff --git a/include/afl-as.h b/include/afl-as.h index 4f8fb640..55d8694d 100644 --- a/include/afl-as.h +++ b/include/afl-as.h @@ -398,9 +398,9 @@ static const u8* main_payload_32 = recognize .string. */ #ifdef __APPLE__ -# define CALL_L64(str) "call _" str "\n" +#define CALL_L64(str) "call _" str "\n" #else -# define CALL_L64(str) "call " str "@PLT\n" +#define CALL_L64(str) "call " str "@PLT\n" #endif /* ^__APPLE__ */ static const u8* main_payload_64 = @@ -737,9 +737,9 @@ static const u8* main_payload_64 = #ifdef __APPLE__ " .comm __afl_area_ptr, 8\n" -# ifndef COVERAGE_ONLY +#ifndef COVERAGE_ONLY " .comm __afl_prev_loc, 8\n" -# endif /* !COVERAGE_ONLY */ +#endif /* !COVERAGE_ONLY */ " .comm __afl_fork_pid, 4\n" " .comm __afl_temp, 4\n" " .comm __afl_setup_failure, 1\n" @@ -747,9 +747,9 @@ static const u8* main_payload_64 = #else " .lcomm __afl_area_ptr, 8\n" -# ifndef COVERAGE_ONLY +#ifndef COVERAGE_ONLY " .lcomm __afl_prev_loc, 8\n" -# endif /* !COVERAGE_ONLY */ +#endif /* !COVERAGE_ONLY */ " .lcomm __afl_fork_pid, 4\n" " .lcomm __afl_temp, 4\n" " .lcomm __afl_setup_failure, 1\n" diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index b5c5afaf..3206ee72 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -27,12 +27,12 @@ #define MESSAGES_TO_STDOUT #ifndef _GNU_SOURCE -# define _GNU_SOURCE +#define _GNU_SOURCE #endif #define _FILE_OFFSET_BITS 64 #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" @@ -69,21 +69,21 @@ #include <sys/file.h> #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include <sys/sysctl.h> -# define HAVE_ARC4RANDOM 1 +#include <sys/sysctl.h> +#define HAVE_ARC4RANDOM 1 #endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */ /* For systems that have sched_setaffinity; right now just Linux, but one can hope... */ #ifdef __linux__ -# define HAVE_AFFINITY 1 +#define HAVE_AFFINITY 1 #endif /* __linux__ */ #ifndef SIMPLE_FILES -# define CASE_PREFIX "id:" +#define CASE_PREFIX "id:" #else -# define CASE_PREFIX "id_" +#define CASE_PREFIX "id_" #endif /* ^!SIMPLE_FILES */ struct queue_entry { @@ -432,7 +432,7 @@ extern s32 /* Python stuff */ #ifdef USE_PYTHON -# include <Python.h> +#include <Python.h> extern PyObject* py_module; diff --git a/include/alloc-inl.h b/include/alloc-inl.h index 302d15b6..6e46ae19 100644 --- a/include/alloc-inl.h +++ b/include/alloc-inl.h @@ -105,18 +105,22 @@ #define CHECK_PTR(_p) do { \ \ \ + \ if (_p) { \ \ \ + \ if (ALLOC_C1(_p) ^ ALLOC_MAGIC_C1) {\ \ \ + \ if (ALLOC_C1(_p) == ALLOC_MAGIC_F) \ ABORT("Use after free."); \ else ABORT("Corrupted head alloc canary."); \ \ } \ \ + \ if (ALLOC_C2(_p) ^ ALLOC_MAGIC_C2) \ ABORT("Corrupted tail alloc canary."); \ \ @@ -124,7 +128,9 @@ \ \ \ + \ } while (0) + */ #define CHECK_PTR_EXPR(_p) \ @@ -371,16 +377,16 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) { /* In non-debug mode, we just do straightforward aliasing of the above functions to user-visible names such as ck_alloc(). */ -# define ck_alloc DFL_ck_alloc -# define ck_alloc_nozero DFL_ck_alloc_nozero -# define ck_realloc DFL_ck_realloc -# define ck_realloc_block DFL_ck_realloc_block -# define ck_strdup DFL_ck_strdup -# define ck_memdup DFL_ck_memdup -# define ck_memdup_str DFL_ck_memdup_str -# define ck_free DFL_ck_free +#define ck_alloc DFL_ck_alloc +#define ck_alloc_nozero DFL_ck_alloc_nozero +#define ck_realloc DFL_ck_realloc +#define ck_realloc_block DFL_ck_realloc_block +#define ck_strdup DFL_ck_strdup +#define ck_memdup DFL_ck_memdup +#define ck_memdup_str DFL_ck_memdup_str +#define ck_free DFL_ck_free -# define alloc_report() +#define alloc_report() #else @@ -389,7 +395,7 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) { /* Alloc tracking data structures: */ -# define ALLOC_BUCKETS 4096 +#define ALLOC_BUCKETS 4096 struct TRK_obj { @@ -399,25 +405,25 @@ struct TRK_obj { }; -# ifdef AFL_MAIN +#ifdef AFL_MAIN struct TRK_obj* TRK[ALLOC_BUCKETS]; u32 TRK_cnt[ALLOC_BUCKETS]; -# define alloc_report() TRK_report() +#define alloc_report() TRK_report() -# else +#else extern struct TRK_obj* TRK[ALLOC_BUCKETS]; extern u32 TRK_cnt[ALLOC_BUCKETS]; -# define alloc_report() +#define alloc_report() -# endif /* ^AFL_MAIN */ +#endif /* ^AFL_MAIN */ /* Bucket-assigning function for a given pointer: */ -# define TRKH(_ptr) (((((u32)(_ptr)) >> 16) ^ ((u32)(_ptr))) % ALLOC_BUCKETS) +#define TRKH(_ptr) (((((u32)(_ptr)) >> 16) ^ ((u32)(_ptr))) % ALLOC_BUCKETS) /* Add a new entry to the list of allocated objects. */ @@ -569,25 +575,25 @@ static inline void TRK_ck_free(void* ptr, const char* file, const char* func, /* Aliasing user-facing names to tracking functions: */ -# define ck_alloc(_p1) TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__) +#define ck_alloc(_p1) TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__) #define ck_alloc_nozero(_p1) TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__) -# define ck_realloc(_p1, _p2)\ +#define ck_realloc(_p1, _p2) \ TRK_ck_realloc(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_realloc_block(_p1, _p2)\ +#define ck_realloc_block(_p1, _p2) \ TRK_ck_realloc_block(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_strdup(_p1) TRK_ck_strdup(_p1, __FILE__, __FUNCTION__, __LINE__) +#define ck_strdup(_p1) TRK_ck_strdup(_p1, __FILE__, __FUNCTION__, __LINE__) -# define ck_memdup(_p1, _p2)\ +#define ck_memdup(_p1, _p2) \ TRK_ck_memdup(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_memdup_str(_p1, _p2)\ +#define ck_memdup_str(_p1, _p2) \ TRK_ck_memdup_str(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_free(_p1) TRK_ck_free(_p1, __FILE__, __FUNCTION__, __LINE__) +#define ck_free(_p1) TRK_ck_free(_p1, __FILE__, __FUNCTION__, __LINE__) #endif /* ^!DEBUG_BUILD */ diff --git a/include/android-ashmem.h b/include/android-ashmem.h index a4b5bf30..02a84d11 100644 --- a/include/android-ashmem.h +++ b/include/android-ashmem.h @@ -8,10 +8,10 @@ #include <sys/mman.h> #if __ANDROID_API__ >= 26 -# define shmat bionic_shmat -# define shmctl bionic_shmctl -# define shmdt bionic_shmdt -# define shmget bionic_shmget +#define shmat bionic_shmat +#define shmctl bionic_shmctl +#define shmdt bionic_shmdt +#define shmget bionic_shmget #endif #include <sys/shm.h> #undef shmat diff --git a/include/config.h b/include/config.h index babba3bd..d85a503d 100644 --- a/include/config.h +++ b/include/config.h @@ -50,9 +50,9 @@ /* Default memory limit for child process (MB): */ #ifndef __x86_64__ -# define MEM_LIMIT 25 +#define MEM_LIMIT 25 #else -# define MEM_LIMIT 50 +#define MEM_LIMIT 50 #endif /* ^!__x86_64__ */ /* Default memory limit when running in QEMU mode (MB): */ diff --git a/include/debug.h b/include/debug.h index 6a59ad7a..5ff2e23e 100644 --- a/include/debug.h +++ b/include/debug.h @@ -28,77 +28,77 @@ #ifdef USE_COLOR -# define cBLK "\x1b[0;30m" -# define cRED "\x1b[0;31m" -# define cGRN "\x1b[0;32m" -# define cBRN "\x1b[0;33m" -# define cBLU "\x1b[0;34m" -# define cMGN "\x1b[0;35m" -# define cCYA "\x1b[0;36m" -# define cLGR "\x1b[0;37m" -# define cGRA "\x1b[1;90m" -# define cLRD "\x1b[1;91m" -# define cLGN "\x1b[1;92m" -# define cYEL "\x1b[1;93m" -# define cLBL "\x1b[1;94m" -# define cPIN "\x1b[1;95m" -# define cLCY "\x1b[1;96m" -# define cBRI "\x1b[1;97m" -# define cRST "\x1b[0m" - -# define bgBLK "\x1b[40m" -# define bgRED "\x1b[41m" -# define bgGRN "\x1b[42m" -# define bgBRN "\x1b[43m" -# define bgBLU "\x1b[44m" -# define bgMGN "\x1b[45m" -# define bgCYA "\x1b[46m" -# define bgLGR "\x1b[47m" -# define bgGRA "\x1b[100m" -# define bgLRD "\x1b[101m" -# define bgLGN "\x1b[102m" -# define bgYEL "\x1b[103m" -# define bgLBL "\x1b[104m" -# define bgPIN "\x1b[105m" -# define bgLCY "\x1b[106m" -# define bgBRI "\x1b[107m" +#define cBLK "\x1b[0;30m" +#define cRED "\x1b[0;31m" +#define cGRN "\x1b[0;32m" +#define cBRN "\x1b[0;33m" +#define cBLU "\x1b[0;34m" +#define cMGN "\x1b[0;35m" +#define cCYA "\x1b[0;36m" +#define cLGR "\x1b[0;37m" +#define cGRA "\x1b[1;90m" +#define cLRD "\x1b[1;91m" +#define cLGN "\x1b[1;92m" +#define cYEL "\x1b[1;93m" +#define cLBL "\x1b[1;94m" +#define cPIN "\x1b[1;95m" +#define cLCY "\x1b[1;96m" +#define cBRI "\x1b[1;97m" +#define cRST "\x1b[0m" + +#define bgBLK "\x1b[40m" +#define bgRED "\x1b[41m" +#define bgGRN "\x1b[42m" +#define bgBRN "\x1b[43m" +#define bgBLU "\x1b[44m" +#define bgMGN "\x1b[45m" +#define bgCYA "\x1b[46m" +#define bgLGR "\x1b[47m" +#define bgGRA "\x1b[100m" +#define bgLRD "\x1b[101m" +#define bgLGN "\x1b[102m" +#define bgYEL "\x1b[103m" +#define bgLBL "\x1b[104m" +#define bgPIN "\x1b[105m" +#define bgLCY "\x1b[106m" +#define bgBRI "\x1b[107m" #else -# define cBLK "" -# define cRED "" -# define cGRN "" -# define cBRN "" -# define cBLU "" -# define cMGN "" -# define cCYA "" -# define cLGR "" -# define cGRA "" -# define cLRD "" -# define cLGN "" -# define cYEL "" -# define cLBL "" -# define cPIN "" -# define cLCY "" -# define cBRI "" -# define cRST "" - -# define bgBLK "" -# define bgRED "" -# define bgGRN "" -# define bgBRN "" -# define bgBLU "" -# define bgMGN "" -# define bgCYA "" -# define bgLGR "" -# define bgGRA "" -# define bgLRD "" -# define bgLGN "" -# define bgYEL "" -# define bgLBL "" -# define bgPIN "" -# define bgLCY "" -# define bgBRI "" +#define cBLK "" +#define cRED "" +#define cGRN "" +#define cBRN "" +#define cBLU "" +#define cMGN "" +#define cCYA "" +#define cLGR "" +#define cGRA "" +#define cLRD "" +#define cLGN "" +#define cYEL "" +#define cLBL "" +#define cPIN "" +#define cLCY "" +#define cBRI "" +#define cRST "" + +#define bgBLK "" +#define bgRED "" +#define bgGRN "" +#define bgBRN "" +#define bgBLU "" +#define bgMGN "" +#define bgCYA "" +#define bgLGR "" +#define bgGRA "" +#define bgLRD "" +#define bgLGN "" +#define bgYEL "" +#define bgLBL "" +#define bgPIN "" +#define bgLCY "" +#define bgBRI "" #endif /* ^USE_COLOR */ @@ -108,39 +108,39 @@ #ifdef FANCY_BOXES -# define SET_G1 "\x1b)0" /* Set G1 for box drawing */ -# define RESET_G1 "\x1b)B" /* Reset G1 to ASCII */ -# define bSTART "\x0e" /* Enter G1 drawing mode */ -# define bSTOP "\x0f" /* Leave G1 drawing mode */ -# define bH "q" /* Horizontal line */ -# define bV "x" /* Vertical line */ -# define bLT "l" /* Left top corner */ -# define bRT "k" /* Right top corner */ -# define bLB "m" /* Left bottom corner */ -# define bRB "j" /* Right bottom corner */ -# define bX "n" /* Cross */ -# define bVR "t" /* Vertical, branch right */ -# define bVL "u" /* Vertical, branch left */ -# define bHT "v" /* Horizontal, branch top */ -# define bHB "w" /* Horizontal, branch bottom */ +#define SET_G1 "\x1b)0" /* Set G1 for box drawing */ +#define RESET_G1 "\x1b)B" /* Reset G1 to ASCII */ +#define bSTART "\x0e" /* Enter G1 drawing mode */ +#define bSTOP "\x0f" /* Leave G1 drawing mode */ +#define bH "q" /* Horizontal line */ +#define bV "x" /* Vertical line */ +#define bLT "l" /* Left top corner */ +#define bRT "k" /* Right top corner */ +#define bLB "m" /* Left bottom corner */ +#define bRB "j" /* Right bottom corner */ +#define bX "n" /* Cross */ +#define bVR "t" /* Vertical, branch right */ +#define bVL "u" /* Vertical, branch left */ +#define bHT "v" /* Horizontal, branch top */ +#define bHB "w" /* Horizontal, branch bottom */ #else -# define SET_G1 "" -# define RESET_G1 "" -# define bSTART "" -# define bSTOP "" -# define bH "-" -# define bV "|" -# define bLT "+" -# define bRT "+" -# define bLB "+" -# define bRB "+" -# define bX "+" -# define bVR "+" -# define bVL "+" -# define bHT "+" -# define bHB "+" +#define SET_G1 "" +#define RESET_G1 "" +#define bSTART "" +#define bSTOP "" +#define bH "-" +#define bV "|" +#define bLT "+" +#define bRT "+" +#define bLB "+" +#define bRB "+" +#define bX "+" +#define bVR "+" +#define bVL "+" +#define bHT "+" +#define bHB "+" #endif /* ^FANCY_BOXES */ @@ -161,9 +161,9 @@ /* Just print stuff to the appropriate stream. */ #ifdef MESSAGES_TO_STDOUT -# define SAYF(x...) printf(x) +#define SAYF(x...) printf(x) #else -# define SAYF(x...) fprintf(stderr, x) +#define SAYF(x...) fprintf(stderr, x) #endif /* ^MESSAGES_TO_STDOUT */ /* Show a prefixed warning. */ diff --git a/include/forkserver.h b/include/forkserver.h index af5dab72..bfc35800 100644 --- a/include/forkserver.h +++ b/include/forkserver.h @@ -5,20 +5,20 @@ void handle_timeout(int sig); void init_forkserver(char **argv); #ifdef __APPLE__ -# define MSG_FORK_ON_APPLE \ +#define MSG_FORK_ON_APPLE \ " - On MacOS X, the semantics of fork() syscalls are non-standard and " \ "may\n" \ " break afl-fuzz performance optimizations when running " \ "platform-specific\n" \ " targets. To fix this, set AFL_NO_FORKSRV=1 in the environment.\n\n" #else -# define MSG_FORK_ON_APPLE "" +#define MSG_FORK_ON_APPLE "" #endif #ifdef RLIMIT_AS -# define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%llu << 10];" +#define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%llu << 10];" #else -# define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%llu << 10];" +#define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%llu << 10];" #endif /* ^RLIMIT_AS */ #endif diff --git a/include/hash.h b/include/hash.h index 5d0512a6..f60839ea 100644 --- a/include/hash.h +++ b/include/hash.h @@ -31,7 +31,7 @@ #ifdef __x86_64__ -# define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r)))) +#define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r)))) static inline u32 hash32(const void* key, u32 len, u32 seed) { @@ -66,7 +66,7 @@ static inline u32 hash32(const void* key, u32 len, u32 seed) { #else -# define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r)))) +#define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r)))) static inline u32 hash32(const void* key, u32 len, u32 seed) { diff --git a/include/types.h b/include/types.h index 60ae64c2..dba666b6 100644 --- a/include/types.h +++ b/include/types.h @@ -52,8 +52,8 @@ typedef int32_t s32; typedef int64_t s64; #ifndef MIN -# define MIN(_a, _b) ((_a) > (_b) ? (_b) : (_a)) -# define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) +#define MIN(_a, _b) ((_a) > (_b) ? (_b) : (_a)) +#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) #endif /* !MIN */ #define SWAP16(_x) \ @@ -74,9 +74,9 @@ typedef int64_t s64; }) #ifdef AFL_LLVM_PASS -# define AFL_R(x) (random() % (x)) +#define AFL_R(x) (random() % (x)) #else -# define R(x) (random() % (x)) +#define R(x) (random() % (x)) #endif /* ^AFL_LLVM_PASS */ #define STRINGIFY_INTERNAL(x) #x @@ -85,11 +85,11 @@ typedef int64_t s64; #define MEM_BARRIER() __asm__ volatile("" ::: "memory") #if __GNUC__ < 6 -# define likely(_x) (_x) -# define unlikely(_x) (_x) +#define likely(_x) (_x) +#define unlikely(_x) (_x) #else -# define likely(_x) __builtin_expect(!!(_x), 1) -# define unlikely(_x) __builtin_expect(!!(_x), 0) +#define likely(_x) __builtin_expect(!!(_x), 1) +#define unlikely(_x) __builtin_expect(!!(_x), 0) #endif #endif /* ! _HAVE_TYPES_H */ |