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