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