From b5573b3adbe01681156598ce064c228c0140f782 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Thu, 25 Jun 2020 10:33:59 +0200 Subject: add seek power schedule, remove update stats in calibration, fix help output --- src/afl-fuzz-queue.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/afl-fuzz-queue.c') diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 0e8c8e47..4c6eb88f 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -201,8 +201,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { else fuzz_p2 = q->fuzz_level; - if (unlikely(afl->schedule == MMOPT || afl->schedule == RARE) || - unlikely(afl->fixed_seed)) { + if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) { fav_factor = q->len << 2; @@ -228,8 +227,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { else top_rated_fuzz_p2 = afl->top_rated[i]->fuzz_level; - if (unlikely(afl->schedule == MMOPT || afl->schedule == RARE) || - unlikely(afl->fixed_seed)) { + if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) { top_rated_fav_factor = afl->top_rated[i]->len << 2; @@ -250,8 +248,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { } - if (unlikely(afl->schedule == MMOPT || afl->schedule == RARE) || - unlikely(afl->fixed_seed)) { + if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) { if (fav_factor > afl->top_rated[i]->len << 2) { continue; } @@ -396,8 +393,7 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) { // Longer execution time means longer work on the input, the deeper in // coverage, the better the fuzzing, right? -mh - if (afl->schedule != MMOPT && afl->schedule != RARE && - likely(!afl->fixed_seed)) { + if (afl->schedule >= RARE && likely(!afl->fixed_seed)) { if (q->exec_us * 0.1 > avg_exec_us) { @@ -509,6 +505,9 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) { case EXPLORE: break; + case SEEK: + break; + case EXPLOIT: factor = MAX_FACTOR; break; -- cgit 1.4.1 From 8bd8442bcc5a57a6ce5461e26cd957b343a12fc2 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Thu, 25 Jun 2020 22:44:46 +0200 Subject: fix for schedules --- src/afl-fuzz-bitmap.c | 2 +- src/afl-fuzz-queue.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/afl-fuzz-queue.c') diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index f643b5c0..aa8d5a18 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -559,7 +559,7 @@ u8 save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) { if (q->exec_cksum == cksum) { - q->n_fuzz = q->n_fuzz + 1; + ++q->n_fuzz; break; } diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 4c6eb88f..7afdd9f1 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -196,7 +196,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { u64 fav_factor; u64 fuzz_p2; - if (unlikely(afl->schedule >= FAST)) + if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) fuzz_p2 = next_pow2(q->n_fuzz); else fuzz_p2 = q->fuzz_level; @@ -222,7 +222,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { /* Faster-executing or smaller test cases are favored. */ u64 top_rated_fav_factor; u64 top_rated_fuzz_p2; - if (unlikely(afl->schedule >= FAST)) + if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) top_rated_fuzz_p2 = next_pow2(afl->top_rated[i]->n_fuzz); else top_rated_fuzz_p2 = afl->top_rated[i]->fuzz_level; @@ -601,7 +601,7 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) { } - if (unlikely(afl->schedule >= FAST)) { + if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) { if (factor > MAX_FACTOR) { factor = MAX_FACTOR; } perf_score *= factor / POWER_BETA; -- cgit 1.4.1