1 //===-- asan_report.h -------------------------------------------*- C++ -*-===// 2 // 3 // This file is distributed under the University of Illinois Open Source 4 // License. See LICENSE.TXT for details. 5 // 6 //===----------------------------------------------------------------------===// 7 // 8 // This file is a part of AddressSanitizer, an address sanity checker. 9 // 10 // ASan-private header for error reporting functions. 11 //===----------------------------------------------------------------------===// 12 13 #include "asan_allocator.h" 14 #include "asan_internal.h" 15 #include "asan_thread.h" 16 17 namespace __asan { 18 19 // The following functions prints address description depending 20 // on the memory type (shadow/heap/stack/global). 21 void DescribeHeapAddress(uptr addr, uptr access_size); 22 bool DescribeAddressIfGlobal(uptr addr, uptr access_size); 23 bool DescribeAddressRelativeToGlobal(uptr addr, uptr access_size, 24 const __asan_global &g); 25 bool DescribeAddressIfShadow(uptr addr); 26 bool DescribeAddressIfStack(uptr addr, uptr access_size); 27 // Determines memory type on its own. 28 void DescribeAddress(uptr addr, uptr access_size); 29 30 void DescribeThread(AsanThreadSummary *summary); 31 32 // Different kinds of error reports. 33 void NORETURN ReportSIGSEGV(uptr pc, uptr sp, uptr bp, uptr addr); 34 void NORETURN ReportDoubleFree(uptr addr, StackTrace *stack); 35 void NORETURN ReportFreeNotMalloced(uptr addr, StackTrace *stack); 36 void NORETURN ReportAllocTypeMismatch(uptr addr, StackTrace *stack, 37 AllocType alloc_type, 38 AllocType dealloc_type); 39 void NORETURN ReportMallocUsableSizeNotOwned(uptr addr, 40 StackTrace *stack); 41 void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr, 42 StackTrace *stack); 43 void NORETURN ReportStringFunctionMemoryRangesOverlap( 44 const char *function, const char *offset1, uptr length1, 45 const char *offset2, uptr length2, StackTrace *stack); 46 47 // Mac-specific errors and warnings. 48 void WarnMacFreeUnallocated( 49 uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack); 50 void NORETURN ReportMacMzReallocUnknown( 51 uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack); 52 void NORETURN ReportMacCfReallocUnknown( 53 uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack); 54 55 } // namespace __asan 56