pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Sync with local patches



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Fri Jun 1 12:45:17 2018 +0200
Changeset:	b88be75b18c3b408d370b4ff072c091d0f52e4c8

Modified Files:
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
Added Files:
	compiler-rt-netbsd/patches/patch-lib_asan_asan__rtl.cc
	compiler-rt-netbsd/patches/patch-lib_msan_msan.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__fuchsia.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__win.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc

Log Message:
compiler-rt-netbsd: Sync with local patches

Fix MSan signal(3) interceptor.
Add CheckASLR().

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=b88be75b18c3b408d370b4ff072c091d0f52e4c8

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

diffstat:
 compiler-rt-netbsd/distinfo                        | 11 ++++--
 .../patches/patch-lib_asan_asan__rtl.cc            | 12 +++++++
 compiler-rt-netbsd/patches/patch-lib_msan_msan.cc  | 12 +++++++
 .../patches/patch-lib_msan_msan__interceptors.cc   | 12 +++++--
 ...patch-lib_sanitizer__common_sanitizer__common.h | 12 +++++++
 ...tch-lib_sanitizer__common_sanitizer__fuchsia.cc | 12 +++++++
 ...patch-lib_sanitizer__common_sanitizer__linux.cc | 39 +++++++++++++++++-----
 .../patch-lib_sanitizer__common_sanitizer__mac.cc  | 15 +++++++++
 .../patch-lib_sanitizer__common_sanitizer__win.cc  | 15 +++++++++
 .../patches/patch-lib_tsan_rtl_tsan__rtl.cc        | 12 +++++++
 10 files changed, 140 insertions(+), 12 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 3d750c85f2..d08301e941 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -3,19 +3,26 @@ $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 SHA1 (patch-CMakeLists.txt) = f84dd8cb370dce65de45e089d85598f15774fa18
 SHA1 (patch-cmake_config-ix.cmake) = 91ffb8c1e65394c7c6e9956379373b28348e3f1f
 SHA1 (patch-lib_asan_asan__posix.cc) = 0f596061c078eaab0b5b4b183550aa7820677f46
+SHA1 (patch-lib_asan_asan__rtl.cc) = a7570fa1e6818a4fa312d30ef9ed97e1e7ca2ca4
 SHA1 (patch-lib_fuzzer_FuzzerLoop.cpp) = f658549bdb9b0b875b55e286a0e4df0dd9046117
 SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 0e559ebb791942cba9c83f3098d7752f91e1f187
-SHA1 (patch-lib_msan_msan__interceptors.cc) = 79bfe137923597d79bb467d0f282d57221079a85
+SHA1 (patch-lib_msan_msan.cc) = 7e9156927a9c4d76b933348bc15a76957712d7cc
+SHA1 (patch-lib_msan_msan__interceptors.cc) = 4c036592c9c5a3b0f658f22b004b30813ad841ec
 SHA1 (patch-lib_msan_msan__linux.cc) = 6fd2ada4a84d1e1cc47ec8f4e1f0608861c73c1a
+SHA1 (patch-lib_sanitizer__common_sanitizer__common.h) = b31695d963eb324550ad868cbea7a8199598944c
 SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = e1d8ad46afc9bec97b7f0e00d0edf5ee377772b7
+SHA1 (patch-lib_sanitizer__common_sanitizer__fuchsia.cc) = 27aedcac4f63376017bb89777411b66139ddcbd9
 SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 91f645a6652d895e97b0aefbb62d80e680cd2c39
-SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = e4c889d8c140b06cb62429b37d56eca88feaaf03
+SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 123b1b62a953c60b33ea1cfc96e45f25c6e1ec93
+SHA1 (patch-lib_sanitizer__common_sanitizer__mac.cc) = 928b8798802392ae05fbe1a4ea6570681ad327f3
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = dbe5aee67312a9042299cd3bd14d25fa68860fb2
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = f242e307950755010305b004b4c2e21c528114fb
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = a5f5898534bd3c66a0fa9086781bd0124fe43281
 SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = 8b629840ff7f56c670d322a9dbbdf7e33ce90cb5
 SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = e520ec1e0fefb3cf9fb1d872ebf81952599a6c49
+SHA1 (patch-lib_sanitizer__common_sanitizer__win.cc) = 8715620e8a80735363bf3e876bd2b6133b8ab53b
 SHA1 (patch-lib_scudo_scudo__platform.h) = 119d7ad8f8ca9d3e846dbdd7f805ca771e30e410
+SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = b18c893d75bf682bef92e4331900fb05ec2a1870
 SHA1 (patch-test_asan_TestCases_Posix_stack-use-after-return.cc) = dea34873ff32e999da657766016a2434430be2ad
 SHA1 (patch-test_asan_TestCases_heavy__uar__test.cc) = d271e63af0b399d3e64add96a1b1b1b5e1039d7e
 SHA1 (patch-test_asan_TestCases_interception__failure__test.cc) = b4711fcc3315eaacc2a4ec1021e04b8200749e51
diff --git a/compiler-rt-netbsd/patches/patch-lib_asan_asan__rtl.cc b/compiler-rt-netbsd/patches/patch-lib_asan_asan__rtl.cc
new file mode 100644
index 0000000000..5be659fb95
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_asan_asan__rtl.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/asan/asan_rtl.cc.orig	2018-06-01 09:39:33.000000000 +0000
++++ lib/asan/asan_rtl.cc
+@@ -384,6 +384,7 @@ static void AsanInitInternal() {
+   asan_init_is_running = true;
+ 
+   CacheBinaryName();
++  CheckASLR();
+ 
+   // Initialize flags. This must be done early, because most of the
+   // initialization steps look at flags().
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan.cc
new file mode 100644
index 0000000000..815ecb5b43
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/msan/msan.cc.orig	2018-02-27 02:50:00.000000000 +0000
++++ lib/msan/msan.cc
+@@ -397,6 +397,7 @@ void __msan_init() {
+   InitTlsSize();
+ 
+   CacheBinaryName();
++  CheckASLR();
+   InitializeFlags();
+ 
+   // Install tool-specific callbacks in sanitizer_common.
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
index 763519d939..acaa3d4437 100644
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
@@ -124,7 +124,15 @@ $NetBSD$
  }
  
  static void BeforeFork() {
-@@ -1524,6 +1594,9 @@ namespace __msan {
+@@ -1292,6 +1362,7 @@ static int sigaction_impl(int signo, con
+ #define SIGNAL_INTERCEPTOR_SIGNAL_IMPL(func, signo, handler) \
+   {                                                          \
+     handler = signal_impl(signo, handler);                   \
++    InterceptorScope interceptor_scope;                      \
+     return REAL(func)(signo, handler);                       \
+   }
+ 
+@@ -1524,6 +1595,9 @@ namespace __msan {
  void InitializeInterceptors() {
    static int inited = 0;
    CHECK_EQ(inited, 0);
@@ -134,7 +142,7 @@ $NetBSD$
    InitializeCommonInterceptors();
    InitializeSignalInterceptors();
  
-@@ -1634,6 +1707,7 @@ void InitializeInterceptors() {
+@@ -1634,6 +1708,7 @@ void InitializeInterceptors() {
  
    INTERCEPT_FUNCTION(pthread_join);
    INTERCEPT_FUNCTION(tzset);
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common.h
new file mode 100644
index 0000000000..7277269f68
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_common.h.orig	2018-05-10 23:16:36.000000000 +0000
++++ lib/sanitizer_common/sanitizer_common.h
+@@ -221,6 +221,7 @@ bool SetEnv(const char *name, const char
+ 
+ u32 GetUid();
+ void ReExec();
++void CheckASLR();
+ char **GetArgv();
+ void PrintCmdline();
+ bool StackSizeIsUnlimited();
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__fuchsia.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__fuchsia.cc
new file mode 100644
index 0000000000..fb44d34fdf
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__fuchsia.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_fuchsia.cc.orig	2018-06-01 09:39:33.000000000 +0000
++++ lib/sanitizer_common/sanitizer_fuchsia.cc
+@@ -87,6 +87,7 @@ void GetThreadStackTopAndBottom(bool, up
+ }
+ 
+ void MaybeReexec() {}
++void CheckASLR() {}
+ void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {}
+ void DisableCoreDumperIfNecessary() {}
+ void InstallDeadlySignalHandlers(SignalHandlerType handler) {}
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
index 26177a79d1..2c10e19186 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__linux.cc
@@ -1,12 +1,35 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_linux.cc.orig	2018-04-25 21:13:40.000000000 +0000
+--- lib/sanitizer_common/sanitizer_linux.cc.orig	2018-06-01 09:47:10.441087020 +0000
 +++ lib/sanitizer_common/sanitizer_linux.cc
-@@ -93,6 +93,7 @@ extern "C" {
+@@ -1955,6 +1955,30 @@ void MaybeReexec() {
+   // No need to re-exec on Linux.
+ }
  
- #if SANITIZER_NETBSD
- #include <limits.h>  // For NAME_MAX
-+#define sysctl _sysctl
- #include <sys/sysctl.h>
- #include <sys/exec.h>
- extern struct ps_strings *__ps_strings;
++void CheckASLR() {
++#if SANITIZER_NETBSD
++  int mib[3];
++  int paxflags;
++  size_t len = sizeof(int);
++
++  mib[0] = CTL_PROC;
++  mib[1] = internal_getpid();
++  mib[2] = PROC_PID_PAXFLAGS;
++
++  if (UNLIKELY(sysctl(mib, 3, &paxflags, &len, NULL, 0) == -1)) {
++    Printf("sysctl failed\n");
++    Die();
++  }
++
++  if (UNLIKELY(paxflags & CTL_PROC_PAXFLAGS_ASLR)) {
++    Printf("This sanitizer is not compatible with enabled ASLR\n");
++    Die();
++  }
++#else
++  // Do nothing
++#endif
++}
++
+ void PrintModuleMap() { }
+ 
+ void CheckNoDeepBind(const char *filename, int flag) {
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc
new file mode 100644
index 0000000000..333e121d16
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__mac.cc
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_mac.cc.orig	2018-05-10 23:16:36.000000000 +0000
++++ lib/sanitizer_common/sanitizer_mac.cc
+@@ -340,6 +340,10 @@ void ReExec() {
+   UNIMPLEMENTED();
+ }
+ 
++void CheckASLR() {
++  // Do nothing
++}
++
+ uptr GetPageSize() {
+   return sysconf(_SC_PAGESIZE);
+ }
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__win.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__win.cc
new file mode 100644
index 0000000000..23c69a64a3
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__win.cc
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_win.cc.orig	2018-05-10 23:16:35.000000000 +0000
++++ lib/sanitizer_common/sanitizer_win.cc
+@@ -1025,6 +1025,10 @@ void MaybeReexec() {
+   // No need to re-exec on Windows.
+ }
+ 
++void CheckASLR() {
++  // Do nothing
++}
++
+ char **GetArgv() {
+   // FIXME: Actually implement this function.
+   return 0;
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
new file mode 100644
index 0000000000..d94c88fc78
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/tsan/rtl/tsan_rtl.cc.orig	2018-05-10 23:16:36.000000000 +0000
++++ lib/tsan/rtl/tsan_rtl.cc
+@@ -354,6 +354,7 @@ void Initialize(ThreadState *thr) {
+   ctx = new(ctx_placeholder) Context;
+   const char *options = GetEnv(SANITIZER_GO ? "GORACE" : "TSAN_OPTIONS");
+   CacheBinaryName();
++  CheckASLR();
+   InitializeFlags(&ctx->flags, options);
+   AvoidCVE_2016_2143();
+   InitializePlatformEarly();


Home | Main Index | Thread Index | Old Index