[PATCH] D31420: [asan] Move AsanCheckDynamicRTPrereqs check under flag.

Maxim Ostapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 07:07:38 PDT 2017


m.ostapenko created this revision.
m.ostapenko added a project: Sanitizers.
Herald added a subscriber: kubamracek.

The patch addresses https://github.com/google/sanitizers/issues/786. Currently AsanCheckDynamicRTPrereqs prevents ASan 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.


Repository:
  rL LLVM

https://reviews.llvm.org/D31420

Files:
  lib/asan/asan_flags.inc
  lib/asan/asan_linux.cc
  test/asan/TestCases/Linux/asan_dlopen_test.cc


Index: test/asan/TestCases/Linux/asan_dlopen_test.cc
===================================================================
--- test/asan/TestCases/Linux/asan_dlopen_test.cc
+++ 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=check_dynamic_rt_prereqs=true not %run %t 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=check_dynamic_rt_prereqs=false %run %t 2>&1
 // REQUIRES: asan-dynamic-runtime
 // XFAIL: android
 
Index: lib/asan/asan_linux.cc
===================================================================
--- lib/asan/asan_linux.cc
+++ lib/asan/asan_linux.cc
@@ -111,7 +111,7 @@
 }
 
 void AsanCheckDynamicRTPrereqs() {
-  if (!ASAN_DYNAMIC)
+  if (!ASAN_DYNAMIC || !flags()->check_dynamic_rt_prereqs)
     return;
 
   // Ensure that dynamic RT is the first DSO in the list
Index: lib/asan/asan_flags.inc
===================================================================
--- lib/asan/asan_flags.inc
+++ lib/asan/asan_flags.inc
@@ -148,3 +148,5 @@
           "(WARNING: USE AT YOUR OWN RISK!)")
 ASAN_FLAG(bool, use_odr_indicator, false,
           "Use special ODR indicator symbol for ODR violation detection")
+ASAN_FLAG(bool, check_dynamic_rt_prereqs, true,
+          "Check that dynamic ASan runtime comes first in initial library list")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31420.93236.patch
Type: text/x-patch
Size: 1388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170328/4bbd7b0a/attachment.bin>


More information about the llvm-commits mailing list