[PATCH] D39824: [msan] Extract signal_impl and sigaction_impl
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 14:51:09 PST 2017
vitalybuka updated this revision to Diff 122337.
vitalybuka added a comment.
update
https://reviews.llvm.org/D39824
Files:
compiler-rt/lib/msan/msan_interceptors.cc
Index: compiler-rt/lib/msan/msan_interceptors.cc
===================================================================
--- compiler-rt/lib/msan/msan_interceptors.cc
+++ compiler-rt/lib/msan/msan_interceptors.cc
@@ -1006,8 +1006,22 @@
CHECK_UNPOISONED(&act->sa_mask, sizeof(act->sa_mask));
}
+static int sigaction_impl(int signo, const __sanitizer_sigaction *act,
+ __sanitizer_sigaction *oldact);
+static uptr signal_impl(int signo, uptr cb);
+
INTERCEPTOR(int, sigaction, int signo, const __sanitizer_sigaction *act,
__sanitizer_sigaction *oldact) {
+ return sigaction_impl(signo, act, oldact);
+}
+
+INTERCEPTOR(int, signal, int signo, uptr cb) {
+ cb = signal_impl(signo, cb);
+ return REAL(signal)(signo, cb);
+}
+
+static int sigaction_impl(int signo, const __sanitizer_sigaction *act,
+ __sanitizer_sigaction *oldact) {
ENSURE_MSAN_INITED();
if (act) read_sigaction(act);
int res;
@@ -1045,19 +1059,17 @@
return res;
}
-INTERCEPTOR(int, signal, int signo, uptr cb) {
+static uptr signal_impl(int signo, uptr cb) {
ENSURE_MSAN_INITED();
if (flags()->wrap_signals) {
CHECK_LT(signo, kMaxSignals);
SpinMutexLock lock(&sigactions_mu);
if (cb != __sanitizer::sig_ign && cb != __sanitizer::sig_dfl) {
atomic_store(&sigactions[signo], cb, memory_order_relaxed);
- cb = (uptr) SignalHandler;
+ cb = (uptr)&SignalHandler;
}
- return REAL(signal)(signo, cb);
- } else {
- return REAL(signal)(signo, cb);
}
+ return cb;
}
extern "C" int pthread_attr_init(void *attr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39824.122337.patch
Type: text/x-patch
Size: 1607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171109/23034a99/attachment.bin>
More information about the llvm-commits
mailing list