vitalybuka updated this revision to Diff 376351.
vitalybuka added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

documentation


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110880/new/

https://reviews.llvm.org/D110880

Files:
  clang/docs/MemorySanitizer.rst
  compiler-rt/lib/msan/msan.cpp
  compiler-rt/lib/msan/msan.h
  compiler-rt/lib/msan/msan_allocator.cpp
  compiler-rt/lib/msan/msan_interceptors.cpp
  compiler-rt/lib/msan/msan_report.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
  compiler-rt/test/msan/chained_origin.cpp
  compiler-rt/test/msan/check_mem_is_initialized.cpp
  compiler-rt/test/msan/dso-origin.cpp
  compiler-rt/test/msan/heap-origin.cpp
  compiler-rt/test/msan/insertvalue_origin.cpp
  compiler-rt/test/msan/msan_copy_shadow.cpp
  compiler-rt/test/msan/msan_print_shadow.cpp
  compiler-rt/test/msan/origin-store-long.cpp
  compiler-rt/test/msan/realloc-large-origin.cpp
  compiler-rt/test/msan/realloc-origin.cpp
  compiler-rt/test/msan/select_float_origin.cpp
  compiler-rt/test/msan/use-after-dtor.cpp
  compiler-rt/test/msan/use-after-free.cpp
  compiler-rt/test/msan/wcsncpy.cpp

Index: compiler-rt/test/msan/wcsncpy.cpp
===================================================================
--- compiler-rt/test/msan/wcsncpy.cpp
+++ compiler-rt/test/msan/wcsncpy.cpp
@@ -35,6 +35,6 @@
 // CHECK:    in {{[^\s]*}}wcsncpy
 // CHECK:    in main {{.*}}wcsncpy.cpp:27
 
-// CHECK:  Memory was marked as uninitialized
+// CHECK:  Uninitialized value was created
 // CHECK:    in __msan_allocated_memory
 // CHECK:    in main {{.*}}wcsncpy.cpp:25
Index: compiler-rt/test/msan/use-after-free.cpp
===================================================================
--- compiler-rt/test/msan/use-after-free.cpp
+++ compiler-rt/test/msan/use-after-free.cpp
@@ -27,7 +27,7 @@
   // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
   // CHECK: {{#0 0x.* in main .*use-after-free.cpp:}}[[@LINE-3]]
 
-  // CHECK-ORIGINS: Uninitialized value was created by a heap deallocation
+  // CHECK-ORIGINS: Uninitialized value was created
   // CHECK-ORIGINS: {{#0 0x.* in .*free}}
   // CHECK-ORIGINS: {{#1 0x.* in main .*use-after-free.cpp:}}[[@LINE-9]]
   return 0;
Index: compiler-rt/test/msan/use-after-dtor.cpp
===================================================================
--- compiler-rt/test/msan/use-after-dtor.cpp
+++ compiler-rt/test/msan/use-after-dtor.cpp
@@ -41,7 +41,7 @@
   // CHECK-UAD: WARNING: MemorySanitizer: use-of-uninitialized-value
   // CHECK-UAD: {{#0 0x.* in main.*use-after-dtor.cpp:}}[[@LINE-3]]
 
-  // CHECK-ORIGINS: Memory was marked as uninitialized
+  // CHECK-ORIGINS: Uninitialized value was created
   // CHECK-ORIGINS: {{#0 0x.* in __sanitizer_dtor_callback}}
   // CHECK-ORIGINS: {{#1 0x.* in .*~Simple}}
 
Index: compiler-rt/test/msan/select_float_origin.cpp
===================================================================
--- compiler-rt/test/msan/select_float_origin.cpp
+++ compiler-rt/test/msan/select_float_origin.cpp
@@ -17,7 +17,7 @@
   __msan_allocated_memory(&y, sizeof(y));
   float z = b ? x : y;
   if (z > 0) printf(".\n");
-  // CHECK: Memory was marked as uninitialized
+  // CHECK: Uninitialized value was created
   // CHECK: {{#0 0x.* in .*__msan_allocated_memory}}
   // CHECK: {{#1 0x.* in main .*select_float_origin.cpp:}}[[@LINE-6]]
   return 0;
Index: compiler-rt/test/msan/realloc-origin.cpp
===================================================================
--- compiler-rt/test/msan/realloc-origin.cpp
+++ compiler-rt/test/msan/realloc-origin.cpp
@@ -15,7 +15,7 @@
   // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
   // CHECK: {{#0 0x.* in main .*realloc-origin.cpp:}}[[@LINE-2]]
 
-  // CHECK: Uninitialized value was created by a heap allocation
+  // CHECK: Uninitialized value was created
   // CHECK: {{#0 0x.* in .*realloc}}
   // CHECK: {{#1 0x.* in main .*realloc-origin.cpp:}}[[@LINE-9]]
 }
Index: compiler-rt/test/msan/realloc-large-origin.cpp
===================================================================
--- compiler-rt/test/msan/realloc-large-origin.cpp
+++ compiler-rt/test/msan/realloc-large-origin.cpp
@@ -25,7 +25,7 @@
 // CHECK-FULL-STACK:   {{#1 0x.* in main .*realloc-large-origin.cpp:}}[[@LINE-10]]
 // CHECK-SHORT-STACK:   {{#0 0x.* in .*realloc}}
 
-// CHECK:   Uninitialized value was created by a heap allocation
-// CHECK:   {{#0 0x.* in .*malloc}}
-// CHECK:   {{#1 0x.* in main .*realloc-large-origin.cpp:}}[[@LINE-16]]
+  // CHECK:   Uninitialized value was created
+  // CHECK:   {{#0 0x.* in .*malloc}}
+  // CHECK:   {{#1 0x.* in main .*realloc-large-origin.cpp:}}[[@LINE-16]]
 }
Index: compiler-rt/test/msan/origin-store-long.cpp
===================================================================
--- compiler-rt/test/msan/origin-store-long.cpp
+++ compiler-rt/test/msan/origin-store-long.cpp
@@ -15,7 +15,7 @@
 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
 // CHECK:   in main {{.*}}origin-store-long.cpp:[[@LINE-2]]
 
-// CHECK:  Uninitialized value was created by a heap allocation
-// CHECK:   in main {{.*}}origin-store-long.cpp:[[@LINE-8]]
+  // CHECK:  Uninitialized value was created
+  // CHECK:   in main {{.*}}origin-store-long.cpp:[[@LINE-8]]
 }
 
Index: compiler-rt/test/msan/msan_print_shadow.cpp
===================================================================
--- compiler-rt/test/msan/msan_print_shadow.cpp
+++ compiler-rt/test/msan/msan_print_shadow.cpp
@@ -95,11 +95,11 @@
 // CHECK-ORIGINS: 0x{{.*}}: ffffffff ffffffff ffff.... ........  |A A A .|
 
 // CHECK-ORIGINS: Origin A (origin_id {{.*}}):
-// CHECK-ORIGINS:   Uninitialized value was created by a heap allocation
+// CHECK-ORIGINS:   Uninitialized value was created
 // CHECK-ORIGINS:     #1 {{.*}} in main{{.*}}msan_print_shadow.cpp:14
 
 // CHECK-ORIGINS: Origin B (origin_id {{.*}}):
-// CHECK-ORIGINS:   Memory was marked as uninitialized
+// CHECK-ORIGINS:   Uninitialized value was created
 // CHECK-ORIGINS:     #0 {{.*}} in __msan_allocated_memory
 // CHECK-ORIGINS:     #1 {{.*}} in main{{.*}}msan_print_shadow.cpp:18
 
@@ -110,13 +110,13 @@
 // CHECK-ORIGINS:     #0 {{.*}} in main{{.*}}msan_print_shadow.cpp:12
 
 // CHECK-ORIGINS: Origin D (origin_id {{.*}}):
-// CHECK-ORIGINS:   Memory was marked as uninitialized
+// CHECK-ORIGINS:   Uninitialized value was created
 // CHECK-ORIGINS:     #0 {{.*}} in __msan_allocated_memory
 // CHECK-ORIGINS:     #1 {{.*}} in main{{.*}}msan_print_shadow.cpp:20
 
 // ...
 
 // CHECK-ORIGINS: Origin Z (origin_id {{.*}}):
-// CHECK-ORIGINS:   Memory was marked as uninitialized
+// CHECK-ORIGINS:   Uninitialized value was created
 // CHECK-ORIGINS:     #0 {{.*}} in __msan_allocated_memory
 // CHECK-ORIGINS:     #1 {{.*}} in main{{.*}}msan_print_shadow.cpp:42
Index: compiler-rt/test/msan/msan_copy_shadow.cpp
===================================================================
--- compiler-rt/test/msan/msan_copy_shadow.cpp
+++ compiler-rt/test/msan/msan_copy_shadow.cpp
@@ -30,6 +30,6 @@
   // CHECK: Uninitialized value was stored to memory at
   // CHECK-FULL-STACK:   {{in main.*msan_copy_shadow.cpp:}}[[@LINE-8]]
   // CHECK-SHORT-STACK:   {{in __msan_copy_shadow .*msan_interceptors.cpp:}}
-  // CHECK: Uninitialized value was created by a heap allocation
+  // CHECK: Uninitialized value was created
   // CHECK:   {{in main.*msan_copy_shadow.cpp:}}[[@LINE-23]]
 }
Index: compiler-rt/test/msan/insertvalue_origin.cpp
===================================================================
--- compiler-rt/test/msan/insertvalue_origin.cpp
+++ compiler-rt/test/msan/insertvalue_origin.cpp
@@ -28,7 +28,7 @@
  // CHECK: MemorySanitizer: use-of-uninitialized-value
  // CHECK: {{in main .*insertvalue_origin.cpp:}}[[@LINE-3]]
 
- // CHECK: Uninitialized value was created by a heap allocation
+ // CHECK: Uninitialized value was created
  // CHECK: {{in main .*insertvalue_origin.cpp:}}[[@LINE-8]]
  delete p;
  return 0;
Index: compiler-rt/test/msan/heap-origin.cpp
===================================================================
--- compiler-rt/test/msan/heap-origin.cpp
+++ compiler-rt/test/msan/heap-origin.cpp
@@ -23,7 +23,7 @@
   // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
   // CHECK: {{#0 0x.* in main .*heap-origin.cpp:}}[[@LINE-2]]
 
-  // CHECK-ORIGINS: Uninitialized value was created by a heap allocation
+  // CHECK-ORIGINS: Uninitialized value was created
   // CHECK-ORIGINS: {{#0 0x.* in .*malloc}}
   // CHECK-ORIGINS: {{#1 0x.* in main .*heap-origin.cpp:}}[[@LINE-7]]
 
Index: compiler-rt/test/msan/dso-origin.cpp
===================================================================
--- compiler-rt/test/msan/dso-origin.cpp
+++ compiler-rt/test/msan/dso-origin.cpp
@@ -37,7 +37,7 @@
   // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
   // CHECK: {{#0 0x.* in my_access .*dso-origin.cpp:}}
   // CHECK: {{#1 0x.* in main .*dso-origin.cpp:}}[[@LINE-5]]
-  // CHECK: Uninitialized value was created by a heap allocation
+  // CHECK: Uninitialized value was created
   // CHECK: {{#0 0x.* in .*malloc}}
   // CHECK: {{#1 0x.* in my_alloc .*dso-origin.cpp:}}
   // CHECK: {{#2 0x.* in main .*dso-origin.cpp:}}[[@LINE-10]]
Index: compiler-rt/test/msan/check_mem_is_initialized.cpp
===================================================================
--- compiler-rt/test/msan/check_mem_is_initialized.cpp
+++ compiler-rt/test/msan/check_mem_is_initialized.cpp
@@ -26,7 +26,7 @@
   // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
   // CHECK: {{#0 0x.* in main .*check_mem_is_initialized.cpp:}}[[@LINE-2]]
 
-  // CHECK-ORIGINS: Uninitialized value was created by a heap allocation
+  // CHECK-ORIGINS: Uninitialized value was created
   // CHECK-ORIGINS: {{#0 0x.* in .*malloc}}
   // CHECK-ORIGINS: {{#1 0x.* in main .*check_mem_is_initialized.cpp:}}[[@LINE-8]]
   return 0;
Index: compiler-rt/test/msan/chained_origin.cpp
===================================================================
--- compiler-rt/test/msan/chained_origin.cpp
+++ compiler-rt/test/msan/chained_origin.cpp
@@ -63,5 +63,5 @@
 // CHECK-STACK: Uninitialized value was created by an allocation of 'z' in the stack frame of function 'main'
 // CHECK-STACK: {{#0 .* in main.*chained_origin.cpp:}}[[@LINE-27]]
 
-// CHECK-HEAP: Uninitialized value was created by a heap allocation
+// CHECK-HEAP: Uninitialized value was created
 // CHECK-HEAP: {{#1 .* in main.*chained_origin.cpp:}}[[@LINE-28]]
Index: compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
@@ -42,17 +42,9 @@
 struct StackTrace {
   const uptr *trace;
   u32 size;
-  u32 tag;
 
-  static const int TAG_UNKNOWN = 0;
-  static const int TAG_ALLOC = 1;
-  static const int TAG_DEALLOC = 2;
-  static const int TAG_CUSTOM = 100; // Tool specific tags start here.
-
-  StackTrace() : trace(nullptr), size(0), tag(0) {}
-  StackTrace(const uptr *trace, u32 size) : trace(trace), size(size), tag(0) {}
-  StackTrace(const uptr *trace, u32 size, u32 tag)
-      : trace(trace), size(size), tag(tag) {}
+  StackTrace() : trace(nullptr), size(0) {}
+  StackTrace(const uptr *trace, u32 size) : trace(trace), size(size) {}
 
   // Prints a symbolized stacktrace, followed by an empty line.
   void Print() const;
Index: compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
+++ compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
@@ -23,7 +23,6 @@
   u32 id;
   atomic_uint32_t hash_and_use_count; // hash_bits : 12; use_count : 20;
   u32 size;
-  u32 tag;
   uptr stack[1];  // [size]
 
   static const u32 kTabSizeLog = SANITIZER_ANDROID ? 16 : 20;
@@ -38,7 +37,7 @@
   bool eq(u32 hash, const args_type &args) const {
     u32 hash_bits =
         atomic_load(&hash_and_use_count, memory_order_relaxed) & kHashMask;
-    if ((hash & kHashMask) != hash_bits || args.size != size || args.tag != tag)
+    if ((hash & kHashMask) != hash_bits || args.size != size)
       return false;
     uptr i = 0;
     for (; i < size; i++) {
@@ -60,12 +59,9 @@
   void store(const args_type &args, u32 hash) {
     atomic_store(&hash_and_use_count, hash & kHashMask, memory_order_relaxed);
     size = args.size;
-    tag = args.tag;
     internal_memcpy(stack, args.trace, size * sizeof(uptr));
   }
-  args_type load() const {
-    return args_type(&stack[0], size, tag);
-  }
+  args_type load() const { return args_type(&stack[0], size); }
   StackDepotHandle get_handle() { return StackDepotHandle(this); }
 
   typedef StackDepotHandle handle_type;
Index: compiler-rt/lib/msan/msan_report.cpp
===================================================================
--- compiler-rt/lib/msan/msan_report.cpp
+++ compiler-rt/lib/msan/msan_report.cpp
@@ -73,24 +73,7 @@
     DescribeStackOrigin(so, pc);
   } else {
     StackTrace stack = o.getStackTraceForHeapOrigin();
-    switch (stack.tag) {
-      case StackTrace::TAG_ALLOC:
-        Printf("  %sUninitialized value was created by a heap allocation%s\n",
-               d.Origin(), d.Default());
-        break;
-      case StackTrace::TAG_DEALLOC:
-        Printf("  %sUninitialized value was created by a heap deallocation%s\n",
-               d.Origin(), d.Default());
-        break;
-      case STACK_TRACE_TAG_POISON:
-        Printf("  %sMemory was marked as uninitialized%s\n", d.Origin(),
-               d.Default());
-        break;
-      default:
-        Printf("  %sUninitialized value was created%s\n", d.Origin(),
-               d.Default());
-        break;
-    }
+    Printf("  %sUninitialized value was created%s\n", d.Origin(), d.Default());
     stack.Print();
   }
 }
Index: compiler-rt/lib/msan/msan_interceptors.cpp
===================================================================
--- compiler-rt/lib/msan/msan_interceptors.cpp
+++ compiler-rt/lib/msan/msan_interceptors.cpp
@@ -911,7 +911,6 @@
 void __msan_allocated_memory(const void *data, uptr size) {
   GET_MALLOC_STACK_TRACE;
   if (flags()->poison_in_malloc) {
-    stack.tag = STACK_TRACE_TAG_POISON;
     PoisonMemory(data, size, &stack);
   }
 }
@@ -924,7 +923,6 @@
 void __sanitizer_dtor_callback(const void *data, uptr size) {
   GET_MALLOC_STACK_TRACE;
   if (flags()->poison_in_dtor) {
-    stack.tag = STACK_TRACE_TAG_POISON;
     PoisonMemory(data, size, &stack);
   }
 }
Index: compiler-rt/lib/msan/msan_allocator.cpp
===================================================================
--- compiler-rt/lib/msan/msan_allocator.cpp
+++ compiler-rt/lib/msan/msan_allocator.cpp
@@ -184,7 +184,6 @@
   } else if (flags()->poison_in_malloc) {
     __msan_poison(allocated, size);
     if (__msan_get_track_origins()) {
-      stack->tag = StackTrace::TAG_ALLOC;
       Origin o = Origin::CreateHeapOrigin(stack);
       __msan_set_origin(allocated, size, o.raw_id());
     }
@@ -204,7 +203,6 @@
   if (flags()->poison_in_free) {
     __msan_poison(p, size);
     if (__msan_get_track_origins()) {
-      stack->tag = StackTrace::TAG_DEALLOC;
       Origin o = Origin::CreateHeapOrigin(stack);
       __msan_set_origin(p, size, o.raw_id());
     }
@@ -230,7 +228,6 @@
     meta->requested_size = new_size;
     if (new_size > old_size) {
       if (flags()->poison_in_malloc) {
-        stack->tag = StackTrace::TAG_ALLOC;
         PoisonMemory((char *)old_p + old_size, new_size - old_size, stack);
       }
     }
Index: compiler-rt/lib/msan/msan.h
===================================================================
--- compiler-rt/lib/msan/msan.h
+++ compiler-rt/lib/msan/msan.h
@@ -334,8 +334,6 @@
 // the previous origin id.
 u32 ChainOrigin(u32 id, StackTrace *stack);
 
-const int STACK_TRACE_TAG_POISON = StackTrace::TAG_CUSTOM + 1;
-
 #define GET_MALLOC_STACK_TRACE                                            \
   BufferedStackTrace stack;                                               \
   if (__msan_get_track_origins() && msan_inited)                          \
Index: compiler-rt/lib/msan/msan.cpp
===================================================================
--- compiler-rt/lib/msan/msan.cpp
+++ compiler-rt/lib/msan/msan.cpp
@@ -294,7 +294,6 @@
     return id;
 
   Origin o = Origin::FromRawId(id);
-  stack->tag = StackTrace::TAG_UNKNOWN;
   Origin chained = Origin::CreateChainedOrigin(o, stack);
   return chained.raw_id();
 }
Index: clang/docs/MemorySanitizer.rst
===================================================================
--- clang/docs/MemorySanitizer.rst
+++ clang/docs/MemorySanitizer.rst
@@ -145,7 +145,7 @@
         #0 0x7f78938b5c25 in __msan_chain_origin msan.cc:484
         #1 0x7f7893912ecd in main umr2.cc:6
 
-      Uninitialized value was created by a heap allocation
+      Uninitialized value was created
         #0 0x7f7893901cbd in operator new[](unsigned long) msan_new_delete.cc:44
         #1 0x7f7893912e06 in main umr2.cc:4
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to