1 //===-- asan_report.h -------------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of AddressSanitizer, an address sanity checker.
10 // ASan-private header for error reporting functions.
11 //===----------------------------------------------------------------------===//
13 #include "asan_allocator.h"
14 #include "asan_internal.h"
15 #include "asan_thread.h"
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
);
30 void DescribeThread(AsanThreadContext
*context
);
32 // Different kinds of error reports.
34 ReportStackOverflow(uptr pc
, uptr sp
, uptr bp
, void *context
, uptr addr
);
36 ReportSIGSEGV(uptr pc
, uptr sp
, uptr bp
, void *context
, uptr addr
);
37 void NORETURN
ReportDoubleFree(uptr addr
, StackTrace
*free_stack
);
38 void NORETURN
ReportFreeNotMalloced(uptr addr
, StackTrace
*free_stack
);
39 void NORETURN
ReportAllocTypeMismatch(uptr addr
, StackTrace
*free_stack
,
41 AllocType dealloc_type
);
42 void NORETURN
ReportMallocUsableSizeNotOwned(uptr addr
,
44 void NORETURN
ReportAsanGetAllocatedSizeNotOwned(uptr addr
,
46 void NORETURN
ReportStringFunctionMemoryRangesOverlap(
47 const char *function
, const char *offset1
, uptr length1
,
48 const char *offset2
, uptr length2
, StackTrace
*stack
);
50 ReportStringFunctionSizeOverflow(uptr offset
, uptr size
, StackTrace
*stack
);
52 ReportBadParamsToAnnotateContiguousContainer(uptr beg
, uptr end
, uptr old_mid
,
53 uptr new_mid
, StackTrace
*stack
);
56 ReportODRViolation(const __asan_global
*g1
, const __asan_global
*g2
);
58 // Mac-specific errors and warnings.
59 void WarnMacFreeUnallocated(
60 uptr addr
, uptr zone_ptr
, const char *zone_name
, StackTrace
*stack
);
61 void NORETURN
ReportMacMzReallocUnknown(
62 uptr addr
, uptr zone_ptr
, const char *zone_name
, StackTrace
*stack
);
63 void NORETURN
ReportMacCfReallocUnknown(
64 uptr addr
, uptr zone_ptr
, const char *zone_name
, StackTrace
*stack
);