1//===-- report.h ------------------------------------------------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef SCUDO_REPORT_H_ 10#define SCUDO_REPORT_H_ 11 12#include "internal_defs.h" 13 14namespace scudo { 15 16// Reports are *fatal* unless stated otherwise. 17 18// Generic error. 19void NORETURN reportError(const char *Message); 20 21// Flags related errors. 22void NORETURN reportInvalidFlag(const char *FlagType, const char *Value); 23 24// Chunk header related errors. 25void NORETURN reportHeaderCorruption(void *Ptr); 26void NORETURN reportHeaderRace(void *Ptr); 27 28// Sanity checks related error. 29void NORETURN reportSanityCheckError(const char *Field); 30 31// Combined allocator errors. 32void NORETURN reportAlignmentTooBig(uptr Alignment, uptr MaxAlignment); 33void NORETURN reportAllocationSizeTooBig(uptr UserSize, uptr TotalSize, 34 uptr MaxSize); 35void NORETURN reportOutOfMemory(uptr RequestedSize); 36enum class AllocatorAction : u8 { 37 Recycling, 38 Deallocating, 39 Reallocating, 40 Sizing, 41}; 42void NORETURN reportInvalidChunkState(AllocatorAction Action, void *Ptr); 43void NORETURN reportMisalignedPointer(AllocatorAction Action, void *Ptr); 44void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr, 45 u8 TypeA, u8 TypeB); 46void NORETURN reportDeleteSizeMismatch(void *Ptr, uptr Size, uptr ExpectedSize); 47 48// C wrappers errors. 49void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment); 50void NORETURN reportInvalidPosixMemalignAlignment(uptr Alignment); 51void NORETURN reportCallocOverflow(uptr Count, uptr Size); 52void NORETURN reportPvallocOverflow(uptr Size); 53void NORETURN reportInvalidAlignedAllocAlignment(uptr Size, uptr Alignment); 54 55} // namespace scudo 56 57#endif // SCUDO_REPORT_H_ 58