[compiler-rt] ed8565c - [sanitizer_common] Block asynchronous signals only (#98200)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 13:02:44 PDT 2024


Author: Thurston Dang
Date: 2024-07-10T13:02:41-07:00
New Revision: ed8565cf0b64ea5e88cc94f321b1870bb105d09d

URL: https://github.com/llvm/llvm-project/commit/ed8565cf0b64ea5e88cc94f321b1870bb105d09d
DIFF: https://github.com/llvm/llvm-project/commit/ed8565cf0b64ea5e88cc94f321b1870bb105d09d.diff

LOG: [sanitizer_common] Block asynchronous signals only (#98200)

This changes the behavior of `BlockSignals` and `ScopedBlockSignals` to
block only asynchronous signals.

This extension is intended to be used in a future fix for MSan (block
async signals during `MsanThread::Destroy`).

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 12df3ef73da4b..54f972c74794b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -155,6 +155,7 @@ void SetSigProcMask(__sanitizer_sigset_t *set, __sanitizer_sigset_t *oldset) {
   CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, set, oldset));
 }
 
+// Block asynchronous signals
 void BlockSignals(__sanitizer_sigset_t *oldset) {
   __sanitizer_sigset_t set;
   internal_sigfillset(&set);
@@ -170,6 +171,16 @@ void BlockSignals(__sanitizer_sigset_t *oldset) {
   // hang.
   internal_sigdelset(&set, 31);
 #  endif
+
+  // Don't block synchronous signals
+  internal_sigdelset(&set, SIGSEGV);
+  internal_sigdelset(&set, SIGBUS);
+  internal_sigdelset(&set, SIGILL);
+  internal_sigdelset(&set, SIGTRAP);
+  internal_sigdelset(&set, SIGABRT);
+  internal_sigdelset(&set, SIGFPE);
+  internal_sigdelset(&set, SIGPIPE);
+
   SetSigProcMask(&set, oldset);
 }
 


        


More information about the llvm-commits mailing list