[llvm] [Support] Don't re-raise signals sent from kernel (PR #145759)
Alex Langford via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 11:18:09 PDT 2025
https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/145759
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
>From b6ae7909d7b0ae26d86e34c0749459dc8f22ffb1 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
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);
}
More information about the llvm-commits
mailing list