[PATCH] D45398: Fix lock order inversion between ManagedStatic and Statistic

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 6 18:47:45 PDT 2018


dsanders added inline comments.


================
Comment at: llvm/lib/Support/Statistic.cpp:97
   // printed.
-  sys::SmartScopedLock<true> Writer(*StatLock);
+  // There is a possible lock order inversion here. llvm_shutdown calls us
+  // while holding the ManagedStatic mutex. If we take StatLock and call
----------------
Are you sure llvm_shutdown() calls Statistic::RegisterStatistic()? It's surprising that it would be constructing and registering new Statistic objects in a function that's intended to destroy them.


https://reviews.llvm.org/D45398





More information about the llvm-commits mailing list