diff options
author | Vitaly Buka <vitalybuka@google.com> | 2017-11-10 19:22:51 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2017-11-10 19:22:51 +0000 |
commit | 7b5f408fa8f527cb3f8079369505327d654e1e74 (patch) | |
tree | 98517ea24e6be26102ec057fba71bbb62c12a271 /lib | |
parent | b36555d06db5e3707103c0f485d4acacc53084e9 (diff) |
[tsan] Extract sigaction_impl and signal_impl
Preparation for switching to sanitizer_signal_interceptors.inc
Part of https://github.com/google/sanitizers/issues/637
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317913 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tsan/rtl/tsan_interceptors.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/tsan/rtl/tsan_interceptors.cc b/lib/tsan/rtl/tsan_interceptors.cc index 87051e9ce..5ecbeb0e8 100644 --- a/lib/tsan/rtl/tsan_interceptors.cc +++ b/lib/tsan/rtl/tsan_interceptors.cc @@ -1950,8 +1950,17 @@ static void rtl_sigaction(int sig, __sanitizer_siginfo *info, void *ctx) { 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, __sanitizer_sigaction *act, } 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)); |