report.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef SCUDO_REPORT_H_
  9. #define SCUDO_REPORT_H_
  10. #include "internal_defs.h"
  11. namespace scudo {
  12. // Reports are *fatal* unless stated otherwise.
  13. // Generic error.
  14. void NORETURN reportError(const char *Message);
  15. // Flags related errors.
  16. void NORETURN reportInvalidFlag(const char *FlagType, const char *Value);
  17. // Chunk header related errors.
  18. void NORETURN reportHeaderCorruption(void *Ptr);
  19. void NORETURN reportHeaderRace(void *Ptr);
  20. // Sanity checks related error.
  21. void NORETURN reportSanityCheckError(const char *Field);
  22. // Combined allocator errors.
  23. void NORETURN reportAlignmentTooBig(uptr Alignment, uptr MaxAlignment);
  24. void NORETURN reportAllocationSizeTooBig(uptr UserSize, uptr TotalSize,
  25. uptr MaxSize);
  26. void NORETURN reportOutOfMemory(uptr RequestedSize);
  27. enum class AllocatorAction : u8 {
  28. Recycling,
  29. Deallocating,
  30. Reallocating,
  31. Sizing,
  32. };
  33. void NORETURN reportInvalidChunkState(AllocatorAction Action, void *Ptr);
  34. void NORETURN reportMisalignedPointer(AllocatorAction Action, void *Ptr);
  35. void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr,
  36. u8 TypeA, u8 TypeB);
  37. void NORETURN reportDeleteSizeMismatch(void *Ptr, uptr Size, uptr ExpectedSize);
  38. // C wrappers errors.
  39. void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment);
  40. void NORETURN reportInvalidPosixMemalignAlignment(uptr Alignment);
  41. void NORETURN reportCallocOverflow(uptr Count, uptr Size);
  42. void NORETURN reportPvallocOverflow(uptr Size);
  43. void NORETURN reportInvalidAlignedAllocAlignment(uptr Size, uptr Alignment);
  44. } // namespace scudo
  45. #endif // SCUDO_REPORT_H_