report.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. void NORETURN reportSoftRSSLimit(uptr RssLimitMb);
  28. void NORETURN reportHardRSSLimit(uptr RssLimitMb);
  29. enum class AllocatorAction : u8 {
  30. Recycling,
  31. Deallocating,
  32. Reallocating,
  33. Sizing,
  34. };
  35. void NORETURN reportInvalidChunkState(AllocatorAction Action, void *Ptr);
  36. void NORETURN reportMisalignedPointer(AllocatorAction Action, void *Ptr);
  37. void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr,
  38. u8 TypeA, u8 TypeB);
  39. void NORETURN reportDeleteSizeMismatch(void *Ptr, uptr Size, uptr ExpectedSize);
  40. // C wrappers errors.
  41. void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment);
  42. void NORETURN reportInvalidPosixMemalignAlignment(uptr Alignment);
  43. void NORETURN reportCallocOverflow(uptr Count, uptr Size);
  44. void NORETURN reportPvallocOverflow(uptr Size);
  45. void NORETURN reportInvalidAlignedAllocAlignment(uptr Size, uptr Alignment);
  46. } // namespace scudo
  47. #endif // SCUDO_REPORT_H_