diff options
author | Maxim Ostapenko <chefmax7@gmail.com> | 2017-03-31 06:36:37 +0000 |
---|---|---|
committer | Maxim Ostapenko <chefmax7@gmail.com> | 2017-03-31 06:36:37 +0000 |
commit | 00f49884313e8e13ee62216b011cab5ecd5bbd7c (patch) | |
tree | f7cfa91549fb42799223078018b0071e3ff5b71d | |
parent | be5ba6663d03af0a4b8207c212edc44148fd1ef4 (diff) |
[asan] Move AsanCheckDynamicRTPrereqs check under flag
The patch addresses https://github.com/google/sanitizers/issues/786. Currently AsanCheckDynamicRTPrereqs prevents
dynamic ASan runtime from running in some important environments e.g. cowbuilder and fakeroot that may also work with interposition.
Let's allow users to switch off the check given that they know what they do.
Differential Revision: https://reviews.llvm.org/D31420
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299188 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_flags.inc | 3 | ||||
-rw-r--r-- | lib/asan/asan_linux.cc | 2 | ||||
-rw-r--r-- | test/asan/TestCases/Linux/asan_dlopen_test.cc | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/asan/asan_flags.inc b/lib/asan/asan_flags.inc index 65a1d173f..f2216c2e9 100644 --- a/lib/asan/asan_flags.inc +++ b/lib/asan/asan_flags.inc @@ -158,3 +158,6 @@ ASAN_FLAG(bool, allocator_frees_and_returns_null_on_realloc_zero, true, "realloc(p, 0) is equivalent to free(p) by default (Same as the " "POSIX standard). If set to false, realloc(p, 0) will return a " "pointer to an allocated space which can not be used.") +ASAN_FLAG(bool, verify_asan_link_order, true, + "Check position of ASan runtime in library list (needs to be disabled" + " when other library has to be preloaded system-wide)") diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc index 6d150de79..50ef84c39 100644 --- a/lib/asan/asan_linux.cc +++ b/lib/asan/asan_linux.cc @@ -111,7 +111,7 @@ static void ReportIncompatibleRT() { } void AsanCheckDynamicRTPrereqs() { - if (!ASAN_DYNAMIC) + if (!ASAN_DYNAMIC || !flags()->verify_asan_link_order) return; // Ensure that dynamic RT is the first DSO in the list diff --git a/test/asan/TestCases/Linux/asan_dlopen_test.cc b/test/asan/TestCases/Linux/asan_dlopen_test.cc index f1e31b0a0..5081b7753 100644 --- a/test/asan/TestCases/Linux/asan_dlopen_test.cc +++ b/test/asan/TestCases/Linux/asan_dlopen_test.cc @@ -2,6 +2,8 @@ // // RUN: %clangxx %s -DRT=\"%shared_libasan\" -o %t -ldl // RUN: not %run %t 2>&1 | FileCheck %s +// RUN: %env_asan_opts=verify_asan_link_order=true not %run %t 2>&1 | FileCheck %s +// RUN: %env_asan_opts=verify_asan_link_order=false %run %t 2>&1 // REQUIRES: asan-dynamic-runtime // XFAIL: android |