summaryrefslogtreecommitdiff
path: root/test/asan
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-06-14 10:42:54 +0000
committerPeter Wu <peter@lekensteyn.nl>2018-06-14 10:42:54 +0000
commitaed80b5b51616f3148025a803fb1153281e3bb4b (patch)
tree39f274381e3f3ece08c4b11005a2283362fcd6f4 /test/asan
parentd19a9bb9e8914439da44e9199be59dbdc7e32730 (diff)
[ASAN] fix startup crash in dlsym for long paths since glibc 2.27
Summary: Error messages for dlsym used to be stored on the stack, but since commit 2449ae7b ("ld.so: Introduce struct dl_exception") in glibc 2.27 these are now stored on the heap (and thus use the dlsym alloc pool). Messages look like "undefined symbol: __isoc99_printf\0/path/to/a.out". With many missing library functions and long object paths, the pool is quickly exhausted. Implement a simple mechanism to return freed memory to the pool (clear it in case it is used for calloc). Fixes https://github.com/google/sanitizers/issues/957 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D47995 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan')
-rw-r--r--test/asan/TestCases/long-object-path.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/asan/TestCases/long-object-path.cc b/test/asan/TestCases/long-object-path.cc
new file mode 100644
index 000000000..592b0abb0
--- /dev/null
+++ b/test/asan/TestCases/long-object-path.cc
@@ -0,0 +1,7 @@
+// RUN: mkdir -p %T/a-long-directory-name-to-test-allocations-for-exceptions-in-_dl_lookup_symbol_x-since-glibc-2.27
+// RUN: %clangxx_asan -g %s -o %T/long-object-path
+// RUN: %run %T/a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../long-object-path
+
+int main(void) {
+ return 0;
+}