This is an archive of the discontinued LLVM Phabricator instance.

Make InterruptHandler non-blocking for Fuchsia
ClosedPublic

Authored by aarongreen on Apr 13 2018, 2:24 PM.

Details

Summary

The initial naive approach to simulate SIGINT on Fuchsia was to getchar and look for ETX. This caused the InterruptHandler thread to lock stdin, preventing musl's exit() from being able to close the stdio descriptors and complete. This change uses select() instead.

Diff Detail

Event Timeline

aarongreen created this revision.Apr 13 2018, 2:24 PM
Herald added subscribers: Restricted Project, llvm-commits. · View Herald TranscriptApr 13 2018, 2:24 PM
phosek added inline comments.Apr 16 2018, 3:57 AM
lib/fuzzer/FuzzerUtilFuchsia.cpp
53

Do you need to specify the timeout? Why not just block forever?

Yeah, I mistakenly thought select might grab the iolock on stdio in musl. Using a null timeout works fine and simplifies things.

aarongreen marked an inline comment as done.Apr 16 2018, 5:10 PM
phosek accepted this revision.Apr 17 2018, 1:39 AM

LGTM, can you please upload a squashed patch?

This revision is now accepted and ready to land.Apr 17 2018, 1:39 AM

I believe this should be the squashed diff phosek requested.

This revision was automatically updated to reflect the committed changes.