1485dbc23SKostya Kortchinsky //===-- report.h ------------------------------------------------*- C++ -*-===// 2485dbc23SKostya Kortchinsky // 3485dbc23SKostya Kortchinsky // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4485dbc23SKostya Kortchinsky // See https://llvm.org/LICENSE.txt for license information. 5485dbc23SKostya Kortchinsky // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6485dbc23SKostya Kortchinsky // 7485dbc23SKostya Kortchinsky //===----------------------------------------------------------------------===// 8485dbc23SKostya Kortchinsky 9485dbc23SKostya Kortchinsky #ifndef SCUDO_REPORT_H_ 10485dbc23SKostya Kortchinsky #define SCUDO_REPORT_H_ 11485dbc23SKostya Kortchinsky 12485dbc23SKostya Kortchinsky #include "internal_defs.h" 13485dbc23SKostya Kortchinsky 14485dbc23SKostya Kortchinsky namespace scudo { 15485dbc23SKostya Kortchinsky 16485dbc23SKostya Kortchinsky // Reports are *fatal* unless stated otherwise. 17485dbc23SKostya Kortchinsky 18*99d92d18SChristopher Ferris // Generic error, adds newline to end of message. 19485dbc23SKostya Kortchinsky void NORETURN reportError(const char *Message); 20485dbc23SKostya Kortchinsky 21*99d92d18SChristopher Ferris // Generic error, but the message is not modified. 22*99d92d18SChristopher Ferris void NORETURN reportRawError(const char *Message); 23*99d92d18SChristopher Ferris 24485dbc23SKostya Kortchinsky // Flags related errors. 25485dbc23SKostya Kortchinsky void NORETURN reportInvalidFlag(const char *FlagType, const char *Value); 26485dbc23SKostya Kortchinsky 27485dbc23SKostya Kortchinsky // Chunk header related errors. 28485dbc23SKostya Kortchinsky void NORETURN reportHeaderCorruption(void *Ptr); 29485dbc23SKostya Kortchinsky 30485dbc23SKostya Kortchinsky // Sanity checks related error. 31485dbc23SKostya Kortchinsky void NORETURN reportSanityCheckError(const char *Field); 32485dbc23SKostya Kortchinsky 33485dbc23SKostya Kortchinsky // Combined allocator errors. 34485dbc23SKostya Kortchinsky void NORETURN reportAlignmentTooBig(uptr Alignment, uptr MaxAlignment); 35485dbc23SKostya Kortchinsky void NORETURN reportAllocationSizeTooBig(uptr UserSize, uptr TotalSize, 36485dbc23SKostya Kortchinsky uptr MaxSize); 37f7016f8aSChia-hung Duan void NORETURN reportOutOfBatchClass(); 38485dbc23SKostya Kortchinsky void NORETURN reportOutOfMemory(uptr RequestedSize); 39485dbc23SKostya Kortchinsky enum class AllocatorAction : u8 { 40485dbc23SKostya Kortchinsky Recycling, 41485dbc23SKostya Kortchinsky Deallocating, 42485dbc23SKostya Kortchinsky Reallocating, 43485dbc23SKostya Kortchinsky Sizing, 44485dbc23SKostya Kortchinsky }; 45485dbc23SKostya Kortchinsky void NORETURN reportInvalidChunkState(AllocatorAction Action, void *Ptr); 46485dbc23SKostya Kortchinsky void NORETURN reportMisalignedPointer(AllocatorAction Action, void *Ptr); 47485dbc23SKostya Kortchinsky void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr, 48485dbc23SKostya Kortchinsky u8 TypeA, u8 TypeB); 49485dbc23SKostya Kortchinsky void NORETURN reportDeleteSizeMismatch(void *Ptr, uptr Size, uptr ExpectedSize); 50485dbc23SKostya Kortchinsky 51485dbc23SKostya Kortchinsky // C wrappers errors. 52485dbc23SKostya Kortchinsky void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment); 53485dbc23SKostya Kortchinsky void NORETURN reportInvalidPosixMemalignAlignment(uptr Alignment); 54485dbc23SKostya Kortchinsky void NORETURN reportCallocOverflow(uptr Count, uptr Size); 55485dbc23SKostya Kortchinsky void NORETURN reportPvallocOverflow(uptr Size); 56485dbc23SKostya Kortchinsky void NORETURN reportInvalidAlignedAllocAlignment(uptr Size, uptr Alignment); 57485dbc23SKostya Kortchinsky 58485dbc23SKostya Kortchinsky } // namespace scudo 59485dbc23SKostya Kortchinsky 60485dbc23SKostya Kortchinsky #endif // SCUDO_REPORT_H_ 61