From 6b40189045645938098772260ecda1c0bcbf6467 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Thu, 12 Sep 2019 12:34:53 +0200 Subject: first version of persistent QEMU --- src/afl-analyze.c | 2 +- src/afl-forkserver.c | 2 +- src/afl-fuzz-one.c | 13 +++++++------ src/afl-fuzz-run.c | 6 ++++-- src/afl-fuzz.c | 2 +- src/afl-gcc.c | 8 ++++++-- src/afl-gotcpu.c | 2 ++ src/afl-showmap.c | 2 +- src/afl-tmin.c | 2 +- 9 files changed, 24 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/afl-analyze.c b/src/afl-analyze.c index e30f53b8..4b157973 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -988,7 +988,7 @@ int main(int argc, char** argv) { unicorn_mode = 1; break; - + case 'h': usage(argv[0]); return -1; diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c index 6c27d0f9..d9f67da5 100644 --- a/src/afl-forkserver.c +++ b/src/afl-forkserver.c @@ -44,7 +44,7 @@ extern u8 uses_asan; extern u8 *trace_bits; extern s32 forksrv_pid, child_pid, fsrv_ctl_fd, fsrv_st_fd; -extern s32 out_fd, out_dir_fd, dev_null_fd; /* initialize these with -1 */ +extern s32 out_fd, out_dir_fd, dev_null_fd; /* initialize these with -1 */ #ifndef HAVE_ARC4RANDOM extern s32 dev_urandom_fd; #endif diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index fff0c96a..35dfd680 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -2288,13 +2288,14 @@ abandon_entry: } struct { - u64 *finds; - u64 *finds_v2; - u64 *cycles; - u64 *cycles_v2; - u64 *cycles_v3; -} MOpt_globals; + u64* finds; + u64* finds_v2; + u64* cycles; + u64* cycles_v2; + u64* cycles_v3; + +} MOpt_globals; #define AFL_PILOT_FUZZ #define common_fuzzing pilot_fuzzing diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c index 37a04e44..f2f663dc 100644 --- a/src/afl-fuzz-run.c +++ b/src/afl-fuzz-run.c @@ -253,7 +253,8 @@ void write_to_testcase(void* mem, u32 len) { if (out_file) { - //unlink(out_file); /* Ignore errors. */ + // unlink(out_file); /* Ignore errors. + // */ fd = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); @@ -295,7 +296,8 @@ void write_with_gap(void* mem, u32 len, u32 skip_at, u32 skip_len) { if (out_file) { - //unlink(out_file); /* Ignore errors. */ + // unlink(out_file); /* Ignore errors. + // */ fd = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index eb0060a4..2d16345a 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -493,7 +493,7 @@ int main(int argc, char** argv) { case 'h': usage(argv[0]); return -1; - break; // not needed + break; // not needed default: usage(argv[0]); diff --git a/src/afl-gcc.c b/src/afl-gcc.c index 2f72ef34..8982ca97 100644 --- a/src/afl-gcc.c +++ b/src/afl-gcc.c @@ -334,11 +334,15 @@ static void edit_params(u32 argc, char** argv) { int main(int argc, char** argv) { if (argc == 2 && strcmp(argv[1], "-h") == 0) { - printf("afl-cc" VERSION" by \n\n"); + + printf("afl-cc" VERSION " by \n\n"); printf("%s \n\n", argv[0]); printf("afl-gcc has no command line options\n"); - printf("NOTE: afl-gcc is deprecated, llvm_mode is much faster and has more options\n"); + printf( + "NOTE: afl-gcc is deprecated, llvm_mode is much faster and has more " + "options\n"); return -1; + } if (isatty(2) && !getenv("AFL_QUIET")) { diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c index 85864c6f..de41177c 100644 --- a/src/afl-gotcpu.c +++ b/src/afl-gotcpu.c @@ -128,11 +128,13 @@ repeat_loop: int main(int argc, char** argv) { if (argc > 1) { + printf("afl-gotcpu" VERSION " by \n"); printf("\n%s \n\n", argv[0]); printf("afl-gotcpu does not have command line options\n"); printf("afl-gotcpu prints out which CPUs are available\n"); return -1; + } #ifdef HAVE_AFFINITY diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 6aa72746..bf9306d5 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -691,7 +691,7 @@ int main(int argc, char** argv) { if (edges_only) FATAL("-e and -r are mutually exclusive"); raw_instr_output = 1; break; - + case 'h': usage(argv[0]); return -1; diff --git a/src/afl-tmin.c b/src/afl-tmin.c index baf22557..8308d98d 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -1211,7 +1211,7 @@ int main(int argc, char** argv) { mask_bitmap = ck_alloc(MAP_SIZE); read_bitmap(optarg); break; - + case 'h': usage(argv[0]); return -1; -- cgit 1.4.1