[PATCH] D59005: Fix memory leak in CreateSigAltStack

Pietro Fezzardi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 13:12:55 PST 2019


fez added a comment.

> Is the mutex wrong? It should ensure that the alt stack is only ever set up once.

The mutex is fine, but it only guarantees that only one thread at any given time enters `CreateSigAltStack`. Nothing prevents the entire `RegisterHandlers` function to be called multiple times, by a single thread, which causes the execution to reach line 255 multiple times in a single execution of the same thread. This is actually exactly what's happening in my debug runs. It's not a concurrency issue (which would be effectively prevented by the mutex), it's just a memory leak in a single thread.


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