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

Maxim Ostapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 02:54:11 PDT 2017


m.ostapenko updated this revision to Diff 93457.
m.ostapenko added a comment.

Changed flag name.


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=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
 
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()->verify_asan_link_order)
     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
@@ -152,3 +152,6 @@
           "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)")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31420.93457.patch
Type: text/x-patch
Size: 1502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170330/505ce4b6/attachment.bin>


More information about the llvm-commits mailing list