This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][sanitizer] Have all OOM-related error messages start with the same format
ClosedPublic

Authored by leonardchan on Jun 6 2022, 3:39 PM.

Details

Summary

This way downstream tools that read sanitizer output can differentiate between OOM errors reported by sanitizers from other sanitizer errors.

Changes:

  • Introduce ErrorIsOOM for checking if a platform-specific error code from an "mmap" is an OOM err.
  • Add ReportOOMError which just prepends this error message to the start of a Report call.
  • Replace some Reports for OOMs with calls to ReportOOMError.
  • Update necessary tests.

Diff Detail

Event Timeline

leonardchan created this revision.Jun 6 2022, 3:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 3:39 PM
leonardchan requested review of this revision.Jun 6 2022, 3:39 PM
phosek added a subscriber: phosek.Jun 6 2022, 6:10 PM
phosek added inline comments.
compiler-rt/lib/asan/asan_errors.cpp
282

The "out of memory" part is redundant now.

compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp
132

The "out of memory" part is redundant now.

compiler-rt/lib/sanitizer_common/sanitizer_common.h
323

I'd consider using ALL_CAPS to make it clear to the use that this is a macro.

324

I'd avoid capitalization for consistency with other errors.

vitalybuka accepted this revision.Jun 6 2022, 6:40 PM
This revision is now accepted and ready to land.Jun 6 2022, 6:40 PM
This revision now requires review to proceed.Jun 6 2022, 6:41 PM
leonardchan marked 4 inline comments as done.

Up to you if you, if you want to wait for Peter. Feel free to remove and land it if you think it's done.
I added blocker only to make sure that review is shown to @phosek on Phabricator main page.

phosek accepted this revision.Jun 7 2022, 3:00 PM

LGTM

This revision is now accepted and ready to land.Jun 7 2022, 3:00 PM
This revision was landed with ongoing or failed builds.Jun 7 2022, 4:46 PM
This revision was automatically updated to reflect the committed changes.