Page MenuHomePhabricator

[scudo][standalone] Add error reports
ClosedPublic

Authored by cryptoad on Mar 19 2019, 9:50 AM.

Details

Summary

This change adds fatal error messages for various error conditions that
will be added later in the code.
This also addresses a TODO now that we have reportCheckFailed (which
lead me to notice a few variables that were not cased properly so I
changed that as well).

Diff Detail

Event Timeline

cryptoad created this revision.Mar 19 2019, 9:50 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 19 2019, 9:50 AM
Herald added subscribers: Restricted Project, jdoerfert, jfb and 2 others. · View Herald Transcript
hctim added inline comments.Mar 19 2019, 10:31 AM
lib/scudo/standalone/report.cc
11

Nit: Newline between {report.h} and {atomic_helpers.h, string_utils.h}. Module header should be first, but putting the module header and subproject headers together without a newline makes them look like they should be in sorted order.

lib/scudo/standalone/report.h
37

Is there a reason why the use of this enum is deliberately occluded from those who use it? Why don't you use this as an enum class AllocatorAction with an internal toString method, and then reportInvalidChunkState(..) and others can take AllocatorAction Action as the first argument, instead of occluding it into a u8?

This would also remove the need to have ActionsCount and check-fail on this (report.cc:115), as you would have compile-time guarantees that the provided enum value is in range.

cryptoad updated this revision to Diff 191347.Mar 19 2019, 10:33 AM

Updating formating.

cryptoad marked 2 inline comments as done.Mar 19 2019, 11:02 AM
cryptoad added inline comments.
lib/scudo/standalone/report.h
37

I think the only reasoning I had was to try and keep things compact, uploading a version that hopefully fits the requirements.

cryptoad updated this revision to Diff 191355.Mar 19 2019, 11:03 AM

Addressing Mitch's comments.

morehouse added inline comments.Mar 19 2019, 11:21 AM
lib/scudo/standalone/report.cc
63

s/cause/caused

64

s/a pointer than/or a pointer that

80

I don't understand what this means exactly.

Maybe you mean something like: "The allocator was compiled with parameters that conflict with field size requirements."

lib/scudo/standalone/tests/report_test.cc
32

Test for AllocatorAction::Sizing?

cryptoad updated this revision to Diff 191359.Mar 19 2019, 11:26 AM
cryptoad marked 4 inline comments as done.

Addressing Matt's comments.

This revision is now accepted and ready to land.Mar 19 2019, 11:31 AM
hctim added inline comments.Mar 19 2019, 11:35 AM
lib/scudo/standalone/report.cc
109

Could this be implemented as a member function of enum class AllocatorAction?

hctim accepted this revision.Mar 19 2019, 12:50 PM

LGTM

lib/scudo/standalone/report.cc
109

Scrap this, I could have sworn that this was possible, turns out I'm mistaken!

vitalybuka accepted this revision.Mar 19 2019, 5:37 PM
This revision was automatically updated to reflect the committed changes.