fix a few cur_time uses
MODIFY
docs/Changelog.md
docs/Changelog.md
@@ -9,6 +9,7 @@ Want to stay in the loop on major new features? Join our mailing list by
sending a mail to <afl-users+subscribe@googlegroups.com>.
### Version ++3.13a (development)
+ - Note: plot_data switched to relative time from unix time in 3.10
- frida_mode - new mode that uses frida to fuzz binary-only targets,
it currently supports persistent mode and cmplog.
thanks to @WorksButNotTested!

MODIFY
src/afl-cc.c
src/afl-cc.c
@@ -1602,8 +1602,10 @@ int main(int argc, char **argv, char **envp) {
}
if (compiler_mode == CLANG) {
+
instrument_mode = INSTRUMENT_CLANG;
setenv(CLANG_ENV_VAR, "1", 1); // used by afl-as
+
}
if (argc < 2 || strncmp(argv[1], "-h", 2) == 0) {

MODIFY
src/afl-fuzz-one.c
src/afl-fuzz-one.c
@@ -562,7 +562,7 @@ u8 fuzz_one_original(afl_state_t *afl) {
if (afl->cmplog_lvl == 3 ||
(afl->cmplog_lvl == 2 && afl->queue_cur->tc_ref) ||
!(afl->fsrv.total_execs % afl->queued_paths) ||
- get_cur_time() - afl->last_path_time > 300000) {
+ get_cur_time() - afl->last_path_time > 300000) { // 300 seconds
if (input_to_state_stage(afl, in_buf, out_buf, len)) {
@@ -2013,7 +2013,7 @@ havoc_stage:
}
- if (unlikely(get_cur_time() - afl->last_path_time > 5000 &&
+ if (unlikely(get_cur_time() - afl->last_path_time > 5000 /* 5 seconds */ &&
afl->ready_for_splicing_count > 1)) {
/* add expensive havoc cases here if there is no findings in the last 5s */
@@ -3060,7 +3060,7 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
if (afl->cmplog_lvl == 3 ||
(afl->cmplog_lvl == 2 && afl->queue_cur->tc_ref) ||
!(afl->fsrv.total_execs % afl->queued_paths) ||
- get_cur_time() - afl->last_path_time > 300000) {
+ get_cur_time() - afl->last_path_time > 300000) { // 300 seconds
if (input_to_state_stage(afl, in_buf, out_buf, len)) {

MODIFY
src/afl-fuzz-stats.c
src/afl-fuzz-stats.c
@@ -368,7 +368,8 @@ void maybe_update_plot_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
afl->plot_prev_uh == afl->unique_hangs &&
afl->plot_prev_md == afl->max_depth &&
afl->plot_prev_ed == afl->fsrv.total_execs) ||
- !afl->queue_cycle || get_cur_time() - afl->start_time <= 60))) {
+ !afl->queue_cycle ||
+ get_cur_time() - afl->start_time <= 60000))) {
return;
@@ -393,7 +394,7 @@ void maybe_update_plot_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
fprintf(afl->fsrv.plot_file,
"%llu, %llu, %u, %u, %u, %u, %0.02f%%, %llu, %llu, %u, %0.02f, %llu, "
"%u\n",
- (afl->prev_run_time + get_cur_time() - afl->start_time),
+ ((afl->prev_run_time + get_cur_time() - afl->start_time) / 1000),
afl->queue_cycle - 1, afl->current_entry, afl->queued_paths,
afl->pending_not_fuzzed, afl->pending_favored, bitmap_cvg,
afl->unique_crashes, afl->unique_hangs, afl->max_depth, eps,

MODIFY
src/afl-fuzz.c
src/afl-fuzz.c
@@ -1940,8 +1940,10 @@ int main(int argc, char **argv_orig, char **envp) {
/* If we had a full queue cycle with no new finds, try
recombination strategies next. */
- if (unlikely(afl->queued_paths == prev_queued &&
- (get_cur_time() - afl->start_time) >= 3600)) {
+ if (unlikely(afl->queued_paths == prev_queued
+ /* FIXME TODO BUG: && (get_cur_time() - afl->start_time) >=
+ 3600 */
+ )) {
if (afl->use_splicing) {

fix a few cur_time uses