[compiler-rt] 37b7829 - tsan: add a comment to CallUserSignalHandler

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 30 02:33:24 PDT 2021


Author: Dmitry Vyukov
Date: 2021-08-30T11:33:19+02:00
New Revision: 37b78291c67c1a8b0a207b966697342834db388a

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

LOG: tsan: add a comment to CallUserSignalHandler

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D108907

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 788f22791d5e2..570ad894d77e6 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -1989,8 +1989,12 @@ static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire,
   volatile uptr pc = (sigactions[sig].sa_flags & SA_SIGINFO)
                          ? (uptr)sigactions[sig].sigaction
                          : (uptr)sigactions[sig].handler;
-  if (pc != sig_dfl && pc != sig_ign)
+  if (pc != sig_dfl && pc != sig_ign) {
+    // The callback can be either sa_handler or sa_sigaction.
+    // They have 
diff erent signatures, but we assume that passing
+    // additional arguments to sa_handler works and is harmless.
     ((__sanitizer_sigactionhandler_ptr)pc)(sig, info, uctx);
+  }
   if (!ctx->after_multithreaded_fork) {
     thr->ignore_reads_and_writes = ignore_reads_and_writes;
     if (ignore_reads_and_writes)


        


More information about the llvm-commits mailing list