[compiler-rt] r319160 - Handle symbol renaming of sigaction for NetBSD
Kamil Rytarowski via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 02:54:59 PST 2017
Author: kamil
Date: Tue Nov 28 02:54:58 2017
New Revision: 319160
URL: http://llvm.org/viewvc/llvm-project?rev=319160&view=rev
Log:
Handle symbol renaming of sigaction for NetBSD
Summary:
NetBSD uses the __sigaction14 symbol name for historical and compat
reasons for the sigaction(2) function name.
Rename the interceptors and users of sigaction to sigaction_symname
and reuse it in the code base.
This change fixes 4 failing tests in TSan/NetBSD:
- ThreadSanitizer-x86_64 :: signal_errno.cc
- ThreadSanitizer-x86_64 :: signal_malloc.cc
- ThreadSanitizer-x86_64 :: signal_sync2.cc
- ThreadSanitizer-x86_64 :: signal_thread.cc
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka, eugenis, dvyukov, kcc
Reviewed By: dvyukov
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D40341
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_signal_interceptors.inc
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_signal_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_signal_interceptors.inc?rev=319160&r1=319159&r2=319160&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_signal_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_signal_interceptors.inc Tue Nov 28 02:54:58 2017
@@ -18,6 +18,12 @@
using namespace __sanitizer;
+#if SANITIZER_NETBSD
+#define sigaction_symname __sigaction14
+#else
+#define sigaction_symname sigaction
+#endif
+
#ifndef SIGNAL_INTERCEPTOR_SIGNAL_IMPL
#define SIGNAL_INTERCEPTOR_SIGNAL_IMPL(func, signum, handler) \
{ return REAL(func)(signum, handler); }
@@ -25,7 +31,7 @@ using namespace __sanitizer;
#ifndef SIGNAL_INTERCEPTOR_SIGACTION_IMPL
#define SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact) \
- { return REAL(sigaction)(signum, act, oldact); }
+ { return REAL(sigaction_symname)(signum, act, oldact); }
#endif
#if SANITIZER_INTERCEPT_BSD_SIGNAL
@@ -46,16 +52,16 @@ INTERCEPTOR(uptr, signal, int signum, up
}
#define INIT_SIGNAL COMMON_INTERCEPT_FUNCTION(signal)
-INTERCEPTOR(int, sigaction, int signum, const __sanitizer_sigaction *act,
- __sanitizer_sigaction *oldact) {
+INTERCEPTOR(int, sigaction_symname, int signum,
+ const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
if (GetHandleSignalMode(signum) == kHandleSignalExclusive) return 0;
SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
}
-#define INIT_SIGACTION COMMON_INTERCEPT_FUNCTION(sigaction)
+#define INIT_SIGACTION COMMON_INTERCEPT_FUNCTION(sigaction_symname)
namespace __sanitizer {
int real_sigaction(int signum, const void *act, void *oldact) {
- return REAL(sigaction)(signum, (const __sanitizer_sigaction *)act,
+ return REAL(sigaction_symname)(signum, (const __sanitizer_sigaction *)act,
(__sanitizer_sigaction *)oldact);
}
} // namespace __sanitizer
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=319160&r1=319159&r2=319160&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Tue Nov 28 02:54:58 2017
@@ -2337,7 +2337,7 @@ static __sanitizer_sighandler_ptr signal
internal_memset(&act.sa_mask, -1, sizeof(act.sa_mask));
act.sa_flags = 0;
__sanitizer_sigaction old;
- int res = sigaction(sig, &act, &old);
+ int res = sigaction_symname(sig, &act, &old);
if (res) return (__sanitizer_sighandler_ptr)sig_err;
return old.handler;
}
More information about the llvm-commits
mailing list