aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-05-11 22:06:37 +0200
committervanhauser-thc <vh@thc.org>2021-05-11 22:06:37 +0200
commit72ca9b4684981ce2b807e4efd218bd1924f3e6b1 (patch)
tree1fe283283e5e8493e9e526acd50aad157446fceb
parent8929da339191152cdc69e4c99ddeaeff6d0bc777 (diff)
downloadafl++-72ca9b4684981ce2b807e4efd218bd1924f3e6b1.tar.gz
fix a few cur_time uses
-rw-r--r--docs/Changelog.md1
-rw-r--r--src/afl-cc.c16
-rw-r--r--src/afl-fuzz-one.c6
-rw-r--r--src/afl-fuzz-stats.c5
-rw-r--r--src/afl-fuzz.c6
5 files changed, 20 insertions, 14 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index ceb02bb9..e4c02921 100644
--- a/docs/Changelog.md
+++ b/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!
diff --git a/src/afl-cc.c b/src/afl-cc.c
index c1050355..ff7b5219 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -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__
- // on OSX clang masquerades as GCC
- compiler_mode = CLANG;
- #else
- compiler_mode = GCC;
- #endif
+#ifdef __APPLE__
+ // on OSX clang masquerades as GCC
+ compiler_mode = CLANG;
+#else
+ compiler_mode = GCC;
+#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
+ setenv(CLANG_ENV_VAR, "1", 1); // used by afl-as
+
}
if (argc < 2 || strncmp(argv[1], "-h", 2) == 0) {
diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c
index 4eeb93de..4a3e7f33 100644
--- a/src/afl-fuzz-one.c
+++ b/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)) {
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index 313263f9..4884b942 100644
--- a/src/afl-fuzz-stats.c
+++ b/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,
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 8de3ed6b..094fd161 100644
--- a/src/afl-fuzz.c
+++ b/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) {