[PATCH] D40341: Handle symbol renaming of sigaction for NetBSD
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 22 04:02:10 PST 2017
krytarowski created this revision.
krytarowski added a project: Sanitizers.
Herald added a subscriber: kubamracek.
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>
Repository:
rL LLVM
https://reviews.llvm.org/D40341
Files:
lib/sanitizer_common/sanitizer_signal_interceptors.inc
lib/tsan/rtl/tsan_interceptors.cc
Index: lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -2337,7 +2337,7 @@
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;
}
Index: lib/sanitizer_common/sanitizer_signal_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_signal_interceptors.inc
+++ lib/sanitizer_common/sanitizer_signal_interceptors.inc
@@ -46,16 +46,22 @@
}
#define INIT_SIGNAL COMMON_INTERCEPT_FUNCTION(signal)
-INTERCEPTOR(int, sigaction, int signum, const __sanitizer_sigaction *act,
- __sanitizer_sigaction *oldact) {
+#if SANITIZER_NETBSD
+#define sigaction_symname __sigaction14
+#else
+#define sigaction_symname sigaction
+#endif
+
+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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40341.123899.patch
Type: text/x-patch
Size: 1780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171122/dc37c42f/attachment.bin>
More information about the llvm-commits
mailing list