pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compiler-rt-netbsd: Temporarily partly disable sanitizers' code on NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Jun 20 13:43:19 2017 +0200
Changeset:	db464e40d7fe0748cbdf7ac1ab7bc26ff9c621a3

Modified Files:
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
Added Files:
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S

Log Message:
compiler-rt-netbsd: Temporarily partly disable sanitizers' code on NetBSD

If there is no FreeBSD support in certain code, temporarily skip it on
NetBSD as well.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=db464e40d7fe0748cbdf7ac1ab7bc26ff9c621a3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 compiler-rt-netbsd/distinfo                        |  5 ++-
 .../patches/patch-cmake_config-ix.cmake            | 34 +----------------
 .../patch-lib_tsan_rtl_tsan__interceptors.cc       | 44 +++++++++++++++++-----
 .../patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S  | 40 ++++++++++++++++++++
 4 files changed, 79 insertions(+), 44 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 0d06fda90b..067c7c0bc4 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -12,7 +12,7 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
 SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
-SHA1 (patch-cmake_config-ix.cmake) = fd4446fb9da3d6ffc01685bbccaf626566cee6b5
+SHA1 (patch-cmake_config-ix.cmake) = f60bb22deec40689c96d27cbe9db7c643e46f5cc
 SHA1 (patch-lib_asan_asan__interceptors.h) = cca1e74041e37d366c512d23547063d6a4dee008
 SHA1 (patch-lib_asan_asan__linux.cc) = fcbf780af6bcd3b43c86d9e5e2c8a92e3a8885da
 SHA1 (patch-lib_asan_scripts_asan__symbolize.py) = d6c079e7092b22b5379293dbb8d1e2445e077932
@@ -32,8 +32,9 @@ SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = bd02af
 SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps.h) = ec0b5c576463639a3ee66c33ff7e9d94076f40df
 SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__netbsd.cc) = a7e97fdb92e166f9d1def5a169c1fd079d8bb40a
 SHA1 (patch-lib_sanitizer__common_sanitizer__syscall__generic.inc) = 73db63809d0972346e76cc6eaebf0d7d047f0bea
-SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = f42a6732e8b95ba63fec8819a5be2bbd6518d610
+SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 944d43d2d4a55560d4cff313d0307f8ee8afd1d7
 SHA1 (patch-lib_tsan_rtl_tsan__platform__linux.cc) = 3bb2c418b3d4bedad9014309abdd2cbad58b252c
+SHA1 (patch-lib_tsan_rtl_tsan__rtl__amd64.S) = 743e52c14f6aa21d0002b05a1be4f972dff0206f
 SHA1 (patch-lib_ubsan_ubsan__platform.h) = 8b9419ed6d3f40357eb73e71680d070bd64bd5cc
 SHA1 (patch-test_asan_TestCases_heavy__uar__test.cc) = 080def2df403f087152a28ad0a678d36ba9cf5bd
 SHA1 (patch-test_asan_TestCases_non-executable-pc.cpp) = 9812e7dd4a584a3a51e43ef54331b23dbe32778a
diff --git a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
index 87539a1616..7cc00bf750 100644
--- a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
+++ b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
@@ -29,7 +29,7 @@ $NetBSD$
    set(COMPILER_RT_HAS_LSAN TRUE)
  else()
    set(COMPILER_RT_HAS_LSAN FALSE)
-@@ -490,56 +490,56 @@ else()
+@@ -490,28 +490,28 @@ else()
  endif()
  
  if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
@@ -62,35 +62,3 @@ $NetBSD$
    set(COMPILER_RT_HAS_SAFESTACK TRUE)
  else()
    set(COMPILER_RT_HAS_SAFESTACK FALSE)
- endif()
- 
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND CFI_SUPPORTED_ARCH AND
--    OS_NAME MATCHES "Linux")
-+    OS_NAME MATCHES "Linux|NetBSD")
-   set(COMPILER_RT_HAS_CFI TRUE)
- else()
-   set(COMPILER_RT_HAS_CFI FALSE)
- endif()
- 
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND ESAN_SUPPORTED_ARCH AND
--    OS_NAME MATCHES "Linux")
-+    OS_NAME MATCHES "Linux|NetBSD")
-   set(COMPILER_RT_HAS_ESAN TRUE)
- else()
-   set(COMPILER_RT_HAS_ESAN FALSE)
- endif()
- 
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND SCUDO_SUPPORTED_ARCH AND
--    OS_NAME MATCHES "Linux")
-+    OS_NAME MATCHES "Linux|NetBSD")
-   set(COMPILER_RT_HAS_SCUDO TRUE)
- else()
-   set(COMPILER_RT_HAS_SCUDO FALSE)
- endif()
- 
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND
--    OS_NAME MATCHES "Linux")
-+    OS_NAME MATCHES "Linux|NetBSD")
-   set(COMPILER_RT_HAS_XRAY TRUE)
- else()
-   set(COMPILER_RT_HAS_XRAY FALSE)
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
index ba3c53100a..f3b96a6dea 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
@@ -35,16 +35,19 @@ $NetBSD$
  const int PTHREAD_MUTEX_RECURSIVE = 1;
  const int PTHREAD_MUTEX_RECURSIVE_NP = 1;
  #else
-@@ -101,7 +113,7 @@ const int PTHREAD_MUTEX_RECURSIVE_NP = 2
+@@ -100,8 +112,10 @@ const int PTHREAD_MUTEX_RECURSIVE_NP = 2
+ #endif
  const int EINVAL = 22;
  const int EBUSY = 16;
++#if !SANITIZER_NETBSD
  const int EOWNERDEAD = 130;
 -#if !SANITIZER_FREEBSD && !SANITIZER_MAC
++#endif
 +#if !SANITIZER_FREEBSD && !SANITIZER_MAC && !SANITIZER_NETBSD
  const int EPOLL_CTL_ADD = 1;
  #endif
  const int SIGILL = 4;
-@@ -110,7 +122,7 @@ const int SIGFPE = 8;
+@@ -110,7 +124,7 @@ const int SIGFPE = 8;
  const int SIGSEGV = 11;
  const int SIGPIPE = 13;
  const int SIGTERM = 15;
@@ -53,7 +56,7 @@ $NetBSD$
  const int SIGBUS = 10;
  const int SIGSYS = 12;
  #else
-@@ -154,7 +166,7 @@ struct sigaction_t {
+@@ -154,7 +168,7 @@ struct sigaction_t {
      sighandler_t sa_handler;
      sigactionhandler_t sa_sigaction;
    };
@@ -62,7 +65,7 @@ $NetBSD$
    int sa_flags;
    __sanitizer_sigset_t sa_mask;
  #elif SANITIZER_MAC
-@@ -173,7 +185,7 @@ struct sigaction_t {
+@@ -173,7 +187,7 @@ struct sigaction_t {
  const sighandler_t SIG_DFL = (sighandler_t)0;
  const sighandler_t SIG_IGN = (sighandler_t)1;
  const sighandler_t SIG_ERR = (sighandler_t)-1;
@@ -71,7 +74,7 @@ $NetBSD$
  const int SA_SIGINFO = 0x40;
  const int SIG_SETMASK = 3;
  #elif defined(__mips__)
-@@ -289,7 +301,7 @@ void ScopedInterceptor::DisableIgnores()
+@@ -289,7 +303,7 @@ void ScopedInterceptor::DisableIgnores()
  }
  
  #define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func)
@@ -80,7 +83,7 @@ $NetBSD$
  # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION(func)
  #else
  # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION_VER(func, ver)
-@@ -466,7 +478,7 @@ static void SetJmp(ThreadState *thr, upt
+@@ -466,7 +480,7 @@ static void SetJmp(ThreadState *thr, upt
  static void LongJmp(ThreadState *thr, uptr *env) {
  #ifdef __powerpc__
    uptr mangled_sp = env[0];
@@ -89,7 +92,30 @@ $NetBSD$
    uptr mangled_sp = env[2];
  #elif defined(SANITIZER_LINUX)
  # ifdef __aarch64__
-@@ -1348,7 +1360,7 @@ TSAN_INTERCEPTOR(int, __fxstat, int vers
+@@ -1045,7 +1059,9 @@ static int cond_wait(ThreadState *thr, u
+     res = call_pthread_cancel_with_cleanup(
+         fn, c, m, t, (void (*)(void *arg))cond_mutex_unlock, &arg);
+   }
++#if !SANITIZER_NETBSD
+   if (res == errno_EOWNERDEAD) MutexRepair(thr, pc, (uptr)m);
++#endif
+   MutexPostLock(thr, pc, (uptr)m, MutexFlagDoPreLockOnPostLock);
+   return res;
+ }
+@@ -1131,10 +1147,12 @@ TSAN_INTERCEPTOR(int, pthread_mutex_dest
+ TSAN_INTERCEPTOR(int, pthread_mutex_trylock, void *m) {
+   SCOPED_TSAN_INTERCEPTOR(pthread_mutex_trylock, m);
+   int res = REAL(pthread_mutex_trylock)(m);
++#if !SANITIZER_NETBSD
+   if (res == EOWNERDEAD)
+     MutexRepair(thr, pc, (uptr)m);
+   if (res == 0 || res == EOWNERDEAD)
+     MutexPostLock(thr, pc, (uptr)m, MutexFlagTryLock);
++#endif
+   return res;
+ }
+ 
+@@ -1348,7 +1366,7 @@ TSAN_INTERCEPTOR(int, __fxstat, int vers
  #endif
  
  TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
@@ -98,7 +124,7 @@ $NetBSD$
    SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
    if (fd > 0)
      FdAccess(thr, pc, fd);
-@@ -1929,7 +1941,7 @@ TSAN_INTERCEPTOR(int, sigaction, int sig
+@@ -1929,7 +1947,7 @@ TSAN_INTERCEPTOR(int, sigaction, int sig
    sigactions[sig].sa_flags = *(volatile int*)&act->sa_flags;
    internal_memcpy(&sigactions[sig].sa_mask, &act->sa_mask,
        sizeof(sigactions[sig].sa_mask));
@@ -107,7 +133,7 @@ $NetBSD$
    sigactions[sig].sa_restorer = act->sa_restorer;
  #endif
    sigaction_t newact;
-@@ -2291,7 +2303,7 @@ struct ScopedSyscall {
+@@ -2291,7 +2309,7 @@ struct ScopedSyscall {
    }
  };
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S
new file mode 100644
index 0000000000..cebeda20a5
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__amd64.S
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- lib/tsan/rtl/tsan_rtl_amd64.S.orig	2017-06-03 23:53:57.000000000 +0000
++++ lib/tsan/rtl/tsan_rtl_amd64.S
+@@ -178,7 +178,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
+   CFI_ADJUST_CFA_OFFSET(8)
+   CFI_REL_OFFSET(%rdi, 0)
+   // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+   lea 8(%rsp), %rdi
+   mov %rdi, %rsi
+ #elif defined(__APPLE__)
+@@ -219,7 +219,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
+   CFI_ADJUST_CFA_OFFSET(8)
+   CFI_REL_OFFSET(%rdi, 0)
+   // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+   lea 8(%rsp), %rdi
+   mov %rdi, %rsi
+ #elif defined(__APPLE__)
+@@ -267,7 +267,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
+   sub $8, %rsp
+   CFI_ADJUST_CFA_OFFSET(8)
+   // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+   lea 24(%rsp), %rdi
+   mov %rdi, %rsi
+ #elif defined(__APPLE__)
+@@ -323,7 +323,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
+   sub $8, %rsp
+   CFI_ADJUST_CFA_OFFSET(8)
+   // obtain %rsp
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+   lea 24(%rsp), %rdi
+   mov %rdi, %rsi
+ #else


Home | Main Index | Thread Index | Old Index