[PATCH] D20461: [LibFuzzer] Fix sending SIGALRM to main thread under Mac OSX

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 22:59:07 PDT 2016


kcc added a comment.

In http://reviews.llvm.org/D20461#435258, @delcypher wrote:

> @kcc
>
> > This may be solved by printing and Exiting_ in the getrusage thread --
>
>
> the only question is how to avoid the race on CurrentUnitData/CurrentUnitSize w/o having to use a Mutex.
>
> > Want to try this?
>
>
> I'll take a look tomorrow. I need to first take a look at how `CurrentUnitData` and `CurrentUnitSize` are being used and consequently where they need to locked.


CurrentUnitData is used to dump the reproducer on disk.

> Just a thought. Why not just be single threaded and call `getrusage()` after every iteration of `LLVMFuzzerTestOneInput(...)`? It will mean for long running and non-terminating runs of `LLVMFuzzerTestOneInput(...)` we might not (or ever) detect OOM but it would avoid the complexity and the races. Personally I feel like detecting OOM should really be done externally using something like cgroups, but maybe that's a bad idea.


One of the two reasons for detecting OOMs in libFuzzer is to not let it kill your machine. 
You can't do it by checking getrusage after your machine has died.

cgroups are hard to set up, you should not expect every libFuzzer user to do it. 
AFAICT, they also require sudo (no?) 
Ideally we would have kernel support for RLIMIT_RSS, but there is no such thing today. :(


http://reviews.llvm.org/D20461





More information about the llvm-commits mailing list