[PATCH] D40766: Handle NetBSD symbol renaming in msan_interceptors.cc

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 18:27:02 PST 2017


krytarowski updated this revision to Diff 125664.
krytarowski edited the summary of this revision.
krytarowski added a comment.
Herald added a subscriber: kubamracek.

- rename sigaction_symname to SIGACTION_SYMNAME
- put SIGACTION_SYMNAME in sanitizer_common/sanitizer_platform_limits_posix.h and ..netbsd.h


Repository:
  rL LLVM

https://reviews.llvm.org/D40766

Files:
  lib/msan/msan_interceptors.cc
  lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  lib/sanitizer_common/sanitizer_platform_limits_posix.h


Index: lib/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -1498,6 +1498,8 @@
   COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==          \
                  offsetof(struct CLASS, MEMBER))
 
+#define SIGACTION_SYMNAME sigaction
+
 #endif  // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC
 
 #endif
Index: lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
@@ -575,6 +575,8 @@
   COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
                  offsetof(struct CLASS, MEMBER))
 
+#define SIGACTION_SYMNAME __sigaction14
+
 #endif  // SANITIZER_NETBSD
 
 #endif
Index: lib/msan/msan_interceptors.cc
===================================================================
--- lib/msan/msan_interceptors.cc
+++ lib/msan/msan_interceptors.cc
@@ -22,6 +22,7 @@
 #include "msan_thread.h"
 #include "msan_poisoning.h"
 #include "sanitizer_common/sanitizer_platform_limits_posix.h"
+#include "sanitizer_common/sanitizer_platform_limits_netbsd.h"
 #include "sanitizer_common/sanitizer_allocator.h"
 #include "sanitizer_common/sanitizer_allocator_interface.h"
 #include "sanitizer_common/sanitizer_allocator_internal.h"
@@ -33,6 +34,12 @@
 #include "sanitizer_common/sanitizer_linux.h"
 #include "sanitizer_common/sanitizer_tls_get_addr.h"
 
+#if SANITIZER_NETBSD
+#define gettimeofday __gettimeofday50
+#define getrusage __getrusage50
+#define shmctl __shmctl50
+#endif
+
 #include <stdarg.h>
 // ACHTUNG! No other system header includes in this file.
 // Ideally, we should get rid of stdarg.h as well.
@@ -1340,15 +1347,15 @@
         pnew_act->sigaction = (decltype(pnew_act->sigaction))new_cb;
       }
     }
-    res = REAL(sigaction)(signo, pnew_act, oldact);
+    res = REAL(SIGACTION_SYMNAME)(signo, pnew_act, oldact);
     if (res == 0 && oldact) {
       uptr cb = (uptr)oldact->sigaction;
       if (cb == (uptr)SignalAction || cb == (uptr)SignalHandler) {
         oldact->sigaction = (decltype(oldact->sigaction))old_cb;
       }
     }
   } else {
-    res = REAL(sigaction)(signo, act, oldact);
+    res = REAL(SIGACTION_SYMNAME)(signo, act, oldact);
   }
 
   if (res == 0 && oldact) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40766.125664.patch
Type: text/x-patch
Size: 2524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/76b2d50e/attachment.bin>


More information about the llvm-commits mailing list