[PATCH] D46858: Signal handling should be signal-safe

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 21:15:32 PDT 2018


dexonsmith added a comment.

In https://reviews.llvm.org/D46858#1098865, @jfb wrote:

> (Will address code changes separately)
>
> In https://reviews.llvm.org/D46858#1098806, @dexonsmith wrote:
>
> > I wonder if there's some way to write a test for this.  E.g., a unit test that registers a signal handler for SIGUSR1 and then does what used to be necessary to trigger a crash.
>
>
> Hmm I don't think so, at least not a reliable test: most of the time the test wouldn't hit a dangerous interleaving. We could try to make the bad concurrent interleaving more likely, or loop a bunch so it's more likely to hit the race because it tries more, but I think fundamentally it would be a flaky "success" test, and mostly a test that does nothing. Were the code to start being broken, it would become a flaky failure.


Could you manufacture a deterministic (and dangerous) interleaving, by having the signal handler raise a signal on itself partway through something?


Repository:
  rL LLVM

https://reviews.llvm.org/D46858





More information about the llvm-commits mailing list