[PATCH] [ASan] Do not rely on malloc context in allocator reports

Yury Gribov tetra2005 at gmail.com
Mon Nov 11 06:25:28 PST 2013



================
Comment at: lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc:22
@@ +21,3 @@
+
+  if (!max_depth) {
+    trace[0] = pc;
----------------
Alexey Samsonov wrote:
> Why do you need this?
I need pc to unwind stack in Report*. Without this code pc will be lost if max_depth is zero (i.e. in case ASAN_OPTIONS=malloc_context_size=0).

================
Comment at: lib/asan/asan_report.cc:567
@@ -566,3 +566,3 @@
 
-void ReportDoubleFree(uptr addr, StackTrace *stack) {
+void ReportDoubleFree(uptr addr, StackTrace *stack_) {
   ScopedInErrorReport in_report;
----------------
Alexey Samsonov wrote:
> better naming: use free_stack instead of stack_ (and also rename parameter in asan_report.h).  Similar for other functions in this file.
Ok.

================
Comment at: lib/asan/lit_tests/TestCases/Linux/malloc_delete_mismatch.cc:8
@@ -7,2 +7,3 @@
 // No error here.
-// RUN: ASAN_OPTIONS=alloc_dealloc_mismatch=0 %t
+// RUN: ASAN_OPTIONS=alloc_dealloc_mismatch=0 %t --check-prefix=CHECK
+
----------------
Timur Iskhodzhanov wrote:
> you've meant CHECK-CTX
Ok.

================
Comment at: lib/asan/lit_tests/TestCases/Linux/malloc_delete_mismatch.cc:22
@@ -17,3 +21,3 @@
 }
 // CHECK: ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x
 // CHECK-NEXT: #0{{.*}}operator delete
----------------
Alexey Samsonov wrote:
> Yeah, and use CHECK-CTX here as well.
Ok.

================
Comment at: lib/sanitizer_common/sanitizer_stacktrace.h:36
@@ -35,2 +35,3 @@
                                      int out_size);
+  uptr bp;
   uptr size;
----------------
Alexey Samsonov wrote:
> Consider renaming to top_frame_bp
Ok.


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



More information about the llvm-commits mailing list