[PATCH] D45762: [LibFuzzer] Add support for an optional user defined callback (`LLVMFuzzerOnExitHandler()`)

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 23:43:09 PDT 2018


delcypher added a comment.

In https://reviews.llvm.org/D45762#1071308, @kcc wrote:

> Why is it not enough to cal atexit() in LLVMFuzzerInitialize?


LibFuzzer currently uses `_Exit()` in several cases which means that it is not guaranteed that registered `atexit()` callbacks will be called by LibFuzer.  In particular in JFS we currently use `abort()` in the program under test to detect we've reached the target and we implement a timeout externally (there are technical reasons for doing this) and send `SIGINT` to LibFuzzer when the timeout occurs. In both of these cases `atexit` handlers would not be called. Therefore we needed to implement a callback for the fuzzer exiting. This patch seemed like the most general way of doing this.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45762





More information about the llvm-commits mailing list