From 81b175747d2c7831c010e7e94a6f2572d6dfe437 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 26 May 2017 15:14:52 +0900 Subject: [PATCH] linker: disable ld.config.txt in ASAN mode Currently, multiple namespaces does not support ASAN mode where some symbols should be intercepted via LD_PRELOAD; LD_PRELOADed libs are not preloaded into the linked namespaces other than the default namespace. Until we fix the problem, we temporarily disable ld.config.txt in ASAN mode. Bug: 38114603 Test: 1. ./external/compiler-rt/lib/asan/scripts/asan_device_setup --lib prebuilts/clang/host/linux-x86/clang-stable/lib64/clang/3.8/lib/linux 2. enable talkback shortcut 3. in the home screen, hold vol-up/down together 4. device does not reboots and talkback shortcut is toggled Test: bionic-unit-tests and linker-unit-tests successful Change-Id: I091874dd36b36f56dff2ad899d76ff86931909ed --- linker/linker_config.cpp | 9 +++++++++ linker/tests/linker_config_test.cpp | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp index b9205cc82..a3982604e 100644 --- a/linker/linker_config.cpp +++ b/linker/linker_config.cpp @@ -370,6 +370,15 @@ bool Config::read_binary_config(const char* ld_config_file_path, bool is_asan, const Config** config, std::string* error_msg) { + // TODO(b/38114603) Currently, multiple namespaces does not support ASAN mode + // where some symbols should be intercepted via LD_PRELOAD; LD_PRELOADed libs + // are not being preloaded into the linked namespaces other than the default + // namespace. Until we fix the problem, we temporarily disable ld.config.txt + // in ASAN mode. + if (is_asan) { + return false; + } + g_config.clear(); std::unordered_map property_map; diff --git a/linker/tests/linker_config_test.cpp b/linker/tests/linker_config_test.cpp index 4889b14b7..f563ca59e 100644 --- a/linker/tests/linker_config_test.cpp +++ b/linker/tests/linker_config_test.cpp @@ -176,6 +176,7 @@ TEST(linker_config, smoke) { run_linker_config_smoke_test(false); } -TEST(linker_config, asan_smoke) { - run_linker_config_smoke_test(true); -} +// TODO(b/38114603) revive this test when ld.config.txt is enabled for ASAN mode +//TEST(linker_config, asan_smoke) { +// run_linker_config_smoke_test(true); +//}