diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp index 788f22791d5e29..570ad894d77e68 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 different 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)