Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ script:
then ./afl-fuzz -i seeds -o out/ -- ./test-instr-gcc;
else timeout --preserve-status 5s ./afl-fuzz -i seeds -o out/ -- ./test-instr-gcc;
fi
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 1450 -p 500
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 1 -p 3
- rm -r out/*
- ./afl-clang ./test-instr.c -o test-instr-clang
- if [ -z "$AFL_STOP_MANUALLY" ];
then ./afl-fuzz -i seeds -o out/ -- ./test-instr-clang;
else timeout --preserve-status 5s ./afl-fuzz -i seeds -o out/ -- ./test-instr-clang;
fi
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 1450 -p 500
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 1 -p 2
- make clean
- CC=clang CXX=clang++ make
- cd llvm_mode
Expand All @@ -41,7 +41,7 @@ script:
then ./afl-fuzz -i seeds -o out/ -- ./test-instr-clang;
else timeout --preserve-status 5s ./afl-fuzz -i seeds -o out/ -- ./test-instr-clang-fast;
fi
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 1450 -p 500
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 1 -p 3
- cd qemu_mode
- ./build_qemu_support.sh
- cd ..
Expand All @@ -50,5 +50,4 @@ script:
then ./afl-fuzz -Q -i seeds -o out/ -- ./test-no-instr;
else timeout --preserve-status 5s ./afl-fuzz -Q -i seeds -o out/ -- ./test-no-instr;
fi
- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 12000 -p 9000

- .travis/check_fuzzer_stats.sh -o out -k peak_rss_mb -v 12 -p 9
36 changes: 21 additions & 15 deletions afl-fuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -2422,11 +2422,9 @@ static u8 run_target(char** argv, u32 timeout) {

if (!WIFSTOPPED(status)) child_pid = 0;

getitimer (ITIMER_REAL, &it);
exec_ms = (u64) timeout - (it.it_value.tv_sec * 1000 + it.it_value.tv_usec / 1000);
if (slowest_exec_ms < exec_ms){
slowest_exec_ms = exec_ms;
}
getitimer(ITIMER_REAL, &it);
exec_ms = (u64) timeout - (it.it_value.tv_sec * 1000 +
it.it_value.tv_usec / 1000);

it.it_value.tv_sec = 0;
it.it_value.tv_usec = 0;
Expand Down Expand Up @@ -2474,6 +2472,12 @@ static u8 run_target(char** argv, u32 timeout) {
if ((dumb_mode == 1 || no_forkserver) && tb4 == EXEC_FAIL_SIG)
return FAULT_ERROR;

/* It makes sense to account for the slowest units only if the testcase was run
under the user defined timeout. */
if (!(timeout > exec_tmout) && (slowest_exec_ms < exec_ms)) {
slowest_exec_ms = exec_ms;
}

return FAULT_NONE;

}
Expand Down Expand Up @@ -3470,14 +3474,16 @@ static void write_stats_file(double bitmap_cvg, double stability, double eps) {
/* Get rss value from the children
We must have killed the forkserver process and called waitpid
before calling getrusage */
if (getrusage(RUSAGE_CHILDREN, &usage)){
if (getrusage(RUSAGE_CHILDREN, &usage)) {
WARNF("getrusage failed");
}
else if (usage.ru_maxrss == 0){
} else if (usage.ru_maxrss == 0) {
fprintf(f, "peak_rss_mb : not available while afl is running\n");
}
else{
fprintf(f, "peak_rss_mb : %zu\n", usage.ru_maxrss);
} else {
#ifdef __APPLE__
fprintf(f, "peak_rss_mb : %zu\n", usage.ru_maxrss >> 20);
#else
fprintf(f, "peak_rss_mb : %zu\n", usage.ru_maxrss >> 10);
#endif /* ^__APPLE__ */
}

fclose(f);
Expand Down Expand Up @@ -8094,14 +8100,14 @@ int main(int argc, char** argv) {

if (queue_cur) show_stats();

/* if we stopped programmatically, we kill the forkserver and the current runner.
if we stopped manually, this is done by the signal handler */
if (stop_soon == 2){
/* If we stopped programmatically, we kill the forkserver and the current runner.
If we stopped manually, this is done by the signal handler. */
if (stop_soon == 2) {
if (child_pid > 0) kill(child_pid, SIGKILL);
if (forksrv_pid > 0) kill(forksrv_pid, SIGKILL);
}
/* Now that we've killed the forkserver, we wait for it to be able to get rusage stats. */
if( waitpid(forksrv_pid, NULL, 0) <= 0 ) {
if (waitpid(forksrv_pid, NULL, 0) <= 0) {
WARNF("error waitpid\n");
}

Expand Down
3 changes: 3 additions & 0 deletions docs/status_screen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ directory. This includes:
- variable_paths - number of test cases showing variable behavior
- unique_crashes - number of unique crashes recorded
- unique_hangs - number of unique hangs encountered
- command_line - full command line used for the fuzzing session
- slowest_exec_ms- real time of the slowest execution in ms
Comment thread
jonathanmetzman marked this conversation as resolved.
- peak_rss_mb - max rss usage reached during fuzzing in mb

Most of these map directly to the UI elements discussed earlier on.

Expand Down