edges in plot file

This commit is contained in:
Andrea Fioraldi
2021-02-24 21:29:00 +01:00
parent c05d392cd9
commit 047f3436e9
4 changed files with 18 additions and 17 deletions

View File

@ -1072,8 +1072,8 @@ void destroy_extras(afl_state_t *);
void load_stats_file(afl_state_t *); void load_stats_file(afl_state_t *);
void write_setup_file(afl_state_t *, u32, char **); void write_setup_file(afl_state_t *, u32, char **);
void write_stats_file(afl_state_t *, double, double, double); void write_stats_file(afl_state_t *, u32, double, double, double);
void maybe_update_plot_file(afl_state_t *, double, double); void maybe_update_plot_file(afl_state_t *, u32, double, double);
void show_stats(afl_state_t *); void show_stats(afl_state_t *);
void show_init_stats(afl_state_t *); void show_init_stats(afl_state_t *);

View File

@ -2026,7 +2026,7 @@ void setup_dirs_fds(afl_state_t *afl) {
fprintf(afl->fsrv.plot_file, fprintf(afl->fsrv.plot_file,
"# unix_time, cycles_done, cur_path, paths_total, " "# unix_time, cycles_done, cur_path, paths_total, "
"pending_total, pending_favs, map_size, unique_crashes, " "pending_total, pending_favs, map_size, unique_crashes, "
"unique_hangs, max_depth, execs_per_sec\n"); "unique_hangs, max_depth, execs_per_sec, edges_found\n");
fflush(afl->fsrv.plot_file); fflush(afl->fsrv.plot_file);
/* ignore errors */ /* ignore errors */

View File

@ -185,15 +185,14 @@ void load_stats_file(afl_state_t *afl) {
/* Update stats file for unattended monitoring. */ /* Update stats file for unattended monitoring. */
void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability, void write_stats_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
double eps) { double stability, double eps) {
#ifndef __HAIKU__ #ifndef __HAIKU__
struct rusage rus; struct rusage rus;
#endif #endif
u64 cur_time = get_cur_time(); u64 cur_time = get_cur_time();
u32 t_bytes = count_non_255_bytes(afl, afl->virgin_bits);
u8 fn[PATH_MAX]; u8 fn[PATH_MAX];
FILE *f; FILE *f;
@ -353,7 +352,8 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
/* Update the plot file if there is a reason to. */ /* Update the plot file if there is a reason to. */
void maybe_update_plot_file(afl_state_t *afl, double bitmap_cvg, double eps) { void maybe_update_plot_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
double eps) {
if (unlikely(afl->plot_prev_qp == afl->queued_paths && if (unlikely(afl->plot_prev_qp == afl->queued_paths &&
afl->plot_prev_pf == afl->pending_favored && afl->plot_prev_pf == afl->pending_favored &&
@ -384,16 +384,16 @@ void maybe_update_plot_file(afl_state_t *afl, double bitmap_cvg, double eps) {
/* Fields in the file: /* Fields in the file:
unix_time, afl->cycles_done, cur_path, paths_total, paths_not_fuzzed, unix_time, afl->cycles_done, cur_path, paths_total, paths_not_fuzzed,
favored_not_fuzzed, afl->unique_crashes, afl->unique_hangs, afl->max_depth, favored_not_fuzzed, unique_crashes, unique_hangs, max_depth,
execs_per_sec */ execs_per_sec, edges_found */
fprintf( fprintf(
afl->fsrv.plot_file, afl->fsrv.plot_file,
"%llu, %llu, %u, %u, %u, %u, %0.02f%%, %llu, %llu, %u, %0.02f, %llu\n", "%llu, %llu, %u, %u, %u, %u, %0.02f%%, %llu, %llu, %u, %0.02f, %llu, %u\n",
get_cur_time() / 1000, afl->queue_cycle - 1, afl->current_entry, get_cur_time() / 1000, afl->queue_cycle - 1, afl->current_entry,
afl->queued_paths, afl->pending_not_fuzzed, afl->pending_favored, afl->queued_paths, afl->pending_not_fuzzed, afl->pending_favored,
bitmap_cvg, afl->unique_crashes, afl->unique_hangs, afl->max_depth, eps, bitmap_cvg, afl->unique_crashes, afl->unique_hangs, afl->max_depth, eps,
afl->plot_prev_ed); /* ignore errors */ afl->plot_prev_ed, t_bytes); /* ignore errors */
fflush(afl->fsrv.plot_file); fflush(afl->fsrv.plot_file);
@ -532,7 +532,8 @@ void show_stats(afl_state_t *afl) {
if (cur_ms - afl->stats_last_stats_ms > STATS_UPDATE_SEC * 1000) { if (cur_ms - afl->stats_last_stats_ms > STATS_UPDATE_SEC * 1000) {
afl->stats_last_stats_ms = cur_ms; afl->stats_last_stats_ms = cur_ms;
write_stats_file(afl, t_byte_ratio, stab_ratio, afl->stats_avg_exec); write_stats_file(afl, t_bytes, t_byte_ratio, stab_ratio,
afl->stats_avg_exec);
save_auto(afl); save_auto(afl);
write_bitmap(afl); write_bitmap(afl);
@ -555,7 +556,7 @@ void show_stats(afl_state_t *afl) {
if (cur_ms - afl->stats_last_plot_ms > PLOT_UPDATE_SEC * 1000) { if (cur_ms - afl->stats_last_plot_ms > PLOT_UPDATE_SEC * 1000) {
afl->stats_last_plot_ms = cur_ms; afl->stats_last_plot_ms = cur_ms;
maybe_update_plot_file(afl, t_byte_ratio, afl->stats_avg_exec); maybe_update_plot_file(afl, t_bytes, t_byte_ratio, afl->stats_avg_exec);
} }

View File

@ -1724,8 +1724,8 @@ int main(int argc, char **argv_orig, char **envp) {
afl->start_time = get_cur_time(); afl->start_time = get_cur_time();
if (afl->in_place_resume || afl->afl_env.afl_autoresume) load_stats_file(afl); if (afl->in_place_resume || afl->afl_env.afl_autoresume) load_stats_file(afl);
write_stats_file(afl, 0, 0, 0); write_stats_file(afl, 0, 0, 0, 0);
maybe_update_plot_file(afl, 0, 0); maybe_update_plot_file(afl, 0, 0, 0);
save_auto(afl); save_auto(afl);
if (afl->stop_soon) { goto stop_fuzzing; } if (afl->stop_soon) { goto stop_fuzzing; }
@ -2018,12 +2018,12 @@ int main(int argc, char **argv_orig, char **envp) {
} }
write_bitmap(afl); write_bitmap(afl);
maybe_update_plot_file(afl, 0, 0); maybe_update_plot_file(afl, 0, 0, 0);
save_auto(afl); save_auto(afl);
stop_fuzzing: stop_fuzzing:
write_stats_file(afl, 0, 0, 0); write_stats_file(afl, 0, 0, 0, 0);
afl->force_ui_update = 1; // ensure the screen is reprinted afl->force_ui_update = 1; // ensure the screen is reprinted
show_stats(afl); // print the screen one last time show_stats(afl); // print the screen one last time