[PATCH] [ASan] Do not rely on malloc context in allocator reports
Alexey Samsonov
samsonov at google.com
Tue Nov 12 00:24:29 PST 2013
================
Comment at: lib/asan/asan_report.h:42
@@ -41,3 +41,3 @@
void NORETURN ReportMallocUsableSizeNotOwned(uptr addr,
- StackTrace *stack);
+ StackTrace *free_stack);
void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr,
----------------
It's not a free_stack, it's a call stack of malloc_usable_size.
Moreover, looks like with this change, asan_malloc_usable_size doesn't need to take unwinded stack trace as its argument, only a pc/bp to optionally unwind stack on failure if ReportMallocUsableSizeNotOwned is called.
================
Comment at: lib/asan/asan_report.h:44
@@ -43,3 +43,3 @@
void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr,
- StackTrace *stack);
+ StackTrace *free_stack);
void NORETURN ReportStringFunctionMemoryRangesOverlap(
----------------
It's not a free_stack, it's a call stack of __asan_get_allocated_size(). And it's already unwinded using GET_STACK_TRACE_FATAL_HERE, so you don't really need to modify this function.
================
Comment at: lib/asan/lit_tests/TestCases/Linux/malloc_delete_mismatch.cc:1
@@ -1,2 +1,2 @@
// Check that we detect malloc/delete mismatch only if the approptiate flag
// is set.
----------------
I'd also appreciate at least one cross-platform test case (i.e. not Linux-only).
================
Comment at: lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc:20
@@ -19,1 +19,3 @@
uptr stack_bottom, bool request_fast_unwind) {
+ top_frame_bp = bp;
+
----------------
You may assign this only if size of unwinded stack is greater than zero.
http://llvm-reviews.chandlerc.com/D2136
More information about the llvm-commits
mailing list