[PATCH] D20832: [esan] Ensure internal_sigaction() bypasses interceptors

Derek Bruening via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 21:37:29 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL271626: [esan] Ensure internal_sigaction() bypasses interceptors (authored by bruening).

Changed prior to commit:
  http://reviews.llvm.org/D20832?vs=59120&id=59490#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20832

Files:
  compiler-rt/trunk/lib/esan/esan_interceptors.cpp
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h

Index: compiler-rt/trunk/lib/esan/esan_interceptors.cpp
===================================================================
--- compiler-rt/trunk/lib/esan/esan_interceptors.cpp
+++ compiler-rt/trunk/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
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h
+++ compiler-rt/trunk/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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20832.59490.patch
Type: text/x-patch
Size: 1614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160603/cdb7cd5c/attachment.bin>


More information about the llvm-commits mailing list