diff options
| author | Kostya Serebryany <kcc@google.com> | 2012-03-08 21:19:07 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2012-03-08 21:19:07 +0000 |
| commit | c7835f301ee5a832e477c9785d07d89f60fde5c4 (patch) | |
| tree | 54e1d3b6f114759e1ed444ac4d2b9d4b2a621b4b | |
| parent | 04fe1bf52e7f802681b93630f4b265b4e6642dcc (diff) | |
| download | bcm5719-llvm-c7835f301ee5a832e477c9785d07d89f60fde5c4.tar.gz bcm5719-llvm-c7835f301ee5a832e477c9785d07d89f60fde5c4.zip | |
[asan] don't use dl_iterate_phdr on linux, go back to using /proc/self/maps. Hopefully fixes the problem reported by our mozilla friends.
llvm-svn: 152341
| -rw-r--r-- | compiler-rt/lib/asan/Makefile.old | 1 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_linux.cc | 7 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_procmaps.h | 7 |
3 files changed, 9 insertions, 6 deletions
diff --git a/compiler-rt/lib/asan/Makefile.old b/compiler-rt/lib/asan/Makefile.old index ace105b9ed1..9792367e17b 100644 --- a/compiler-rt/lib/asan/Makefile.old +++ b/compiler-rt/lib/asan/Makefile.old @@ -175,6 +175,7 @@ RTL_HDR=asan_allocator.h \ asan_lock.h \ asan_mac.h \ asan_mapping.h \ + asan_procmaps.h \ asan_stack.h \ asan_stats.h \ asan_thread.h \ diff --git a/compiler-rt/lib/asan/asan_linux.cc b/compiler-rt/lib/asan/asan_linux.cc index 14fc3e5fdcd..40f9f94d028 100644 --- a/compiler-rt/lib/asan/asan_linux.cc +++ b/compiler-rt/lib/asan/asan_linux.cc @@ -213,7 +213,7 @@ bool AsanProcMaps::Next(uintptr_t *start, uintptr_t *end, return true; } -#ifdef __arm__ +#if 1 // Gets the object name and the offset by walking AsanProcMaps. bool AsanProcMaps::GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset, @@ -222,8 +222,9 @@ bool AsanProcMaps::GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset, return IterateForObjectNameAndOffset(addr, offset, filename, filename_size); } -#else // __arm__ - +#else +// dl_iterate_phdr machinery is not working well for us. +// We either need to fix it or get rid of it. struct DlIterateData { int count; uintptr_t addr; diff --git a/compiler-rt/lib/asan/asan_procmaps.h b/compiler-rt/lib/asan/asan_procmaps.h index 6dd42f9f653..5ae5fb238b6 100644 --- a/compiler-rt/lib/asan/asan_procmaps.h +++ b/compiler-rt/lib/asan/asan_procmaps.h @@ -37,10 +37,11 @@ class AsanProcMaps { char filename[], size_t filename_size) { Reset(); uintptr_t start, end, file_offset; - while (Next(&start, &end, &file_offset, - filename, filename_size)) { + for (int i = 0; Next(&start, &end, &file_offset, filename, filename_size); + i++) { if (addr >= start && addr < end) { - *offset = (addr - start) + file_offset; + // Don't subtract 'start' for the first entry. Don't ask me why. + *offset = (addr - (i ? start : 0)) + file_offset; return true; } } |

