#include "asan_report.h"
#include "asan_descriptions.h"
#include "asan_errors.h"
#include "asan_flags.h"
#include "asan_internal.h"
#include "asan_mapping.h"
#include "asan_scariness_score.h"
#include "asan_stack.h"
#include "asan_thread.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_report_decorator.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
namespace __asan {
static void (*error_report_callback)(const char*);
ErrorMessageBuffer;
alignas(
alignof(ErrorMessageBuffer)) static char error_message_buffer_placeholder
[sizeof(ErrorMessageBuffer)];
static ErrorMessageBuffer *error_message_buffer = …;
static Mutex error_message_buf_mutex;
static const unsigned kAsanBuggyPcPoolSize = …;
static __sanitizer::atomic_uintptr_t AsanBuggyPcPool[kAsanBuggyPcPoolSize];
void AppendToErrorMessageBuffer(const char *buffer) { … }
void PrintMemoryByte(InternalScopedString *str, const char *before, u8 byte,
bool in_shadow, const char *after) { … }
static void PrintZoneForPointer(uptr ptr, uptr zone_ptr,
const char *zone_name) { … }
bool ParseFrameDescription(const char *frame_descr,
InternalMmapVector<StackVarDescr> *vars) { … }
class ScopedInErrorReport { … };
ErrorDescription ScopedInErrorReport::current_error_(LINKER_INITIALIZED);
void ReportDeadlySignal(const SignalContext &sig) { … }
void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack) { … }
void ReportNewDeleteTypeMismatch(uptr addr, uptr delete_size,
uptr delete_alignment,
BufferedStackTrace *free_stack) { … }
void ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack) { … }
void ReportAllocTypeMismatch(uptr addr, BufferedStackTrace *free_stack,
AllocType alloc_type,
AllocType dealloc_type) { … }
void ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack) { … }
void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr,
BufferedStackTrace *stack) { … }
void ReportCallocOverflow(uptr count, uptr size, BufferedStackTrace *stack) { … }
void ReportReallocArrayOverflow(uptr count, uptr size,
BufferedStackTrace *stack) { … }
void ReportPvallocOverflow(uptr size, BufferedStackTrace *stack) { … }
void ReportInvalidAllocationAlignment(uptr alignment,
BufferedStackTrace *stack) { … }
void ReportInvalidAlignedAllocAlignment(uptr size, uptr alignment,
BufferedStackTrace *stack) { … }
void ReportInvalidPosixMemalignAlignment(uptr alignment,
BufferedStackTrace *stack) { … }
void ReportAllocationSizeTooBig(uptr user_size, uptr total_size, uptr max_size,
BufferedStackTrace *stack) { … }
void ReportRssLimitExceeded(BufferedStackTrace *stack) { … }
void ReportOutOfMemory(uptr requested_size, BufferedStackTrace *stack) { … }
void ReportStringFunctionMemoryRangesOverlap(const char *function,
const char *offset1, uptr length1,
const char *offset2, uptr length2,
BufferedStackTrace *stack) { … }
void ReportStringFunctionSizeOverflow(uptr offset, uptr size,
BufferedStackTrace *stack) { … }
void ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end,
uptr old_mid, uptr new_mid,
BufferedStackTrace *stack) { … }
void ReportBadParamsToAnnotateDoubleEndedContiguousContainer(
uptr storage_beg, uptr storage_end, uptr old_container_beg,
uptr old_container_end, uptr new_container_beg, uptr new_container_end,
BufferedStackTrace *stack) { … }
void ReportODRViolation(const __asan_global *g1, u32 stack_id1,
const __asan_global *g2, u32 stack_id2) { … }
static NOINLINE void ReportInvalidPointerPair(uptr pc, uptr bp, uptr sp,
uptr a1, uptr a2) { … }
static bool IsInvalidPointerPair(uptr a1, uptr a2) { … }
static inline void CheckForInvalidPointerPair(void *p1, void *p2) { … }
void ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr, const char *zone_name,
BufferedStackTrace *stack) { … }
static bool SuppressErrorReport(uptr pc) { … }
void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write,
uptr access_size, u32 exp, bool fatal) { … }
}
usingnamespace__asan;
void __asan_report_error(uptr pc, uptr bp, uptr sp, uptr addr, int is_write,
uptr access_size, u32 exp) { … }
void NOINLINE __asan_set_error_report_callback(void (*callback)(const char*)) { … }
void __asan_describe_address(uptr addr) { … }
int __asan_report_present() { … }
uptr __asan_get_report_pc() { … }
uptr __asan_get_report_bp() { … }
uptr __asan_get_report_sp() { … }
uptr __asan_get_report_address() { … }
int __asan_get_report_access_type() { … }
uptr __asan_get_report_access_size() { … }
const char *__asan_get_report_description() { … }
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_ptr_sub(void *a, void *b) { … }
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_ptr_cmp(void *a, void *b) { … }
}
SANITIZER_INTERFACE_WEAK_DEF(void, __asan_on_error, void) { … }