diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-22 19:20:24 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-22 19:20:24 +0000 |
commit | 9c710df9281cb5cffa849396f28c8fe1fc9f1be5 (patch) | |
tree | 3451054a07a2086459ee553883b5773d5b5f860f /contrib/compiler-rt/lib/asan/asan_rtl.cc | |
parent | 58a7b5d64a70fcdddb5dc4c92e53d9d3abcb5ae6 (diff) | |
parent | 0646903fc1f75f6e605754621119473ee083f4a4 (diff) | |
download | src-9c710df9281cb5cffa849396f28c8fe1fc9f1be5.tar.gz src-9c710df9281cb5cffa849396f28c8fe1fc9f1be5.zip |
Merge compiler-rt trunk r351319, and resolve conflicts.
Notes
Notes:
svn path=/projects/clang800-import/; revision=343311
Diffstat (limited to 'contrib/compiler-rt/lib/asan/asan_rtl.cc')
-rw-r--r-- | contrib/compiler-rt/lib/asan/asan_rtl.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/compiler-rt/lib/asan/asan_rtl.cc b/contrib/compiler-rt/lib/asan/asan_rtl.cc index 4cff736f213a..13344f3b8887 100644 --- a/contrib/compiler-rt/lib/asan/asan_rtl.cc +++ b/contrib/compiler-rt/lib/asan/asan_rtl.cc @@ -383,6 +383,19 @@ void PrintAddressSpaceLayout() { kHighShadowBeg > kMidMemEnd); } +#if defined(__thumb__) && defined(__linux__) +#define START_BACKGROUND_THREAD_IN_ASAN_INTERNAL +#endif + +#ifndef START_BACKGROUND_THREAD_IN_ASAN_INTERNAL +static bool UNUSED __local_asan_dyninit = [] { + MaybeStartBackgroudThread(); + SetSoftRssLimitExceededCallback(AsanSoftRssLimitExceededCallback); + + return false; +}(); +#endif + static void AsanInitInternal() { if (LIKELY(asan_inited)) return; SanitizerToolName = "AddressSanitizer"; @@ -396,6 +409,14 @@ static void AsanInitInternal() { // initialization steps look at flags(). InitializeFlags(); + // Stop performing init at this point if we are being loaded via + // dlopen() and the platform supports it. + if (SANITIZER_SUPPORTS_INIT_FOR_DLOPEN && UNLIKELY(HandleDlopenInit())) { + asan_init_is_running = false; + VReport(1, "AddressSanitizer init is being performed for dlopen().\n"); + return; + } + AsanCheckIncompatibleRT(); AsanCheckDynamicRTPrereqs(); AvoidCVE_2016_2143(); @@ -420,6 +441,8 @@ static void AsanInitInternal() { __asan_option_detect_stack_use_after_return = flags()->detect_stack_use_after_return; + __sanitizer::InitializePlatformEarly(); + // Re-exec ourselves if we need to set additional env or command line args. MaybeReexec(); @@ -447,8 +470,10 @@ static void AsanInitInternal() { allocator_options.SetFrom(flags(), common_flags()); InitializeAllocator(allocator_options); +#ifdef START_BACKGROUND_THREAD_IN_ASAN_INTERNAL MaybeStartBackgroudThread(); SetSoftRssLimitExceededCallback(AsanSoftRssLimitExceededCallback); +#endif // On Linux AsanThread::ThreadStart() calls malloc() that's why asan_inited // should be set to 1 prior to initializing the threads. |