diff options
author | Kostya Serebryany <kcc@google.com> | 2016-01-20 19:49:12 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-01-20 19:49:12 +0000 |
commit | 8a674aeda69397a6431dfdbe3c5c6635b456e1f5 (patch) | |
tree | 65a56d884a6ab2b98da041bf7b17dbb5737a074d /lib/asan | |
parent | a91d61e98d7dbb555c9eaa8028924d32fcd8d522 (diff) |
[asan] print an additional hint when reporting a container overflow
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r-- | lib/asan/asan_report.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/asan/asan_report.cc b/lib/asan/asan_report.cc index c2727622f..8cf1bf640 100644 --- a/lib/asan/asan_report.cc +++ b/lib/asan/asan_report.cc @@ -1016,6 +1016,14 @@ static bool SuppressErrorReport(uptr pc) { Die(); } +static void PrintContainerOverflowHint() { + Printf("HINT: if you don't care about these errors you may set " + "ASAN_OPTIONS=detect_container_overflow=0.\n" + "If you suspect a false positive see also: " + "https://github.com/google/sanitizers/wiki/" + "AddressSanitizerContainerOverflow.\n"); +} + void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write, uptr access_size, u32 exp, bool fatal) { if (!fatal && SuppressErrorReport(pc)) return; @@ -1032,6 +1040,7 @@ void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write, // Determine the error type. const char *bug_descr = "unknown-crash"; + u8 shadow_val = 0; if (AddrIsInMem(addr)) { u8 *shadow_addr = (u8*)MemToShadow(addr); // If we are accessing 16 bytes, look at the second shadow byte. @@ -1040,7 +1049,8 @@ void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write, // If we are in the partial right redzone, look at the next shadow byte. if (*shadow_addr > 0 && *shadow_addr < 128) shadow_addr++; - switch (*shadow_addr) { + shadow_val = *shadow_addr; + switch (shadow_val) { case kAsanHeapLeftRedzoneMagic: case kAsanHeapRightRedzoneMagic: case kAsanArrayCookieMagic: @@ -1109,6 +1119,8 @@ void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write, stack.Print(); DescribeAddress(addr, access_size, bug_descr); + if (shadow_val == kAsanContiguousContainerOOBMagic) + PrintContainerOverflowHint(); ReportErrorSummary(bug_descr, &stack); PrintShadowMemoryForAddress(addr); } |