[compiler-rt] r195131 - [asan] remove a fixed FIXME; extend the comment around __sanitizer_annotate_contiguous_container

Kostya Serebryany kcc at google.com
Tue Nov 19 06:54:14 PST 2013


Author: kcc
Date: Tue Nov 19 08:54:14 2013
New Revision: 195131

URL: http://llvm.org/viewvc/llvm-project?rev=195131&view=rev
Log:
[asan] remove a fixed FIXME; extend the comment around __sanitizer_annotate_contiguous_container

Modified:
    compiler-rt/trunk/include/sanitizer/common_interface_defs.h
    compiler-rt/trunk/lib/asan/asan_poisoning.cc

Modified: compiler-rt/trunk/include/sanitizer/common_interface_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/common_interface_defs.h?rev=195131&r1=195130&r2=195131&view=diff
==============================================================================
--- compiler-rt/trunk/include/sanitizer/common_interface_defs.h (original)
+++ compiler-rt/trunk/include/sanitizer/common_interface_defs.h Tue Nov 19 08:54:14 2013
@@ -70,7 +70,16 @@ extern "C" {
   //
   // Use with caution and don't use for anything other than vector-like classes.
   //
-  // For AddressSanitizer, 'beg' should be 8-aligned.
+  // For AddressSanitizer, 'beg' should be 8-aligned and 'end' should
+  // be either 8-aligned or it should point to the end of a separate heap-,
+  // stack-, or global- allocated buffer. I.e. the following will not work:
+  //   int64_t x[2];  // 16 bytes, 8-aligned.
+  //   char *beg = (char *)&x[0];
+  //   char *end = beg + 12;  // Not 8 aligned, not the end of the buffer.
+  // This however will work fine:
+  //   int32_t x[3];  // 12 bytes, but 8-aligned under AddressSanitizer.
+  //   char *beg = (char*)&x[0];
+  //   char *end = beg + 12;  // Not 8-aligned, but is the end of the buffer.
   void __sanitizer_annotate_contiguous_container(const void *beg,
                                                  const void *end,
                                                  const void *old_mid,

Modified: compiler-rt/trunk/lib/asan/asan_poisoning.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_poisoning.cc?rev=195131&r1=195130&r2=195131&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_poisoning.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_poisoning.cc Tue Nov 19 08:54:14 2013
@@ -292,7 +292,6 @@ void __sanitizer_annotate_contiguous_con
   uptr b2 = RoundUpTo(new_mid, granularity);
   // New state:
   // [a, b1) is good, [b2, c) is bad, [b1, b2) is partially good.
-  // FIXME: we may want to have a separate poison magic value.
   PoisonShadow(a, b1 - a, 0);
   PoisonShadow(b2, c - b2, kAsanContiguousContainerOOBMagic);
   if (b1 != b2) {





More information about the llvm-commits mailing list