[llvm-commits] [compiler-rt] r152341 - in /compiler-rt/trunk/lib/asan: Makefile.old asan_linux.cc asan_procmaps.h

Kostya Serebryany kcc at google.com
Thu Mar 8 13:19:07 PST 2012


Author: kcc
Date: Thu Mar  8 15:19:07 2012
New Revision: 152341

URL: http://llvm.org/viewvc/llvm-project?rev=152341&view=rev
Log:
[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.

Modified:
    compiler-rt/trunk/lib/asan/Makefile.old
    compiler-rt/trunk/lib/asan/asan_linux.cc
    compiler-rt/trunk/lib/asan/asan_procmaps.h

Modified: compiler-rt/trunk/lib/asan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/Makefile.old?rev=152341&r1=152340&r2=152341&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/Makefile.old (original)
+++ compiler-rt/trunk/lib/asan/Makefile.old Thu Mar  8 15:19:07 2012
@@ -175,6 +175,7 @@
 	asan_lock.h \
 	asan_mac.h \
 	asan_mapping.h \
+	asan_procmaps.h \
 	asan_stack.h \
 	asan_stats.h \
 	asan_thread.h \

Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=152341&r1=152340&r2=152341&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_linux.cc Thu Mar  8 15:19:07 2012
@@ -213,7 +213,7 @@
   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 @@
   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;

Modified: compiler-rt/trunk/lib/asan/asan_procmaps.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_procmaps.h?rev=152341&r1=152340&r2=152341&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_procmaps.h (original)
+++ compiler-rt/trunk/lib/asan/asan_procmaps.h Thu Mar  8 15:19:07 2012
@@ -37,10 +37,11 @@
                                      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;
       }
     }





More information about the llvm-commits mailing list