[compiler-rt] r317913 - [tsan] Extract sigaction_impl and signal_impl
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 11:22:51 PST 2017
Author: vitalybuka
Date: Fri Nov 10 11:22:51 2017
New Revision: 317913
URL: http://llvm.org/viewvc/llvm-project?rev=317913&view=rev
Log:
[tsan] Extract sigaction_impl and signal_impl
Preparation for switching to sanitizer_signal_interceptors.inc
Part of https://github.com/google/sanitizers/issues/637
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=317913&r1=317912&r2=317913&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Fri Nov 10 11:22:51 2017
@@ -1950,8 +1950,17 @@ static void rtl_sigaction(int sig, __san
rtl_generic_sighandler(true, sig, info, ctx);
}
+static int sigaction_impl(int sig, __sanitizer_sigaction *act,
+ __sanitizer_sigaction *old);
+static sighandler_t signal_impl(int sig, sighandler_t h);
+
TSAN_INTERCEPTOR(int, sigaction, int sig, __sanitizer_sigaction *act,
__sanitizer_sigaction *old) {
+ return sigaction_impl(sig, act, old);
+}
+
+int sigaction_impl(int sig, __sanitizer_sigaction *act,
+ __sanitizer_sigaction *old) {
// Note: if we call REAL(sigaction) directly for any reason without proxying
// the signal handler through rtl_sigaction, very bad things will happen.
// The handler will run synchronously and corrupt tsan per-thread state.
@@ -1989,6 +1998,10 @@ TSAN_INTERCEPTOR(int, sigaction, int sig
}
TSAN_INTERCEPTOR(sighandler_t, signal, int sig, sighandler_t h) {
+ return signal_impl(sig, h);
+}
+
+static sighandler_t signal_impl(int sig, sighandler_t h) {
__sanitizer_sigaction act;
act.handler = h;
internal_memset(&act.sa_mask, -1, sizeof(act.sa_mask));
More information about the llvm-commits
mailing list