[PATCH] D20832: [esan] Ensure internal_sigaction() bypasses interceptors
Derek Bruening via llvm-commits
llvm-commits at lists.llvm.org
Tue May 31 13:27:51 PDT 2016
bruening created this revision.
bruening added a reviewer: aizatsky.
bruening added subscribers: llvm-commits, eugenis, kcc, zhaoqin, vitalybuka.
Herald added a subscriber: kubabrecka.
Implements real_sigaction() which it turns out is required for
internal_sigaction() to bypass the libc interceptors.
http://reviews.llvm.org/D20832
Files:
lib/esan/esan_interceptors.cpp
lib/sanitizer_common/sanitizer_posix.h
Index: lib/sanitizer_common/sanitizer_posix.h
===================================================================
--- lib/sanitizer_common/sanitizer_posix.h
+++ lib/sanitizer_common/sanitizer_posix.h
@@ -78,6 +78,8 @@
int my_pthread_attr_getstack(void *attr, void **addr, uptr *size);
+// A routine named real_sigaction() must be implemented by each sanitizer in
+// order for internal_sigaction() to bypass interceptors.
int internal_sigaction(int signum, const void *act, void *oldact);
void internal_sigfillset(__sanitizer_sigset_t *set);
Index: lib/esan/esan_interceptors.cpp
===================================================================
--- lib/esan/esan_interceptors.cpp
+++ lib/esan/esan_interceptors.cpp
@@ -373,6 +373,8 @@
#endif
#if SANITIZER_LINUX
+DECLARE_REAL(int, sigaction, int signum, const struct sigaction *act,
+ struct sigaction *oldact)
INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
struct sigaction *oldact) {
void *ctx;
@@ -382,6 +384,15 @@
else
return REAL(sigaction)(signum, act, oldact);
}
+
+// This is required to properly use internal_sigaction.
+namespace __sanitizer {
+int real_sigaction(int signum, const void *act, void *oldact) {
+ return REAL(sigaction)(signum, (const struct sigaction *)act,
+ (struct sigaction *)oldact);
+}
+} // namespace __sanitizer
+
#define ESAN_MAYBE_INTERCEPT_SIGACTION INTERCEPT_FUNCTION(sigaction)
#else
#error Platform not supported
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20832.59120.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160531/20ffa4e2/attachment.bin>
More information about the llvm-commits
mailing list