[PATCH] make asan work with 7fff8000 offset and prelink

Alexey Samsonov samsonov at google.com
Fri Feb 15 03:21:29 PST 2013


  LGTM (it's a pity we need all this, though).


================
Comment at: include/sanitizer/asan_interface.h:40
@@ -39,3 +39,3 @@
 
-  // User code should use macro instead of functions.
-#if __has_feature(address_sanitizer)
+#if !defined(__has_feature)
+#define __has_feature(x) 0
----------------
This should probably go to common_interface_defs.h.
I wonder why eugenis@ didn't needed this macro in msan_interface.h...

================
Comment at: lib/asan/asan_internal.h:57
@@ -56,2 +56,3 @@
 
-#if __has_feature(address_sanitizer)
+#if !defined(__has_feature)
+#define __has_feature(x) 0
----------------
And this can go to lib/sanitizer_common/sanitizer_internal_defs.h

================
Comment at: lib/asan/asan_mapping.h:192
@@ +191,3 @@
+    return (a >= kShadowGap2Beg && a <= kShadowGap2End)
+        || (a >= kShadowGap3Beg && a <= kShadowGap3End);
+  }
----------------
Put || on the previous line

================
Comment at: lib/asan/lit_tests/Linux/asan_prelink_test.cc:2
@@ +1,3 @@
+// RUN: %clangxx_asan -m64 -c %s -o %t.o
+// RUN: %clangxx_asan -m64 -DBUILD_SO=1 -fPIC -shared %s -o %t.so -Wl,-Ttext-segment=0x3600000000 || exit 0
+// RUN: %clangxx_asan -m64 %t.o %t.so -Wl,-R. -o %t
----------------
Please add a comment clarifying || exit 0 and lacking support in gold.

================
Comment at: lib/asan/asan_rtl.cc:392
@@ -357,2 +391,3 @@
+
   if (flags()->verbosity) {
     Printf("|| `[%p, %p]` || HighMem    ||\n",
----------------
I'd prefer to factor printing the shadow layout in a separate function.

================
Comment at: lib/asan/asan_rtl.cc:435
@@ -380,1 +434,3 @@
+      CHECK(kMidShadowBeg > kLowShadowEnd && kMidMemBeg > kMidShadowEnd
+            && kHighShadowBeg > kMidMemEnd);
   }
----------------
&& on the previous line as well (I think it's adviced by clang-format).

================
Comment at: lib/asan/asan_rtl.cc:451
@@ +450,3 @@
+  } else if (kMidMemBeg
+      && MemoryRangeIsAvailable(shadow_start, kMidMemBeg - 1)
+      && MemoryRangeIsAvailable(kMidMemEnd + 1, shadow_end)) {
----------------
ditto


http://llvm-reviews.chandlerc.com/D411



More information about the llvm-commits mailing list