asan_report.h revision fe6d91684bcda766593800f6307233f1a33d31f6
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_allocator.h"
16#include "asan_internal.h"
17#include "asan_thread.h"
18#include "sanitizer/asan_interface.h"
19
20namespace __asan {
21
22// The following functions prints address description depending
23// on the memory type (shadow/heap/stack/global).
24void DescribeHeapAddress(uptr addr, uptr access_size);
25bool DescribeAddressIfGlobal(uptr addr);
26bool DescribeAddressRelativeToGlobal(uptr addr, const __asan_global &g);
27bool DescribeAddressIfShadow(uptr addr);
28bool DescribeAddressIfStack(uptr addr, uptr access_size);
29// Determines memory type on its own.
30void DescribeAddress(uptr addr, uptr access_size);
31
32void DescribeThread(AsanThreadSummary *summary);
33
34// Different kinds of error reports.
35void NORETURN ReportSIGSEGV(uptr pc, uptr sp, uptr bp, uptr addr);
36void NORETURN ReportDoubleFree(uptr addr, StackTrace *stack);
37void NORETURN ReportFreeNotMalloced(uptr addr, StackTrace *stack);
38void NORETURN ReportAllocTypeMismatch(uptr addr, StackTrace *stack,
39                                      AllocType alloc_type,
40                                      AllocType dealloc_type);
41void NORETURN ReportMallocUsableSizeNotOwned(uptr addr,
42                                             StackTrace *stack);
43void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr,
44                                                 StackTrace *stack);
45void NORETURN ReportStringFunctionMemoryRangesOverlap(
46    const char *function, const char *offset1, uptr length1,
47    const char *offset2, uptr length2, StackTrace *stack);
48
49// Mac-specific errors and warnings.
50void WarnMacFreeUnallocated(
51    uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
52void NORETURN ReportMacMzReallocUnknown(
53    uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
54void NORETURN ReportMacCfReallocUnknown(
55    uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
56
57}  // namespace __asan
58