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.
33 void NORETURN
ReportSIGSEGV(uptr pc
, uptr sp
, uptr bp
, uptr addr
);
34 void NORETURN
ReportDoubleFree(uptr addr
, StackTrace
*free_stack
);
35 void NORETURN
ReportFreeNotMalloced(uptr addr
, StackTrace
*free_stack
);
36 void NORETURN
ReportAllocTypeMismatch(uptr addr
, StackTrace
*free_stack
,
38 AllocType dealloc_type
);
39 void NORETURN
ReportMallocUsableSizeNotOwned(uptr addr
,
41 void NORETURN
ReportAsanGetAllocatedSizeNotOwned(uptr addr
,
43 void NORETURN
ReportStringFunctionMemoryRangesOverlap(
44 const char *function
, const char *offset1
, uptr length1
,
45 const char *offset2
, uptr length2
, StackTrace
*stack
);
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
);