[PATCH] D30504: [sanitizer] Bail out with warning if user dlopens shared library with RTLD_DEEPBIND flag
Yury Gribov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 1 10:21:30 PST 2017
ygribov added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_common.cc:485
+ "). If you want to run your library under sanitizers please remove "
+ "RTLD_DEEPBIND from dlopen flags.\n");
+ Die();
----------------
Does it make sense to print backtrace?
================
Comment at: test/sanitizer_common/TestCases/Posix/deepbind.cc:1
+// RUN: %clangxx -DSHARED_LIB %s -fPIC -shared -o %t-so.so
+// RUN: %clangxx %s -o %t && %run %t 2>&1
----------------
Do you need shlib at all? You don't care if `dlopen` succeeds so can call it with arbitrary path.
================
Comment at: test/sanitizer_common/TestCases/Posix/deepbind.cc:4
+// RUN: %run not %t 1 2>&1 | FileCheck %s --check-prefix CHECK-DEEPBIND
+// UNSUPPORTED: lsan, android
+
----------------
Android does not have it?
================
Comment at: test/sanitizer_common/TestCases/Posix/deepbind.cc:18
+ // CHECK-DEEPBIND: You are trying to dlopen a shared library with RTLD_DEEPBIND flag
+ void *lib = dlopen(path.c_str(), flag);
+ if (!lib) {
----------------
You can just `return 0` after this.
Repository:
rL LLVM
https://reviews.llvm.org/D30504
More information about the llvm-commits
mailing list