fix a few cur_time uses

This commit is contained in:
vanhauser-thc
2021-05-11 22:06:37 +02:00
parent 8929da3391
commit 72ca9b4684
5 changed files with 20 additions and 14 deletions

View File

@ -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!

View File

@ -1574,12 +1574,12 @@ int main(int argc, char **argv, char **envp) {
else if (have_gcc_plugin)
compiler_mode = GCC_PLUGIN;
else if (have_gcc)
#ifdef __APPLE__
#ifdef __APPLE__
// on OSX clang masquerades as GCC
compiler_mode = CLANG;
#else
#else
compiler_mode = GCC;
#endif
#endif
else if (have_lto)
compiler_mode = LTO;
else
@ -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) {

View File

@ -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)) {

View File

@ -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,

View File

@ -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) {