[llvm] r285958 - [libFuzzer] fix -error_exitcode=N, now with a test

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 12:31:19 PDT 2016


Author: kcc
Date: Thu Nov  3 14:31:18 2016
New Revision: 285958

URL: http://llvm.org/viewvc/llvm-project?rev=285958&view=rev
Log:
[libFuzzer] fix -error_exitcode=N, now with a test 

Modified:
    llvm/trunk/docs/LibFuzzer.rst
    llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
    llvm/trunk/lib/Fuzzer/FuzzerFlags.def
    llvm/trunk/lib/Fuzzer/test/fuzzer-leak.test

Modified: llvm/trunk/docs/LibFuzzer.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LibFuzzer.rst?rev=285958&r1=285957&r2=285958&view=diff
==============================================================================
--- llvm/trunk/docs/LibFuzzer.rst (original)
+++ llvm/trunk/docs/LibFuzzer.rst Thu Nov  3 14:31:18 2016
@@ -240,8 +240,9 @@ The most important command line options
   The limit is checked in a separate thread every second.
   If running w/o ASAN/MSAN, you may use 'ulimit -v' instead.
 ``-timeout_exitcode``
-  Exit code (default 77) to emit when terminating due to timeout, when
-  ``-abort_on_timeout`` is not set.
+  Exit code (default 77) used if libFuzzer reports a timeout.
+``-error_exitcode``
+  Exit code (default 77) used if libFuzzer itself (not a sanitizer) reports a bug (leak, OOM, etc).
 ``-max_total_time``
   If positive, indicates the maximum total time in seconds to run the fuzzer.
   If 0 (the default), run indefinitely.

Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=285958&r1=285957&r2=285958&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Thu Nov  3 14:31:18 2016
@@ -390,6 +390,7 @@ int FuzzerDriver(int *argc, char ***argv
   Options.Verbosity = Flags.verbosity;
   Options.MaxLen = Flags.max_len;
   Options.UnitTimeoutSec = Flags.timeout;
+  Options.ErrorExitCode = Flags.error_exitcode;
   Options.TimeoutExitCode = Flags.timeout_exitcode;
   Options.MaxTotalTimeSec = Flags.max_total_time;
   Options.DoCrossOver = Flags.cross_over;

Modified: llvm/trunk/lib/Fuzzer/FuzzerFlags.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerFlags.def?rev=285958&r1=285957&r2=285958&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerFlags.def (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerFlags.def Thu Nov  3 14:31:18 2016
@@ -27,10 +27,10 @@ FUZZER_FLAG_INT(
     timeout, 1200,
     "Timeout in seconds (if positive). "
     "If one unit runs more than this number of seconds the process will abort.")
-FUZZER_FLAG_INT(timeout_exitcode, 77,
-                "Unless abort_on_timeout is set, use this exitcode on timeout.")
-FUZZER_FLAG_INT(error_exit_code, 77, "When libFuzzer's signal handlers are in "
-  "use exit with this exitcode after catching a deadly signal.")
+FUZZER_FLAG_INT(error_exitcode, 77, "When libFuzzer itself reports a bug "
+  "this exit code will be used.")
+FUZZER_FLAG_INT(timeout_exitcode, 77, "When libFuzzer reports a timeout "
+  "this exit code will be used.")
 FUZZER_FLAG_INT(max_total_time, 0, "If positive, indicates the maximal total "
                                    "time in seconds to run the fuzzer.")
 FUZZER_FLAG_INT(help, 0, "Print help.")

Modified: llvm/trunk/lib/Fuzzer/test/fuzzer-leak.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-leak.test?rev=285958&r1=285957&r2=285958&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-leak.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-leak.test Thu Nov  3 14:31:18 2016
@@ -32,3 +32,4 @@ LEAK_TIMEOUT-NOT: LeakSanitizer
 RUN: LLVMFuzzer-AccumulateAllocationsTest -detect_leaks=1 -runs=100000 2>&1 | FileCheck %s --check-prefix=ACCUMULATE_ALLOCS
 ACCUMULATE_ALLOCS: INFO: libFuzzer disabled leak detection after every mutation
 
+RUN: LLVMFuzzer-LeakTest -error_exitcode=0




More information about the llvm-commits mailing list