pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
compiler-rt-netbsd: Fix ASan for NetBSD/i386
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Tue May 8 00:07:11 2018 +0200
Changeset: 1e50b688782a959ffe9dc2eb525b9a6d38384bf5
Modified Files:
compiler-rt-netbsd/distinfo
Added Files:
compiler-rt-netbsd/patches/patch-CMakeLists.txt
compiler-rt-netbsd/patches/patch-lib_asan_asan__mapping.h
compiler-rt-netbsd/patches/patch-lib_asan_asan__thread.cc
Log Message:
compiler-rt-netbsd: Fix ASan for NetBSD/i386
Align static TLS global vector to shadow memory granularity.
$ make check-asan
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
2 warning(s) in tests.
Testing Time: 168.21s
********************
Failing Tests (16):
AddressSanitizer-Unit ::
./Asan-i386-calls-Noinst-Test/AddressSanitizer.ThreadedQuarantineTest
AddressSanitizer-Unit ::
./Asan-i386-inline-Noinst-Test/AddressSanitizer.ThreadedQuarantineTest
AddressSanitizer-Unit ::
./Asan-x86_64-calls-Noinst-Test/AddressSanitizer.ThreadedQuarantineTest
AddressSanitizer-Unit ::
./Asan-x86_64-calls-Test/AddressSanitizerInterface.ManyThreadsWithStatsStressTest
AddressSanitizer-Unit ::
./Asan-x86_64-inline-Noinst-Test/AddressSanitizer.ThreadedQuarantineTest
AddressSanitizer-Unit ::
./Asan-x86_64-inline-Test/AddressSanitizerInterface.ManyThreadsWithStatsStressTest
AddressSanitizer-i386-netbsd :: TestCases/Posix/coverage-reset.cc
AddressSanitizer-i386-netbsd :: TestCases/Posix/coverage.cc
AddressSanitizer-i386-netbsd :: TestCases/Posix/dlclose-test.cc
AddressSanitizer-i386-netbsd ::
TestCases/Posix/interception-in-shared-lib-test.cc
AddressSanitizer-i386-netbsd ::
TestCases/Posix/stack-use-after-return.cc
AddressSanitizer-i386-netbsd :: TestCases/intercept-rethrow-exception.cc
AddressSanitizer-i386-netbsd :: TestCases/suppressions-library.cc
AddressSanitizer-x86_64-netbsd ::
TestCases/Posix/stack-use-after-return.cc
AddressSanitizer-x86_64-netbsd :: TestCases/Posix/tsd_dtor_leak.cc
AddressSanitizer-x86_64-netbsd ::
TestCases/intercept-rethrow-exception.cc
Expected Passes : 666
Expected Failures : 4
Unsupported Tests : 440
Unexpected Failures: 16
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=1e50b688782a959ffe9dc2eb525b9a6d38384bf5
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
compiler-rt-netbsd/distinfo | 3 ++
compiler-rt-netbsd/patches/patch-CMakeLists.txt | 13 ++++++++
.../patches/patch-lib_asan_asan__mapping.h | 35 ++++++++++++++++++++++
.../patches/patch-lib_asan_asan__thread.cc | 18 +++++++++++
4 files changed, 69 insertions(+)
diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index ddad7650c0..13fbea3359 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -1,7 +1,10 @@
$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__mapping.h) = 1975314eb61f14b9fabbcfee20de63dc724d809c
SHA1 (patch-lib_asan_asan__posix.cc) = 0f596061c078eaab0b5b4b183550aa7820677f46
+SHA1 (patch-lib_asan_asan__thread.cc) = 6408c904c1f3adbebff56aaf63f953f5b8b02bef
SHA1 (patch-lib_fuzzer_FuzzerShmemPosix.cpp) = e2540a9385d641c77a2b5da49a2ac66313db8a94
SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 0e559ebb791942cba9c83f3098d7752f91e1f187
SHA1 (patch-lib_msan_msan__interceptors.cc) = 79bfe137923597d79bb467d0f282d57221079a85
diff --git a/compiler-rt-netbsd/patches/patch-CMakeLists.txt b/compiler-rt-netbsd/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..918fd449eb
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-CMakeLists.txt
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- CMakeLists.txt.orig 2018-04-25 21:13:40.000000000 +0000
++++ CMakeLists.txt
+@@ -353,7 +353,7 @@ foreach(path IN ITEMS ${LLVM_MAIN_SRC_DI
+ ${LLVM_MAIN_SRC_DIR}/../libcxx
+ ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
+ if(IS_DIRECTORY ${path})
+- set(COMPILER_RT_LIBCXX_PATH ${path})
++# set(COMPILER_RT_LIBCXX_PATH ${path})
+ break()
+ endif()
+ endforeach()
diff --git a/compiler-rt-netbsd/patches/patch-lib_asan_asan__mapping.h b/compiler-rt-netbsd/patches/patch-lib_asan_asan__mapping.h
new file mode 100644
index 0000000000..21e2a44d18
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_asan_asan__mapping.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- lib/asan/asan_mapping.h.orig 2018-02-01 23:46:05.000000000 +0000
++++ lib/asan/asan_mapping.h
+@@ -122,6 +122,13 @@
+ // || `[0x400000000000, 0x47ffffffffff]` || LowShadow ||
+ // || `[0x000000000000, 0x3fffffffffff]` || LowMem ||
+ //
++// Shadow mapping on NerBSD/i386 with SHADOW_OFFSET == 0x40000000:
++// || `[0x60000000, 0xfffff000]` || HighMem ||
++// || `[0x4c000000, 0x5fffffff]` || HighShadow ||
++// || `[0x48000000, 0x4bffffff]` || ShadowGap ||
++// || `[0x40000000, 0x47ffffff]` || LowShadow ||
++// || `[0x00000000, 0x3fffffff]` || LowMem ||
++//
+ // Default Windows/i386 mapping:
+ // (the exact location of HighShadow/HighMem may vary depending
+ // on WoW64, /LARGEADDRESSAWARE, etc).
+@@ -152,6 +159,7 @@ static const u64 kPPC64_ShadowOffset64 =
+ static const u64 kSystemZ_ShadowOffset64 = 1ULL << 52;
+ static const u64 kFreeBSD_ShadowOffset32 = 1ULL << 30; // 0x40000000
+ static const u64 kFreeBSD_ShadowOffset64 = 1ULL << 46; // 0x400000000000
++static const u64 kNetBSD_ShadowOffset32 = 1ULL << 30; // 0x40000000
+ static const u64 kNetBSD_ShadowOffset64 = 1ULL << 46; // 0x400000000000
+ static const u64 kWindowsShadowOffset32 = 3ULL << 28; // 0x30000000
+
+@@ -166,6 +174,8 @@ static const u64 kWindowsShadowOffset32
+ # define SHADOW_OFFSET kMIPS32_ShadowOffset32
+ # elif SANITIZER_FREEBSD
+ # define SHADOW_OFFSET kFreeBSD_ShadowOffset32
++# elif SANITIZER_NETBSD
++# define SHADOW_OFFSET kNetBSD_ShadowOffset32
+ # elif SANITIZER_WINDOWS
+ # define SHADOW_OFFSET kWindowsShadowOffset32
+ # elif SANITIZER_IOS
diff --git a/compiler-rt-netbsd/patches/patch-lib_asan_asan__thread.cc b/compiler-rt-netbsd/patches/patch-lib_asan_asan__thread.cc
new file mode 100644
index 0000000000..0fca848eb0
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_asan_asan__thread.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- lib/asan/asan_thread.cc.orig 2018-02-01 23:46:05.000000000 +0000
++++ lib/asan/asan_thread.cc
+@@ -300,8 +300,11 @@ void AsanThread::SetThreadStackAndTls(co
+
+ void AsanThread::ClearShadowForThreadStackAndTLS() {
+ PoisonShadow(stack_bottom_, stack_top_ - stack_bottom_, 0);
+- if (tls_begin_ != tls_end_)
+- PoisonShadow(tls_begin_, tls_end_ - tls_begin_, 0);
++ if (tls_begin_ != tls_end_) {
++ uptr tls_begin_aligned = RoundDownTo(tls_begin_, SHADOW_GRANULARITY);
++ uptr tls_end_aligned = RoundUpTo(tls_end_, SHADOW_GRANULARITY);
++ PoisonShadow(tls_begin_aligned, tls_end_aligned - tls_begin_aligned, 0);
++ }
+ }
+
+ bool AsanThread::GetStackFrameAccessByAddr(uptr addr,
Home |
Main Index |
Thread Index |
Old Index