[PATCH] D59005: Fix memory leak in CreateSigAltStack

JF Bastien via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 14:15:27 PST 2019


jfb added a comment.

And `NumRegisteredSignals` uses sequentially-consistent operations on purpose: it's technically slower but way easier to understand. What could be happening is:

  // The signal handler that runs.
  static RETSIGTYPE SignalHandler(int Sig) {
    // Restore the signal behavior to default, so that the program actually
    // crashes when we return and the signal reissues.  This also ensures that if
    // we crash in our signal handler that the program will terminate immediately
    // instead of recursing in the signal handler.
    UnregisterHandlers();

if you deliver another signal after unregistering all of them, you get the behavior you observed? I'm not sure whether we care about clang-as-a-library being loaded / unloaded in the same program. If not, we could limit signal registration to be a one-time thing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59005/new/

https://reviews.llvm.org/D59005





More information about the llvm-commits mailing list