minor changes

This commit is contained in:
van Hauser
2021-01-12 17:31:29 +01:00
parent efd8042431
commit b9ba2805e5
2 changed files with 18 additions and 8 deletions

View File

@ -972,10 +972,10 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
hash64(fsrv->shmem_fuzz, *fsrv->shmem_fuzz_len, 0xa5b35705), hash64(fsrv->shmem_fuzz, *fsrv->shmem_fuzz_len, 0xa5b35705),
*fsrv->shmem_fuzz_len); *fsrv->shmem_fuzz_len);
fprintf(stderr, "SHM :"); fprintf(stderr, "SHM :");
for (int i = 0; i < *fsrv->shmem_fuzz_len; i++) for (u32 i = 0; i < *fsrv->shmem_fuzz_len; i++)
fprintf(stderr, "%02x", fsrv->shmem_fuzz[i]); fprintf(stderr, "%02x", fsrv->shmem_fuzz[i]);
fprintf(stderr, "\nORIG:"); fprintf(stderr, "\nORIG:");
for (int i = 0; i < *fsrv->shmem_fuzz_len; i++) for (u32 i = 0; i < *fsrv->shmem_fuzz_len; i++)
fprintf(stderr, "%02x", buf[i]); fprintf(stderr, "%02x", buf[i]);
fprintf(stderr, "\n"); fprintf(stderr, "\n");

View File

@ -230,10 +230,10 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at,
hash64(afl->fsrv.shmem_fuzz, *afl->fsrv.shmem_fuzz_len, 0xa5b35705), hash64(afl->fsrv.shmem_fuzz, *afl->fsrv.shmem_fuzz_len, 0xa5b35705),
*afl->fsrv.shmem_fuzz_len); *afl->fsrv.shmem_fuzz_len);
fprintf(stderr, "SHM :"); fprintf(stderr, "SHM :");
for (int i = 0; i < *afl->fsrv.shmem_fuzz_len; i++) for (u32 i = 0; i < *afl->fsrv.shmem_fuzz_len; i++)
fprintf(stderr, "%02x", afl->fsrv.shmem_fuzz[i]); fprintf(stderr, "%02x", afl->fsrv.shmem_fuzz[i]);
fprintf(stderr, "\nORIG:"); fprintf(stderr, "\nORIG:");
for (int i = 0; i < *afl->fsrv.shmem_fuzz_len; i++) for (u32 i = 0; i < *afl->fsrv.shmem_fuzz_len; i++)
fprintf(stderr, "%02x", (u8)((u8 *)mem)[i]); fprintf(stderr, "%02x", (u8)((u8 *)mem)[i]);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@ -300,7 +300,7 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
u8 fault = 0, new_bits = 0, var_detected = 0, hnb = 0, u8 fault = 0, new_bits = 0, var_detected = 0, hnb = 0,
first_run = (q->exec_cksum == 0); first_run = (q->exec_cksum == 0);
u64 start_us, stop_us; u64 start_us, stop_us, diff_us;
s32 old_sc = afl->stage_cur, old_sm = afl->stage_max; s32 old_sc = afl->stage_cur, old_sm = afl->stage_max;
u32 use_tmout = afl->fsrv.exec_tmout; u32 use_tmout = afl->fsrv.exec_tmout;
u8 *old_sn = afl->stage_name; u8 *old_sn = afl->stage_name;
@ -422,9 +422,19 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
} }
stop_us = get_cur_time_us(); if (unlikely(afl->fixed_seed)) {
afl->total_cal_us += stop_us - start_us; diff_us = (afl->fsrv.exec_tmout - 1) * afl->stage_max;
} else {
stop_us = get_cur_time_us();
diff_us = stop_us - start_us;
if (unlikely(!diff_us)) { ++diff_us; }
}
afl->total_cal_us += diff_us;
afl->total_cal_cycles += afl->stage_max; afl->total_cal_cycles += afl->stage_max;
/* OK, let's collect some stats about the performance of this test case. /* OK, let's collect some stats about the performance of this test case.
@ -437,7 +447,7 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
} }
q->exec_us = (stop_us - start_us) / afl->stage_max; q->exec_us = diff_us / afl->stage_max;
q->bitmap_size = count_bytes(afl, afl->fsrv.trace_bits); q->bitmap_size = count_bytes(afl, afl->fsrv.trace_bits);
q->handicap = handicap; q->handicap = handicap;
q->cal_failed = 0; q->cal_failed = 0;