Page MenuHomePhabricator

[libFuzzer] AlrmHandler is executed in a different thread for Windows.

Authored by mpividori on Jan 13 2017, 8:00 PM.



I don't check for InFuzzingThread() in Windows, since the AlarmHandler() is executed by a thread from a thread pool.
I continue thinking that it would be better to take the same approach for both Windows and Linux and execute that callbacks in a different thread in Linux too, instead of relying on asynchronous execution (as mentioned in We would avoid this kind of problems.

Diff Detail


Event Timeline

mpividori updated this revision to Diff 84426.Jan 13 2017, 8:00 PM
mpividori retitled this revision from to [libFuzzer] AlrmHandler is executed in a different thread for Windows..
mpividori updated this object.
mpividori added reviewers: kcc, zturner.
mpividori set the repository for this revision to rL LLVM.
mpividori added a subscriber: llvm-commits.
zturner edited edge metadata.Jan 17 2017, 10:05 AM

Is the code already re-entrant for Windows so that it will work properly? No locks or guards are added, just a check that allows the code to continue even though we're in a different thread. Is this going to ahve unintended side effects that haven't been addressed?

@zturner Yes, I disable the check for InFuzzingThread() on Windows, because AlarmCallback() is always executed on a different thread. If I don't add these changes, the alarm handler will never execute.

As I mentioned in, we could have some problems because we don't synchronize with the main thread. But we decided to ignore them.
In fact, we can't fix that because the same function AlarmCallback() will be called asynchronously for linux, so we can't use locks or anything like that.

@zturner Ok. Do you think this diff is ready to land?

zturner accepted this revision.Jan 17 2017, 8:52 PM
This revision is now accepted and ready to land.Jan 17 2017, 8:52 PM
This revision was automatically updated to reflect the committed changes.