[llvm] [Support] Don't take a lock in CrashRecoverySignalHandler (PR #219529)
Oliver Hunt via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 29 20:11:51 PDT 2026
================
@@ -369,8 +369,12 @@ static void CrashRecoverySignalHandler(int Signal) {
// that the enclosing application will terminate soon, and we won't want to
// attempt crash recovery again.
//
- // This call of Disable isn't thread safe, but it doesn't actually matter.
- CrashRecoveryContext::Disable();
+ // Uninstall directly rather than through Disable(): a signal handler must
+ // not take a lock, and a lock with static storage duration may already be
+ // destroyed by the time a signal is delivered during exit(). Racing with
+ // another thread here doesn't matter.
+ gCrashRecoveryEnabled = false;
+ uninstallExceptionOrSignalHandlers();
----------------
ojhunt wrote:
Waiting for a future PR saying that racing does matter :D :D :D
https://github.com/llvm/llvm-project/pull/219529
More information about the llvm-commits
mailing list