oss-fuzz: Ctrl-C not working in libFuzzer's fork mode.
@kcc @morehouse
hardik from the fuzzing discord told me about this problem and I have been able to repro.
If you compile this program with -fsanitize=fuzzer,address (using OSS-Fuzz’s clang) and run it with
./a.out -fork=1 -ignore_crashes=1
Ctrl-C does nothing and libFuzzer will run forever.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Libfuzzer fix for Ctrl + c not working with -fork and -ignore_crashes=1 In some cases running Libfuzzer in fork mode with -ignore_crashes=1 counts ctrl+c as crash and restarts. Thread: https://githu... — committed to llvm/llvm-project by SyrasX 2 years ago
- Libfuzzer fix for Ctrl + c not working with -fork and -ignore_crashes=1 In some cases running Libfuzzer in fork mode with -ignore_crashes=1 counts ctrl+c as crash and restarts. Thread: https://githu... — committed to nomp-org/llvm-project by SyrasX 2 years ago
I am hoping to make some form of announcement any day now. The team has switched to working on https://github.com/google/centipede. libFuzzer will remain maintained at some level though, for some time.
This is the simple patch:
To properly patch this, though, you might need to route the FuzzingOptions object to ExecuteCommand, which requires extending the FuzzerUtil header and all instances of the ExecuteCommand API. Then, you can retrieve the return value as Options->InterruptExitCode.
This fixes it for me:
Not sure why, but this call to libfuzzer returns with exit code 2 when interrupted. Copying, running, and interrupting the exact same command in the bash terminal gives the proper exit code 72 (
Options.InterruptExitCode
). Even forced the interrupt handler of the child to return immediately with 72. It still ends up as 2.