From b6ae7909d7b0ae26d86e34c0749459dc8f22ffb1 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Wed, 25 Jun 2025 11:08:03 -0700 Subject: [PATCH] [Support] Don't re-raise signals sent from kernel When an llvm tool crashes (e.g. from a segmentation fault), SignalHandler will re-raise the signal. The effect is that crash reports now contain SignalHandler in the stack trace. The crash reports are still useful, but the presence of SignalHandler can confuse tooling and automation that deduplicate or analyze crash reports. rdar://150464802 --- llvm/lib/Support/Unix/Signals.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index 6668a2953b3b2..cb38fcc559a7e 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/lib/Support/Unix/Signals.inc @@ -413,9 +413,9 @@ static void SignalHandler(int Sig, siginfo_t *Info, void *) { raise(Sig); #endif - // Signal sent from another process, do not assume that continuing the - // execution would re-raise it. - if (Info->si_pid != getpid()) + // Signal sent from another userspace process, do not assume that continuing + // the execution would re-raise it. + if (Info->si_pid != getpid() && Info->si_pid != 0) raise(Sig); }