diff --git a/compiler-rt/lib/scudo/standalone/release.h b/compiler-rt/lib/scudo/standalone/release.h --- a/compiler-rt/lib/scudo/standalone/release.h +++ b/compiler-rt/lib/scudo/standalone/release.h @@ -13,6 +13,7 @@ #include "list.h" #include "mem_map.h" #include "mutex.h" +#include "report.h" #include "thread_annotations.h" namespace scudo { @@ -426,7 +427,8 @@ if (PageMap.isAllocated()) return true; PageMap.reset(NumberOfRegions, PagesCount, FullPagesBlockCountMax); - // TODO: Log some message when we fail on PageMap allocation. + if (!PageMap.isAllocated()) + reportPageError(PageMap.getBufferSize()); return PageMap.isAllocated(); } diff --git a/compiler-rt/lib/scudo/standalone/report.h b/compiler-rt/lib/scudo/standalone/report.h --- a/compiler-rt/lib/scudo/standalone/report.h +++ b/compiler-rt/lib/scudo/standalone/report.h @@ -47,6 +47,7 @@ void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr, u8 TypeA, u8 TypeB); void NORETURN reportDeleteSizeMismatch(void *Ptr, uptr Size, uptr ExpectedSize); +void NORETURN reportPageError(uptr Size); // C wrappers errors. void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment); diff --git a/compiler-rt/lib/scudo/standalone/report.cpp b/compiler-rt/lib/scudo/standalone/report.cpp --- a/compiler-rt/lib/scudo/standalone/report.cpp +++ b/compiler-rt/lib/scudo/standalone/report.cpp @@ -169,6 +169,12 @@ Size, ExpectedSize); } +void NORETURN reportPageError(uptr Size) { + ScopedErrorReport Report; + Report.append("PageMap allocation failed (BufferSize %lu)", + Size); +} + void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment) { ScopedErrorReport Report; Report.append(