From b24639d0113e15933e749ea0f96abe3f25a134a0 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Mon, 2 Sep 2019 18:49:43 +0200 Subject: run code formatter --- libtokencap/libtokencap.so.c | 66 +++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 38 deletions(-) (limited to 'libtokencap/libtokencap.so.c') diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c index 54072279..fa26447e 100644 --- a/libtokencap/libtokencap.so.c +++ b/libtokencap/libtokencap.so.c @@ -30,27 +30,23 @@ # error "Sorry, this library is Linux-specific for now!" #endif /* !__linux__ */ - /* Mapping data and such */ #define MAX_MAPPINGS 1024 -static struct mapping { - void *st, *en; -} __tokencap_ro[MAX_MAPPINGS]; +static struct mapping { void *st, *en; } __tokencap_ro[MAX_MAPPINGS]; static u32 __tokencap_ro_cnt; static u8 __tokencap_ro_loaded; static FILE* __tokencap_out_file; - /* Identify read-only regions in memory. Only parameters that fall into these ranges are worth dumping when passed to strcmp() and so on. Read-write regions are far more likely to contain user input instead. */ static void __tokencap_load_mappings(void) { - u8 buf[MAX_LINE]; + u8 buf[MAX_LINE]; FILE* f = fopen("/proc/self/maps", "r"); __tokencap_ro_loaded = 1; @@ -59,8 +55,8 @@ static void __tokencap_load_mappings(void) { while (fgets(buf, MAX_LINE, f)) { - u8 rf, wf; - void* st, *en; + u8 rf, wf; + void *st, *en; if (sscanf(buf, "%p-%p %c%c", &st, &en, &rf, &wf) != 4) continue; if (wf == 'w' || rf != 'r') continue; @@ -76,7 +72,6 @@ static void __tokencap_load_mappings(void) { } - /* Check an address against the list of read-only mappings. */ static u8 __tokencap_is_ro(const void* ptr) { @@ -85,20 +80,19 @@ static u8 __tokencap_is_ro(const void* ptr) { if (!__tokencap_ro_loaded) __tokencap_load_mappings(); - for (i = 0; i < __tokencap_ro_cnt; i++) + for (i = 0; i < __tokencap_ro_cnt; i++) if (ptr >= __tokencap_ro[i].st && ptr <= __tokencap_ro[i].en) return 1; return 0; } - /* Dump an interesting token to output file, quoting and escaping it properly. */ static void __tokencap_dump(const u8* ptr, size_t len, u8 is_text) { - u8 buf[MAX_AUTO_EXTRA * 4 + 1]; + u8 buf[MAX_AUTO_EXTRA * 4 + 1]; u32 i; u32 pos = 0; @@ -120,9 +114,7 @@ static void __tokencap_dump(const u8* ptr, size_t len, u8 is_text) { pos += 4; break; - default: - - buf[pos++] = ptr[i]; + default: buf[pos++] = ptr[i]; } @@ -130,11 +122,10 @@ static void __tokencap_dump(const u8* ptr, size_t len, u8 is_text) { buf[pos] = 0; - fprintf(__tokencap_out_file, "\"%s\"\n", buf); + fprintf(__tokencap_out_file, "\"%s\"\n", buf); } - /* Replacements for strcmp(), memcmp(), and so on. Note that these will be used only if the target is compiled with -fno-builtins and linked dynamically. */ @@ -151,13 +142,13 @@ int strcmp(const char* str1, const char* str2) { if (c1 != c2) return (c1 > c2) ? 1 : -1; if (!c1) return 0; - str1++; str2++; + str1++; + str2++; } } - #undef strncmp int strncmp(const char* str1, const char* str2, size_t len) { @@ -171,7 +162,8 @@ int strncmp(const char* str1, const char* str2, size_t len) { if (!c1) return 0; if (c1 != c2) return (c1 > c2) ? 1 : -1; - str1++; str2++; + str1++; + str2++; } @@ -179,7 +171,6 @@ int strncmp(const char* str1, const char* str2, size_t len) { } - #undef strcasecmp int strcasecmp(const char* str1, const char* str2) { @@ -193,13 +184,13 @@ int strcasecmp(const char* str1, const char* str2) { if (c1 != c2) return (c1 > c2) ? 1 : -1; if (!c1) return 0; - str1++; str2++; + str1++; + str2++; } } - #undef strncasecmp int strncasecmp(const char* str1, const char* str2, size_t len) { @@ -213,7 +204,8 @@ int strncasecmp(const char* str1, const char* str2, size_t len) { if (!c1) return 0; if (c1 != c2) return (c1 > c2) ? 1 : -1; - str1++; str2++; + str1++; + str2++; } @@ -221,7 +213,6 @@ int strncasecmp(const char* str1, const char* str2, size_t len) { } - #undef memcmp int memcmp(const void* mem1, const void* mem2, size_t len) { @@ -233,7 +224,8 @@ int memcmp(const void* mem1, const void* mem2, size_t len) { unsigned char c1 = *(const char*)mem1, c2 = *(const char*)mem2; if (c1 != c2) return (c1 > c2) ? 1 : -1; - mem1++; mem2++; + mem1++; + mem2++; } @@ -241,7 +233,6 @@ int memcmp(const void* mem1, const void* mem2, size_t len) { } - #undef strstr char* strstr(const char* haystack, const char* needle) { @@ -249,16 +240,17 @@ char* strstr(const char* haystack, const char* needle) { if (__tokencap_is_ro(haystack)) __tokencap_dump(haystack, strlen(haystack), 1); - if (__tokencap_is_ro(needle)) - __tokencap_dump(needle, strlen(needle), 1); + if (__tokencap_is_ro(needle)) __tokencap_dump(needle, strlen(needle), 1); do { + const char* n = needle; const char* h = haystack; - while(*n && *h && *n == *h) n++, h++; + while (*n && *h && *n == *h) + n++, h++; - if(!*n) return (char*)haystack; + if (!*n) return (char*)haystack; } while (*(haystack++)); @@ -266,7 +258,6 @@ char* strstr(const char* haystack, const char* needle) { } - #undef strcasestr char* strcasestr(const char* haystack, const char* needle) { @@ -274,25 +265,24 @@ char* strcasestr(const char* haystack, const char* needle) { if (__tokencap_is_ro(haystack)) __tokencap_dump(haystack, strlen(haystack), 1); - if (__tokencap_is_ro(needle)) - __tokencap_dump(needle, strlen(needle), 1); + if (__tokencap_is_ro(needle)) __tokencap_dump(needle, strlen(needle), 1); do { const char* n = needle; const char* h = haystack; - while(*n && *h && tolower(*n) == tolower(*h)) n++, h++; + while (*n && *h && tolower(*n) == tolower(*h)) + n++, h++; - if(!*n) return (char*)haystack; + if (!*n) return (char*)haystack; - } while(*(haystack++)); + } while (*(haystack++)); return 0; } - /* Init code to open the output file (or default to stderr). */ __attribute__((constructor)) void __tokencap_init(void) { -- cgit 1.4.1 From 7151651ea9a87f394cf7f44fcba56cd0d2b7eefa Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 3 Sep 2019 20:43:11 +0200 Subject: remove macro indentation from code-format --- .custom-format.py | 19 +-- include/afl-as.h | 12 +- include/afl-fuzz.h | 16 +-- include/alloc-inl.h | 52 ++++---- include/android-ashmem.h | 8 +- include/config.h | 4 +- include/debug.h | 200 +++++++++++++++--------------- include/forkserver.h | 8 +- include/hash.h | 4 +- include/types.h | 16 +-- libdislocator/libdislocator.so.c | 4 +- libtokencap/libtokencap.so.c | 2 +- llvm_mode/MarkNodes.h | 8 +- llvm_mode/afl-llvm-rt.o.c | 6 +- qemu_mode/libcompcov/libcompcov.so.c | 2 +- qemu_mode/libcompcov/pmparser.h | 22 ++-- qemu_mode/patches/afl-qemu-common.h | 4 +- src/afl-analyze.c | 2 +- src/afl-as.c | 6 +- src/afl-common.c | 2 +- src/afl-fuzz-init.c | 16 +-- src/afl-fuzz-one.c | 6 +- src/afl-fuzz.c | 18 +-- src/afl-gotcpu.c | 6 +- src/afl-sharedmem.c | 6 +- src/afl-showmap.c | 2 +- src/afl-tmin.c | 2 +- unicorn_mode/patches/afl-unicorn-common.h | 4 +- 28 files changed, 223 insertions(+), 234 deletions(-) (limited to 'libtokencap/libtokencap.so.c') diff --git a/.custom-format.py b/.custom-format.py index 32b8f7c9..81adbd85 100755 --- a/.custom-format.py +++ b/.custom-format.py @@ -45,31 +45,14 @@ def custom_format(filename): src, _ = p.communicate() src = str(src, "utf-8") - macro_indent = 0 in_define = False last_line = None out = "" for line in src.split("\n"): if line.startswith("#"): - i = macro_indent - if line.startswith("#end") and macro_indent > 0: - macro_indent -= 1 - i -= 1 - elif line.startswith("#el") and macro_indent > 0: - i -= 1 - elif line.startswith("#if") and not (line.startswith("#ifndef") and (line.endswith("_H") or line.endswith("H_"))): - macro_indent += 1 - elif line.startswith("#define"): + if line.startswith("#define"): in_define = True - r = "#" + (i * " ") + line[1:] - if i != 0 and line.endswith("\\"): - r = r[:-1] - while r[-1].isspace() and len(r) != (len(line)-1): - r = r[:-1] - r += "\\" - if len(r) <= COLUMN_LIMIT: - line = r elif "/*" in line and not line.strip().startswith("/*") and line.endswith("*/") and len(line) < (COLUMN_LIMIT-2): cmt_start = line.rfind("/*") 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 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include -# define HAVE_ARC4RANDOM 1 +#include +#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 +#include 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 #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 #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 */ diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 5104fed4..256506be 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -29,11 +29,11 @@ #include "types.h" #ifndef PAGE_SIZE -# define PAGE_SIZE 4096 +#define PAGE_SIZE 4096 #endif /* !PAGE_SIZE */ #ifndef MAP_ANONYMOUS -# define MAP_ANONYMOUS MAP_ANON +#define MAP_ANONYMOUS MAP_ANON #endif /* !MAP_ANONYMOUS */ /* Error / message handling: */ diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c index fa26447e..51c36c4d 100644 --- a/libtokencap/libtokencap.so.c +++ b/libtokencap/libtokencap.so.c @@ -27,7 +27,7 @@ #include "../config.h" #ifndef __linux__ -# error "Sorry, this library is Linux-specific for now!" +#error "Sorry, this library is Linux-specific for now!" #endif /* !__linux__ */ /* Mapping data and such */ diff --git a/llvm_mode/MarkNodes.h b/llvm_mode/MarkNodes.h index 23316652..8ddc978d 100644 --- a/llvm_mode/MarkNodes.h +++ b/llvm_mode/MarkNodes.h @@ -1,9 +1,9 @@ #ifndef __MARK_NODES__ -# define __MARK_NODES__ +#define __MARK_NODES__ -# include "llvm/IR/BasicBlock.h" -# include "llvm/IR/Function.h" -# include +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Function.h" +#include std::pair, std::vector> markNodes(llvm::Function *F); diff --git a/llvm_mode/afl-llvm-rt.o.c b/llvm_mode/afl-llvm-rt.o.c index bc38f1ec..8d435d21 100644 --- a/llvm_mode/afl-llvm-rt.o.c +++ b/llvm_mode/afl-llvm-rt.o.c @@ -20,7 +20,7 @@ */ #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" @@ -42,9 +42,9 @@ the LLVM-generated runtime initialization pass, not before. */ #ifdef USE_TRACE_PC -# define CONST_PRIO 5 +#define CONST_PRIO 5 #else -# define CONST_PRIO 0 +#define CONST_PRIO 0 #endif /* ^USE_TRACE_PC */ #include diff --git a/qemu_mode/libcompcov/libcompcov.so.c b/qemu_mode/libcompcov/libcompcov.so.c index e758c034..9d61848e 100644 --- a/qemu_mode/libcompcov/libcompcov.so.c +++ b/qemu_mode/libcompcov/libcompcov.so.c @@ -33,7 +33,7 @@ #include "pmparser.h" #ifndef __linux__ -# error "Sorry, this library is Linux-specific for now!" +#error "Sorry, this library is Linux-specific for now!" #endif /* !__linux__ */ /* Change this value to tune the compare coverage */ diff --git a/qemu_mode/libcompcov/pmparser.h b/qemu_mode/libcompcov/pmparser.h index 91dfd032..e7fcf187 100644 --- a/qemu_mode/libcompcov/pmparser.h +++ b/qemu_mode/libcompcov/pmparser.h @@ -13,19 +13,19 @@ implied warranty. */ #ifndef H_PMPARSER -# define H_PMPARSER -# include -# include -# include -# include -# include -# include -# include -# include -# include +#define H_PMPARSER +#include +#include +#include +#include +#include +#include +#include +#include +#include // maximum line length in a procmaps file -# define PROCMAPS_LINE_MAX_LENGTH (PATH_MAX + 100) +#define PROCMAPS_LINE_MAX_LENGTH (PATH_MAX + 100) /** * procmaps_struct * @desc hold all the information about an area in the process's VM diff --git a/qemu_mode/patches/afl-qemu-common.h b/qemu_mode/patches/afl-qemu-common.h index c87bacb6..88c110b4 100644 --- a/qemu_mode/patches/afl-qemu-common.h +++ b/qemu_mode/patches/afl-qemu-common.h @@ -36,7 +36,7 @@ /* NeverZero */ #if (defined(__x86_64__) || defined(__i386__)) && defined(AFL_QEMU_NOT_ZERO) -# define INC_AFL_AREA(loc) \ +#define INC_AFL_AREA(loc) \ asm volatile( \ "incb (%0, %1, 1)\n" \ "adcb $0, (%0, %1, 1)\n" \ @@ -44,6 +44,6 @@ : "r"(afl_area_ptr), "r"(loc) \ : "memory", "eax") #else -# define INC_AFL_AREA(loc) afl_area_ptr[loc]++ +#define INC_AFL_AREA(loc) afl_area_ptr[loc]++ #endif diff --git a/src/afl-analyze.c b/src/afl-analyze.c index e3014256..4cfebe3b 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -22,7 +22,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" diff --git a/src/afl-as.c b/src/afl-as.c index 57f4c4a3..96b00d37 100644 --- a/src/afl-as.c +++ b/src/afl-as.c @@ -74,9 +74,9 @@ static u8 use_64bit = 1; static u8 use_64bit = 0; -# ifdef __APPLE__ -# error "Sorry, 32-bit Apple platforms are not supported." -# endif /* __APPLE__ */ +#ifdef __APPLE__ +#error "Sorry, 32-bit Apple platforms are not supported." +#endif /* __APPLE__ */ #endif /* ^__x86_64__ */ diff --git a/src/afl-common.c b/src/afl-common.c index 9f1f45eb..69c1a77d 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -13,7 +13,7 @@ /* Detect @@ in args. */ #ifndef __glibc__ -# include +#include #endif void detect_file_args(char** argv, u8* prog_in) { diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index 8a3ee6fa..8588dde7 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -1491,25 +1491,25 @@ void get_core_count(void) { /* On *BSD systems, we can just use a sysctl to get the number of CPUs. */ -# ifdef __APPLE__ +#ifdef __APPLE__ if (sysctlbyname("hw.logicalcpu", &cpu_core_count, &s, NULL, 0) < 0) return; -# else +#else int s_name[2] = {CTL_HW, HW_NCPU}; if (sysctl(s_name, 2, &cpu_core_count, &s, NULL, 0) < 0) return; -# endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ #else -# ifdef HAVE_AFFINITY +#ifdef HAVE_AFFINITY cpu_core_count = sysconf(_SC_NPROCESSORS_ONLN); -# else +#else FILE* f = fopen("/proc/stat", "r"); u8 tmp[1024]; @@ -1521,7 +1521,7 @@ void get_core_count(void) { fclose(f); -# endif /* ^HAVE_AFFINITY */ +#endif /* ^HAVE_AFFINITY */ #endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */ @@ -1772,10 +1772,10 @@ void check_binary(u8* fname) { #else -# if !defined(__arm__) && !defined(__arm64__) +#if !defined(__arm__) && !defined(__arm64__) if (f_data[0] != 0xCF || f_data[1] != 0xFA || f_data[2] != 0xED) FATAL("Program '%s' is not a 64-bit Mach-O binary", target_path); -# endif +#endif #endif /* ^!__APPLE__ */ diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index 1b7abedd..bc63c226 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -2242,11 +2242,11 @@ retry_splicing: out_buf = ck_alloc_nozero(len); memcpy(out_buf, in_buf, len); -# ifdef USE_PYTHON +#ifdef USE_PYTHON goto python_stage; -# else +#else goto havoc_stage; -# endif +#endif } diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 685840c6..d04058ca 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -27,10 +27,10 @@ static void usage(u8* argv0) { #ifdef USE_PYTHON -# define PHYTON_SUPPORT\ +#define PHYTON_SUPPORT \ "Compiled with Python 2.7 module support, see docs/python_mutators.txt\n" #else -# define PHYTON_SUPPORT "" +#define PHYTON_SUPPORT "" #endif SAYF( @@ -616,9 +616,9 @@ int main(int argc, char** argv) { get_core_count(); -# ifdef HAVE_AFFINITY +#ifdef HAVE_AFFINITY bind_to_free_cpu(); -# endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ check_crash_handling(); check_cpu_governor(); @@ -635,12 +635,12 @@ int main(int argc, char** argv) { setup_dirs_fds(); -# ifdef USE_PYTHON +#ifdef USE_PYTHON if (init_py()) FATAL("Failed to initialize Python module"); -# else +#else if (getenv("AFL_PYTHON_MODULE")) FATAL("Your AFL binary was built without Python support"); -# endif +#endif setup_cmdline_file(argv + optind); @@ -867,9 +867,9 @@ stop_fuzzing: alloc_report(); -# ifdef USE_PYTHON +#ifdef USE_PYTHON finalize_py(); -# endif +#endif OKF("We're done here. Have a nice day!\n"); diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c index 5aa9b35c..fd96d25d 100644 --- a/src/afl-gotcpu.c +++ b/src/afl-gotcpu.c @@ -27,11 +27,11 @@ #define AFL_MAIN #ifndef _GNU_SOURCE -# define _GNU_SOURCE +#define _GNU_SOURCE #endif #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include #include @@ -48,7 +48,7 @@ #include "debug.h" #ifdef __linux__ -# define HAVE_AFFINITY 1 +#define HAVE_AFFINITY 1 #endif /* __linux__ */ /* Get unix time in microseconds. */ diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c index 9c7ac7c3..60764779 100644 --- a/src/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -5,7 +5,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" @@ -32,8 +32,8 @@ #include #ifndef USEMMAP -# include -# include +#include +#include #endif extern unsigned char *trace_bits; diff --git a/src/afl-showmap.c b/src/afl-showmap.c index ac3d687d..5c367339 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -24,7 +24,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 9decdb4d..ce4a3d76 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -22,7 +22,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" diff --git a/unicorn_mode/patches/afl-unicorn-common.h b/unicorn_mode/patches/afl-unicorn-common.h index d5038d06..fd88e21b 100644 --- a/unicorn_mode/patches/afl-unicorn-common.h +++ b/unicorn_mode/patches/afl-unicorn-common.h @@ -35,7 +35,7 @@ /* NeverZero */ #if (defined(__x86_64__) || defined(__i386__)) && defined(AFL_QEMU_NOT_ZERO) -# define INC_AFL_AREA(loc) \ +#define INC_AFL_AREA(loc) \ asm volatile( \ "incb (%0, %1, 1)\n" \ "adcb $0, (%0, %1, 1)\n" \ @@ -43,6 +43,6 @@ : "r"(afl_area_ptr), "r"(loc) \ : "memory", "eax") #else -# define INC_AFL_AREA(loc) afl_area_ptr[loc]++ +#define INC_AFL_AREA(loc) afl_area_ptr[loc]++ #endif -- cgit 1.4.1 From e1f18f6212fdab581c3bf732a51dcc5a9cdaa8e7 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Wed, 4 Sep 2019 10:03:51 +0200 Subject: fix typo in custom format --- include/afl-as.h | 30 +++++++++++++-------------- include/afl-fuzz.h | 10 ++++----- include/alloc-inl.h | 27 ++++++++++++++---------- include/android-ashmem.h | 2 +- include/common.h | 2 +- include/config.h | 12 +++++------ include/debug.h | 40 ++++++++++++++++++------------------ include/forkserver.h | 6 +++--- include/hash.h | 4 ++-- include/sharedmem.h | 4 ++-- include/types.h | 10 ++++----- libdislocator/libdislocator.so.c | 4 ++-- libtokencap/libtokencap.so.c | 2 +- llvm_mode/afl-clang-fast.c | 10 ++++----- llvm_mode/afl-llvm-rt.o.c | 2 +- qemu_mode/libcompcov/libcompcov.so.c | 2 +- qemu_mode/patches/afl-qemu-tcg-inl.h | 8 ++++---- src/afl-analyze.c | 28 ++++++++++++------------- src/afl-as.c | 18 ++++++++-------- src/afl-common.c | 2 +- src/afl-forkserver.c | 6 +++--- src/afl-fuzz-bitmap.c | 22 ++++++++++---------- src/afl-fuzz-extras.c | 2 +- src/afl-fuzz-globals.c | 4 ++-- src/afl-fuzz-init.c | 28 ++++++++++++------------- src/afl-fuzz-misc.c | 2 +- src/afl-fuzz-one.c | 16 +++++++-------- src/afl-fuzz-python.c | 4 ++-- src/afl-fuzz-queue.c | 2 +- src/afl-fuzz-run.c | 6 +++--- src/afl-fuzz-stats.c | 6 +++--- src/afl-fuzz.c | 6 +++--- src/afl-gcc.c | 4 ++-- src/afl-gotcpu.c | 6 +++--- src/afl-sharedmem.c | 4 ++-- src/afl-showmap.c | 6 +++--- src/afl-tmin.c | 4 ++-- 37 files changed, 178 insertions(+), 173 deletions(-) (limited to 'libtokencap/libtokencap.so.c') diff --git a/include/afl-as.h b/include/afl-as.h index f7e5c4dd..048866db 100644 --- a/include/afl-as.h +++ b/include/afl-as.h @@ -3,7 +3,7 @@ --------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -186,14 +186,14 @@ static const u8* main_payload_32 = " movl %ecx, __afl_prev_loc\n" #else " movl %ecx, %edi\n" -#endif /* ^!COVERAGE_ONLY */ +#endif /* ^!COVERAGE_ONLY */ "\n" #ifdef SKIP_COUNTS " orb $1, (%edx, %edi, 1)\n" #else " incb (%edx, %edi, 1)\n" " adcb $0, (%edx, %edi, 1)\n" // never zero counter implementation. slightly better path discovery and little performance impact -#endif /* ^SKIP_COUNTS */ +#endif /* ^SKIP_COUNTS */ "\n" "__afl_return:\n" "\n" @@ -382,7 +382,7 @@ static const u8* main_payload_32 = " .comm __afl_setup_failure, 1, 32\n" #ifndef COVERAGE_ONLY " .comm __afl_prev_loc, 4, 32\n" -#endif /* !COVERAGE_ONLY */ +#endif /* !COVERAGE_ONLY */ " .comm __afl_fork_pid, 4, 32\n" " .comm __afl_temp, 4, 32\n" "\n" @@ -404,7 +404,7 @@ static const u8* main_payload_32 = #define CALL_L64(str) "call _" str "\n" #else #define CALL_L64(str) "call " str "@PLT\n" -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ static const u8* main_payload_64 = @@ -422,7 +422,7 @@ static const u8* main_payload_64 = " .byte 0x9f /* lahf */\n" #else " lahf\n" -#endif /* ^__OpenBSD__, etc */ +#endif /* ^__OpenBSD__, etc */ " seto %al\n" "\n" " /* Check if SHM region is already mapped. */\n" @@ -439,14 +439,14 @@ static const u8* main_payload_64 = " xorq __afl_prev_loc(%rip), %rcx\n" " xorq %rcx, __afl_prev_loc(%rip)\n" " shrq $1, __afl_prev_loc(%rip)\n" -#endif /* ^!COVERAGE_ONLY */ +#endif /* ^!COVERAGE_ONLY */ "\n" #ifdef SKIP_COUNTS " orb $1, (%rdx, %rcx, 1)\n" #else " incb (%rdx, %rcx, 1)\n" " adcb $0, (%rdx, %rcx, 1)\n" // never zero counter implementation. slightly better path discovery and little performance impact -#endif /* ^SKIP_COUNTS */ +#endif /* ^SKIP_COUNTS */ "\n" "__afl_return:\n" "\n" @@ -455,7 +455,7 @@ static const u8* main_payload_64 = " .byte 0x9e /* sahf */\n" #else " sahf\n" -#endif /* ^__OpenBSD__, etc */ +#endif /* ^__OpenBSD__, etc */ " ret\n" "\n" ".align 8\n" @@ -474,7 +474,7 @@ static const u8* main_payload_64 = " movq (%rdx), %rdx\n" #else " movq __afl_global_area_ptr(%rip), %rdx\n" -#endif /* !^__APPLE__ */ +#endif /* !^__APPLE__ */ " testq %rdx, %rdx\n" " je __afl_setup_first\n" "\n" @@ -573,7 +573,7 @@ static const u8* main_payload_64 = #else " movq __afl_global_area_ptr@GOTPCREL(%rip), %rdx\n" " movq %rax, (%rdx)\n" -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ " movq %rax, %rdx\n" "\n" "__afl_forkserver:\n" @@ -742,7 +742,7 @@ static const u8* main_payload_64 = " .comm __afl_area_ptr, 8\n" #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" @@ -752,12 +752,12 @@ static const u8* main_payload_64 = " .lcomm __afl_area_ptr, 8\n" #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" -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ " .comm __afl_global_area_ptr, 8, 8\n" "\n" @@ -767,5 +767,5 @@ static const u8* main_payload_64 = "/* --- END --- */\n" "\n"; -#endif /* !_HAVE_AFL_AS_H */ +#endif /* !_HAVE_AFL_AS_H */ diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index 17bdf95d..571ca879 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -3,7 +3,7 @@ ------------------------------------ Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -74,20 +74,20 @@ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #define HAVE_ARC4RANDOM 1 -#endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */ +#endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */ /* For systems that have sched_setaffinity; right now just Linux, but one can hope... */ #ifdef __linux__ #define HAVE_AFFINITY 1 -#endif /* __linux__ */ +#endif /* __linux__ */ #ifndef SIMPLE_FILES #define CASE_PREFIX "id:" #else #define CASE_PREFIX "id_" -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ struct queue_entry { @@ -400,7 +400,7 @@ extern s32 cpu_core_count; /* CPU core count */ extern s32 cpu_aff; /* Selected CPU core */ -#endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ extern FILE* plot_file; /* Gnuplot output file */ diff --git a/include/alloc-inl.h b/include/alloc-inl.h index de9ac1fc..d851fd61 100644 --- a/include/alloc-inl.h +++ b/include/alloc-inl.h @@ -3,7 +3,7 @@ -------------------------------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -69,9 +69,9 @@ /* Magic tokens used to mark used / freed chunks. */ -#define ALLOC_MAGIC_C1 0xFF00FF00 /* Used head (dword) */ -#define ALLOC_MAGIC_F 0xFE00FE00 /* Freed head (dword) */ -#define ALLOC_MAGIC_C2 0xF0 /* Used tail (byte) */ +#define ALLOC_MAGIC_C1 0xFF00FF00 /* Used head (dword) */ +#define ALLOC_MAGIC_F 0xFE00FE00 /* Freed head (dword) */ +#define ALLOC_MAGIC_C2 0xF0 /* Used tail (byte) */ /* Positions of guard tokens in relation to the user-visible pointer. */ @@ -111,14 +111,17 @@ \ \ \ + \ 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."); \ @@ -126,6 +129,7 @@ } \ \ \ + \ if (ALLOC_C2(_p) ^ ALLOC_MAGIC_C2) \ ABORT("Corrupted tail alloc canary."); \ \ @@ -134,6 +138,7 @@ \ \ \ + \ } while (0) */ @@ -197,7 +202,7 @@ static inline void DFL_ck_free(void* mem) { /* Catch pointer issues sooner. */ memset(mem, 0xFF, ALLOC_S(mem)); -#endif /* DEBUG_BUILD */ +#endif /* DEBUG_BUILD */ ALLOC_C1(mem) = ALLOC_MAGIC_F; @@ -228,7 +233,7 @@ static inline void* DFL_ck_realloc(void* orig, u32 size) { #ifndef DEBUG_BUILD ALLOC_C1(orig) = ALLOC_MAGIC_F; -#endif /* !DEBUG_BUILD */ +#endif /* !DEBUG_BUILD */ old_size = ALLOC_S(orig); u8* origu8 = orig; @@ -266,7 +271,7 @@ static inline void* DFL_ck_realloc(void* orig, u32 size) { } -#endif /* ^!DEBUG_BUILD */ +#endif /* ^!DEBUG_BUILD */ ret += ALLOC_OFF_HEAD; @@ -297,7 +302,7 @@ static inline void* DFL_ck_realloc_block(void* orig, u32 size) { } -#endif /* !DEBUG_BUILD */ +#endif /* !DEBUG_BUILD */ return DFL_ck_realloc(orig, size); @@ -424,7 +429,7 @@ extern u32 TRK_cnt[ALLOC_BUCKETS]; #define alloc_report() -#endif /* ^AFL_MAIN */ +#endif /* ^AFL_MAIN */ /* Bucket-assigning function for a given pointer: */ @@ -600,7 +605,7 @@ static inline void TRK_ck_free(void* ptr, const char* file, const char* func, #define ck_free(_p1) TRK_ck_free(_p1, __FILE__, __FUNCTION__, __LINE__) -#endif /* ^!DEBUG_BUILD */ +#endif /* ^!DEBUG_BUILD */ -#endif /* ! _HAVE_ALLOC_INL_H */ +#endif /* ! _HAVE_ALLOC_INL_H */ diff --git a/include/android-ashmem.h b/include/android-ashmem.h index bfe7166e..6c7a98db 100644 --- a/include/android-ashmem.h +++ b/include/android-ashmem.h @@ -3,7 +3,7 @@ ---------------------------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/include/common.h b/include/common.h index 443d1418..905830b5 100644 --- a/include/common.h +++ b/include/common.h @@ -3,7 +3,7 @@ --------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/include/config.h b/include/config.h index 3ea75bb5..9a263c86 100644 --- a/include/config.h +++ b/include/config.h @@ -3,7 +3,7 @@ ------------------------------------------------ Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -58,7 +58,7 @@ #define MEM_LIMIT 25 #else #define MEM_LIMIT 50 -#endif /* ^!__x86_64__ */ +#endif /* ^!__x86_64__ */ /* Default memory limit when running in QEMU mode (MB): */ @@ -128,9 +128,9 @@ /* Probabilities of skipping non-favored entries in the queue, expressed as percentages: */ -#define SKIP_TO_NEW_PROB 99 /* ...when there are new, pending favorites */ -#define SKIP_NFAV_OLD_PROB 95 /* ...no new favs, cur entry already fuzzed */ -#define SKIP_NFAV_NEW_PROB 75 /* ...no new favs, cur entry not fuzzed yet */ +#define SKIP_TO_NEW_PROB 99 /* ...when there are new, pending favorites */ +#define SKIP_NFAV_OLD_PROB 95 /* ...no new favs, cur entry already fuzzed */ +#define SKIP_NFAV_NEW_PROB 75 /* ...no new favs, cur entry not fuzzed yet */ /* Splicing cycle count: */ @@ -371,5 +371,5 @@ // #define IGNORE_FINDS -#endif /* ! _HAVE_CONFIG_H */ +#endif /* ! _HAVE_CONFIG_H */ diff --git a/include/debug.h b/include/debug.h index 201ff943..cccfc284 100644 --- a/include/debug.h +++ b/include/debug.h @@ -3,7 +3,7 @@ ---------------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -105,7 +105,7 @@ #define bgLCY "" #define bgBRI "" -#endif /* ^USE_COLOR */ +#endif /* ^USE_COLOR */ /************************* * Box drawing sequences * @@ -113,21 +113,21 @@ #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 @@ -147,7 +147,7 @@ #define bHT "+" #define bHB "+" -#endif /* ^FANCY_BOXES */ +#endif /* ^FANCY_BOXES */ /*********************** * Misc terminal codes * @@ -169,7 +169,7 @@ #define SAYF(x...) printf(x) #else #define SAYF(x...) fprintf(stderr, x) -#endif /* ^MESSAGES_TO_STDOUT */ +#endif /* ^MESSAGES_TO_STDOUT */ /* Show a prefixed warning. */ @@ -286,5 +286,5 @@ \ } while (0) -#endif /* ! _HAVE_DEBUG_H */ +#endif /* ! _HAVE_DEBUG_H */ diff --git a/include/forkserver.h b/include/forkserver.h index d40af87c..9a099888 100644 --- a/include/forkserver.h +++ b/include/forkserver.h @@ -3,9 +3,9 @@ ---------------------------------------- Originally written by Michal Zalewski - + Forkserver design by Jann Horn - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -45,7 +45,7 @@ void init_forkserver(char **argv); #define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%llu << 10];" #else #define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%llu << 10];" -#endif /* ^RLIMIT_AS */ +#endif /* ^RLIMIT_AS */ #endif diff --git a/include/hash.h b/include/hash.h index 0ffaa410..7085df32 100644 --- a/include/hash.h +++ b/include/hash.h @@ -99,7 +99,7 @@ static inline u32 hash32(const void* key, u32 len, u32 seed) { } -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ -#endif /* !_HAVE_HASH_H */ +#endif /* !_HAVE_HASH_H */ diff --git a/include/sharedmem.h b/include/sharedmem.h index 3fbfe664..18e4ee9f 100644 --- a/include/sharedmem.h +++ b/include/sharedmem.h @@ -3,9 +3,9 @@ --------------------------------------------------- Originally written by Michal Zalewski - + Forkserver design by Jann Horn - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/include/types.h b/include/types.h index baf68401..07fc7e91 100644 --- a/include/types.h +++ b/include/types.h @@ -3,7 +3,7 @@ -------------------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -49,7 +49,7 @@ typedef uint32_t u32; typedef unsigned long long u64; #else typedef uint64_t u64; -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ typedef int8_t s8; typedef int16_t s16; @@ -59,7 +59,7 @@ typedef int64_t s64; #ifndef MIN #define MIN(_a, _b) ((_a) > (_b) ? (_b) : (_a)) #define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) -#endif /* !MIN */ +#endif /* !MIN */ #define SWAP16(_x) \ ({ \ @@ -82,7 +82,7 @@ typedef int64_t s64; #define AFL_R(x) (random() % (x)) #else #define R(x) (random() % (x)) -#endif /* ^AFL_LLVM_PASS */ +#endif /* ^AFL_LLVM_PASS */ #define STRINGIFY_INTERNAL(x) #x #define STRINGIFY(x) STRINGIFY_INTERNAL(x) @@ -97,5 +97,5 @@ typedef int64_t s64; #define unlikely(_x) __builtin_expect(!!(_x), 0) #endif -#endif /* ! _HAVE_TYPES_H */ +#endif /* ! _HAVE_TYPES_H */ diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 256506be..8834a1fc 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -30,11 +30,11 @@ #ifndef PAGE_SIZE #define PAGE_SIZE 4096 -#endif /* !PAGE_SIZE */ +#endif /* !PAGE_SIZE */ #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON -#endif /* !MAP_ANONYMOUS */ +#endif /* !MAP_ANONYMOUS */ /* Error / message handling: */ diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c index 51c36c4d..17b6190c 100644 --- a/libtokencap/libtokencap.so.c +++ b/libtokencap/libtokencap.so.c @@ -28,7 +28,7 @@ #ifndef __linux__ #error "Sorry, this library is Linux-specific for now!" -#endif /* !__linux__ */ +#endif /* !__linux__ */ /* Mapping data and such */ diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c index ed320716..2c25f4de 100644 --- a/llvm_mode/afl-clang-fast.c +++ b/llvm_mode/afl-clang-fast.c @@ -183,7 +183,7 @@ static void edit_params(u32 argc, char** argv) { cc_params[cc_par_cnt++] = alloc_printf("%s/libLLVMInsTrim.so", obj_path); else cc_params[cc_par_cnt++] = alloc_printf("%s/afl-llvm-pass.so", obj_path); -#endif /* ^USE_TRACE_PC */ +#endif /* ^USE_TRACE_PC */ cc_params[cc_par_cnt++] = "-Qunused-arguments"; @@ -256,7 +256,7 @@ static void edit_params(u32 argc, char** argv) { if (getenv("AFL_INST_RATIO")) FATAL("AFL_INST_RATIO not available at compile time with 'trace-pc'."); -#endif /* USE_TRACE_PC */ +#endif /* USE_TRACE_PC */ if (!getenv("AFL_DONT_OPTIMIZE")) { @@ -315,7 +315,7 @@ static void edit_params(u32 argc, char** argv) { #else "__attribute__((visibility(\"default\"))) " "int _L(unsigned int) __asm__(\"__afl_persistent_loop\"); " -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ "_L(_A); })"; cc_params[cc_par_cnt++] = @@ -329,7 +329,7 @@ static void edit_params(u32 argc, char** argv) { #else "__attribute__((visibility(\"default\"))) " "void _I(void) __asm__(\"__afl_manual_init\"); " -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ "_I(); } while (0)"; if (maybe_linking) { @@ -382,7 +382,7 @@ int main(int argc, char** argv) { " [tpcg] by \n"); #else SAYF(cCYA "afl-clang-fast" VERSION cRST " by \n"); -#endif /* ^USE_TRACE_PC */ +#endif /* ^USE_TRACE_PC */ } diff --git a/llvm_mode/afl-llvm-rt.o.c b/llvm_mode/afl-llvm-rt.o.c index 8d435d21..20b34336 100644 --- a/llvm_mode/afl-llvm-rt.o.c +++ b/llvm_mode/afl-llvm-rt.o.c @@ -45,7 +45,7 @@ #define CONST_PRIO 5 #else #define CONST_PRIO 0 -#endif /* ^USE_TRACE_PC */ +#endif /* ^USE_TRACE_PC */ #include #include diff --git a/qemu_mode/libcompcov/libcompcov.so.c b/qemu_mode/libcompcov/libcompcov.so.c index 9d61848e..dd9e2773 100644 --- a/qemu_mode/libcompcov/libcompcov.so.c +++ b/qemu_mode/libcompcov/libcompcov.so.c @@ -34,7 +34,7 @@ #ifndef __linux__ #error "Sorry, this library is Linux-specific for now!" -#endif /* !__linux__ */ +#endif /* !__linux__ */ /* Change this value to tune the compare coverage */ diff --git a/qemu_mode/patches/afl-qemu-tcg-inl.h b/qemu_mode/patches/afl-qemu-tcg-inl.h index d53a1ccf..d45ffac9 100644 --- a/qemu_mode/patches/afl-qemu-tcg-inl.h +++ b/qemu_mode/patches/afl-qemu-tcg-inl.h @@ -103,7 +103,7 @@ void tcg_gen_afl_maybe_log_call(target_ulong cur_loc) { } -#endif /* TCG_TARGET_EXTEND_ARGS */ +#endif /* TCG_TARGET_EXTEND_ARGS */ op = tcg_emit_op(INDEX_op_call); @@ -187,7 +187,7 @@ void tcg_gen_afl_maybe_log_call(target_ulong cur_loc) { #elif defined(TCG_TARGET_EXTEND_ARGS) && TCG_TARGET_REG_BITS == 64 int is_64bit = sizemask & (1 << 2); if (!is_64bit) { tcg_temp_free_internal(arg); } -#endif /* TCG_TARGET_EXTEND_ARGS */ +#endif /* TCG_TARGET_EXTEND_ARGS */ } @@ -270,7 +270,7 @@ void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, } -#endif /* TCG_TARGET_EXTEND_ARGS */ +#endif /* TCG_TARGET_EXTEND_ARGS */ op = tcg_emit_op(INDEX_op_call); @@ -367,7 +367,7 @@ void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, } -#endif /* TCG_TARGET_EXTEND_ARGS */ +#endif /* TCG_TARGET_EXTEND_ARGS */ } diff --git a/src/afl-analyze.c b/src/afl-analyze.c index 7b647595..357672b1 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -3,7 +3,7 @@ ------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -85,14 +85,14 @@ static volatile u8 stop_soon, /* Ctrl-C pressed? */ /* Constants used for describing byte behavior. */ -#define RESP_NONE 0x00 /* Changing byte is a no-op. */ -#define RESP_MINOR 0x01 /* Some changes have no effect. */ -#define RESP_VARIABLE 0x02 /* Changes produce variable paths. */ -#define RESP_FIXED 0x03 /* Changes produce fixed patterns. */ +#define RESP_NONE 0x00 /* Changing byte is a no-op. */ +#define RESP_MINOR 0x01 /* Some changes have no effect. */ +#define RESP_VARIABLE 0x02 /* Changes produce variable paths. */ +#define RESP_FIXED 0x03 /* Changes produce fixed patterns. */ -#define RESP_LEN 0x04 /* Potential length field */ -#define RESP_CKSUM 0x05 /* Potential checksum */ -#define RESP_SUSPECT 0x06 /* Potential "suspect" blob */ +#define RESP_LEN 0x04 /* Potential length field */ +#define RESP_CKSUM 0x05 /* Potential checksum */ +#define RESP_SUSPECT 0x06 /* Potential "suspect" blob */ /* Classify tuple counts. This is a slow & naive version, but good enough here. */ @@ -260,7 +260,7 @@ static u32 run_target(char** argv, u8* mem, u32 len, u8 first_run) { setrlimit(RLIMIT_DATA, &r); /* Ignore errors */ -#endif /* ^RLIMIT_AS */ +#endif /* ^RLIMIT_AS */ } @@ -371,7 +371,7 @@ static void show_legend(void) { } -#endif /* USE_COLOR */ +#endif /* USE_COLOR */ /* Interpret and report a pattern in the input file. */ @@ -385,7 +385,7 @@ static void dump_hex(u8* buf, u32 len, u8* b_data) { u32 rlen = 1, off; #else u32 rlen = 1; -#endif /* ^USE_COLOR */ +#endif /* ^USE_COLOR */ u8 rtype = b_data[i] & 0x0f; @@ -527,7 +527,7 @@ static void dump_hex(u8* buf, u32 len, u8* b_data) { } -#endif /* ^USE_COLOR */ +#endif /* ^USE_COLOR */ i += rlen - 1; @@ -535,7 +535,7 @@ static void dump_hex(u8* buf, u32 len, u8* b_data) { #ifdef USE_COLOR SAYF(cRST "\n"); -#endif /* USE_COLOR */ +#endif /* USE_COLOR */ } @@ -555,7 +555,7 @@ static void analyze(char** argv) { #ifdef USE_COLOR show_legend(); -#endif /* USE_COLOR */ +#endif /* USE_COLOR */ for (i = 0; i < in_len; i++) { diff --git a/src/afl-as.c b/src/afl-as.c index fed1882b..b5a5ed58 100644 --- a/src/afl-as.c +++ b/src/afl-as.c @@ -3,7 +3,7 @@ ----------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -81,9 +81,9 @@ static u8 use_64bit = 0; #ifdef __APPLE__ #error "Sorry, 32-bit Apple platforms are not supported." -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ /* Examine and modify parameters to pass to 'as'. Note that the file name is always the last parameter passed by GCC, so we exploit this property @@ -120,7 +120,7 @@ static void edit_params(int argc, char** argv) { } -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ /* Although this is not documented, GCC also uses TEMP and TMP when TMPDIR is not set. We need to check these non-standard variables to properly @@ -162,7 +162,7 @@ static void edit_params(int argc, char** argv) { if (clang_mode && (!strcmp(argv[i], "-q") || !strcmp(argv[i], "-Q"))) continue; -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ as_params[as_par_cnt++] = argv[i]; @@ -181,7 +181,7 @@ static void edit_params(int argc, char** argv) { } -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ input_file = argv[argc - 1]; @@ -242,7 +242,7 @@ static void add_instrumentation(void) { u8* colon_pos; -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ if (input_file) { @@ -413,7 +413,7 @@ static void add_instrumentation(void) { if (line[0] == '.') { -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ /* .L0: or LBB0_0: style jump destination */ @@ -432,7 +432,7 @@ static void add_instrumentation(void) { (clang_mode && !strncmp(line + 1, "LBB", 3))) && R(100) < inst_ratio) { -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ /* An optimization is possible here by adding the code only if the label is mentioned in the code in contexts other than call / jmp. diff --git a/src/afl-common.c b/src/afl-common.c index 7859a74f..62722cb9 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -3,7 +3,7 @@ -------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c index 2a4e0819..f2f3c0f0 100644 --- a/src/afl-forkserver.c +++ b/src/afl-forkserver.c @@ -3,9 +3,9 @@ -------------------------------------- Originally written by Michal Zalewski - + Forkserver design by Jann Horn - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -187,7 +187,7 @@ void init_forkserver(char **argv) { maps - so we should be getting good protection against OOM bugs. */ setrlimit(RLIMIT_DATA, &r); /* Ignore errors */ -#endif /* ^RLIMIT_AS */ +#endif /* ^RLIMIT_AS */ } diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index 34e1dacb..d867a318 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -3,7 +3,7 @@ ---------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -87,7 +87,7 @@ u8 has_new_bits(u8* virgin_map) { u32 i = (MAP_SIZE >> 2); -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ u8 ret = 0; @@ -125,7 +125,7 @@ u8 has_new_bits(u8* virgin_map) { else ret = 1; -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ } @@ -306,7 +306,7 @@ void simplify_trace(u32* mem) { } -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ /* Destructively classify execution counts in a trace. This is used as a preprocessing step for any newly acquired traces. Called on every exec, @@ -391,7 +391,7 @@ void classify_counts(u32* mem) { } -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ /* Compact trace bytes into a smaller bitmap. We effectively just drop the count information here. This is called only sporadically, for some @@ -453,7 +453,7 @@ u8* describe_op(u8 hnb) { } -#endif /* !SIMPLE_FILES */ +#endif /* !SIMPLE_FILES */ /* Write a message accompanying the crash directory :-) */ @@ -551,7 +551,7 @@ u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) { fn = alloc_printf("%s/queue/id_%06u", out_dir, queued_paths); -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ add_to_queue(fn, len, 0); @@ -599,7 +599,7 @@ u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) { simplify_trace((u64*)trace_bits); #else simplify_trace((u32*)trace_bits); -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ if (!has_new_bits(virgin_tmout)) return keeping; @@ -636,7 +636,7 @@ u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) { fn = alloc_printf("%s/hangs/id_%06llu", out_dir, unique_hangs); -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ ++unique_hangs; @@ -662,7 +662,7 @@ u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) { simplify_trace((u64*)trace_bits); #else simplify_trace((u32*)trace_bits); -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ if (!has_new_bits(virgin_crash)) return keeping; @@ -680,7 +680,7 @@ u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) { fn = alloc_printf("%s/crashes/id_%06llu_%02u", out_dir, unique_crashes, kill_signal); -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ ++unique_crashes; diff --git a/src/afl-fuzz-extras.c b/src/afl-fuzz-extras.c index 97f3ac5c..1a0e2eff 100644 --- a/src/afl-fuzz-extras.c +++ b/src/afl-fuzz-extras.c @@ -3,7 +3,7 @@ ---------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/src/afl-fuzz-globals.c b/src/afl-fuzz-globals.c index 0d073154..9aaa03cc 100644 --- a/src/afl-fuzz-globals.c +++ b/src/afl-fuzz-globals.c @@ -3,7 +3,7 @@ ------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -220,7 +220,7 @@ s32 cpu_core_count; /* CPU core count */ s32 cpu_aff = -1; /* Selected CPU core */ -#endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ FILE *plot_file; /* Gnuplot output file */ diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index b45d3783..55464a36 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -3,7 +3,7 @@ ------------------------------------------------------ Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -142,7 +142,7 @@ void bind_to_free_cpu(void) { } -#endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ /* Load postprocessor, if available. */ @@ -651,7 +651,7 @@ void pivot_inputs(void) { nfn = alloc_printf("%s/queue/id_%06u", out_dir, id); -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ } @@ -827,7 +827,7 @@ double get_runnable_processes(void) { } -#endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */ +#endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */ return res; @@ -901,7 +901,7 @@ void maybe_delete_out_dir(void) { } -#endif /* !__sun */ +#endif /* !__sun */ f = fopen(fn, "r"); @@ -1043,7 +1043,7 @@ void maybe_delete_out_dir(void) { t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ rename(fn, nfn); /* Ignore errors. */ ck_free(nfn); @@ -1074,7 +1074,7 @@ void maybe_delete_out_dir(void) { t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); -#endif /* ^!SIMPLE_FILES */ +#endif /* ^!SIMPLE_FILES */ rename(fn, nfn); /* Ignore errors. */ ck_free(nfn); @@ -1174,7 +1174,7 @@ void setup_dirs_fds(void) { if (out_dir_fd < 0 || flock(out_dir_fd, LOCK_EX | LOCK_NB)) PFATAL("Unable to flock() output directory."); -#endif /* !__sun */ +#endif /* !__sun */ } @@ -1390,7 +1390,7 @@ void check_crash_handling(void) { close(fd); -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ } @@ -1504,7 +1504,7 @@ void get_core_count(void) { if (sysctl(s_name, 2, &cpu_core_count, &s, NULL, 0) < 0) return; -#endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ #else @@ -1524,9 +1524,9 @@ void get_core_count(void) { fclose(f); -#endif /* ^HAVE_AFFINITY */ +#endif /* ^HAVE_AFFINITY */ -#endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */ +#endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */ if (cpu_core_count > 0) { @@ -1540,7 +1540,7 @@ void get_core_count(void) { ++cur_runnable; -#endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */ +#endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */ OKF("You have %d CPU core%s and %u runnable tasks (utilization: %0.0f%%).", cpu_core_count, cpu_core_count > 1 ? "s" : "", cur_runnable, @@ -1780,7 +1780,7 @@ void check_binary(u8* fname) { FATAL("Program '%s' is not a 64-bit Mach-O binary", target_path); #endif -#endif /* ^!__APPLE__ */ +#endif /* ^!__APPLE__ */ if (!qemu_mode && !unicorn_mode && !dumb_mode && !memmem(f_data, f_len, SHM_ENV_VAR, strlen(SHM_ENV_VAR) + 1)) { diff --git a/src/afl-fuzz-misc.c b/src/afl-fuzz-misc.c index 09b02345..a7372b7d 100644 --- a/src/afl-fuzz-misc.c +++ b/src/afl-fuzz-misc.c @@ -3,7 +3,7 @@ ---------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index 6dc7b658..9a7a5938 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -3,7 +3,7 @@ --------------------------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -328,7 +328,7 @@ static void locate_diffs(u8* ptr1, u8* ptr2, u32 len, s32* first, s32* last) { } -#endif /* !IGNORE_FINDS */ +#endif /* !IGNORE_FINDS */ /* Take the current entry from the queue, fuzz it for a while. This function is a tad too long... returns 0 if fuzzed successfully, 1 if @@ -385,7 +385,7 @@ u8 fuzz_one_original(char** argv) { } -#endif /* ^IGNORE_FINDS */ +#endif /* ^IGNORE_FINDS */ if (not_on_tty) { @@ -2253,7 +2253,7 @@ retry_splicing: } -#endif /* !IGNORE_FINDS */ +#endif /* !IGNORE_FINDS */ ret_val = 0; @@ -2337,7 +2337,7 @@ u8 pilot_fuzzing(char** argv) { } -#endif /* ^IGNORE_FINDS */ +#endif /* ^IGNORE_FINDS */ if (not_on_tty) { @@ -4015,7 +4015,7 @@ pacemaker_fuzzing: } -#endif /* !IGNORE_FINDS */ +#endif /* !IGNORE_FINDS */ ret_val = 0; @@ -4198,7 +4198,7 @@ u8 core_fuzzing(char** argv) { } -#endif /* ^IGNORE_FINDS */ +#endif /* ^IGNORE_FINDS */ if (not_on_tty) { @@ -5860,7 +5860,7 @@ pacemaker_fuzzing: } -#endif /* !IGNORE_FINDS */ +#endif /* !IGNORE_FINDS */ ret_val = 0; abandon_entry: diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c index 9a1309e0..1a28f603 100644 --- a/src/afl-fuzz-python.c +++ b/src/afl-fuzz-python.c @@ -3,7 +3,7 @@ ------------------------------------------------ Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -401,5 +401,5 @@ abort_trimming: } -#endif /* USE_PYTHON */ +#endif /* USE_PYTHON */ diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index a77b5799..905fd931 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -3,7 +3,7 @@ --------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c index 9f4fafe4..3c3a1d37 100644 --- a/src/afl-fuzz-run.c +++ b/src/afl-fuzz-run.c @@ -3,7 +3,7 @@ -------------------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -73,7 +73,7 @@ u8 run_target(char** argv, u32 timeout) { setrlimit(RLIMIT_DATA, &r); /* Ignore errors */ -#endif /* ^RLIMIT_AS */ +#endif /* ^RLIMIT_AS */ } @@ -210,7 +210,7 @@ u8 run_target(char** argv, u32 timeout) { classify_counts((u64*)trace_bits); #else classify_counts((u32*)trace_bits); -#endif /* ^__x86_64__ */ +#endif /* ^__x86_64__ */ prev_timed_out = child_timed_out; diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c index e68dc980..7f171279 100644 --- a/src/afl-fuzz-stats.c +++ b/src/afl-fuzz-stats.c @@ -3,7 +3,7 @@ --------------------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -310,7 +310,7 @@ void show_stats(void) { sprintf(tmp + banner_pad, "%s " cLCY VERSION cLGN " (%s) " cPIN "[%s]", crash_mode ? cPIN "peruvian were-rabbit" : cYEL "american fuzzy lop", use_banner, power_name); -#endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ SAYF("\n%s\n", tmp); @@ -674,7 +674,7 @@ void show_stats(void) { SAYF(SP10 cGRA " [cpu:%s%3u%%" cGRA "]\r" cRST, cpu_color, MIN(cur_utilization, 999)); -#endif /* ^HAVE_AFFINITY */ +#endif /* ^HAVE_AFFINITY */ } else diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 398d1b80..e94116f5 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -3,7 +3,7 @@ -------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -621,7 +621,7 @@ int main(int argc, char** argv) { #ifdef HAVE_AFFINITY bind_to_free_cpu(); -#endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ check_crash_handling(); check_cpu_governor(); @@ -880,5 +880,5 @@ stop_fuzzing: } -#endif /* !AFL_LIB */ +#endif /* !AFL_LIB */ diff --git a/src/afl-gcc.c b/src/afl-gcc.c index 08705a36..2dc17baf 100644 --- a/src/afl-gcc.c +++ b/src/afl-gcc.c @@ -3,7 +3,7 @@ ------------------------------------------------ Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -201,7 +201,7 @@ static void edit_params(u32 argc, char** argv) { } -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ } diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c index 6ca129c2..a39659bb 100644 --- a/src/afl-gotcpu.c +++ b/src/afl-gotcpu.c @@ -3,7 +3,7 @@ ----------------------------------- Originally written by Michal Zalewski - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -54,7 +54,7 @@ #ifdef __linux__ #define HAVE_AFFINITY 1 -#endif /* __linux__ */ +#endif /* __linux__ */ /* Get unix time in microseconds. */ @@ -255,7 +255,7 @@ int main(int argc, char** argv) { return (util_perc > 105) + (util_perc > 130); -#endif /* ^HAVE_AFFINITY */ +#endif /* ^HAVE_AFFINITY */ } diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c index 9fd5fb01..0bd1ff2f 100644 --- a/src/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -3,9 +3,9 @@ ------------------------------------------------- Originally written by Michal Zalewski - + Forkserver design by Jann Horn - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 649684d3..f3b6c561 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -3,9 +3,9 @@ ------------------------------------------ Originally written by Michal Zalewski - + Forkserver design by Jann Horn - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi @@ -261,7 +261,7 @@ static void run_target(char** argv) { setrlimit(RLIMIT_DATA, &r); /* Ignore errors */ -#endif /* ^RLIMIT_AS */ +#endif /* ^RLIMIT_AS */ } diff --git a/src/afl-tmin.c b/src/afl-tmin.c index a33966a0..a501b068 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -3,9 +3,9 @@ ------------------------------------------ Originally written by Michal Zalewski - + Forkserver design by Jann Horn - + Now maintained by by Marc Heuse , Heiko Eißfeldt and Andrea Fioraldi -- cgit 1.4.1