This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Split logs on Android
ClosedPublic

Authored by cryptoad on Apr 13 2020, 7:26 AM.

Details

Summary

The function used to log on Android will cut the message past
a certain amount of characters, which mostly materializes when
dumping the size class map on OOM.

This change splits the log message at newline boundaries.

Diff Detail

Event Timeline

cryptoad created this revision.Apr 13 2020, 7:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2020, 7:26 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
hctim added inline comments.Apr 13 2020, 12:55 PM
compiler-rt/lib/scudo/standalone/linux.cpp
187

Is this true? Should we just fallback to async_safe_write_log if we don't see a newline? example,

common.cpp:25 has outputRaw("Scudo ERROR: internal map or unmap failure");, and while that'll still be output as it's less than 1024 characters, feels like the invariant that "if it has more than 1K characters it must have a newline" seems fragile.

cryptoad marked an inline comment as done.Apr 13 2020, 1:27 PM
cryptoad added inline comments.
compiler-rt/lib/scudo/standalone/linux.cpp
187

More than 1024 chars with no newline shouldn't happen, particularly since we mostly want things that are human-understandable in the logs
But I'll just fallback to async_safe_write_log.

hctim accepted this revision.Apr 13 2020, 1:38 PM

LGTM w/ planned changes to fallback.

This revision is now accepted and ready to land.Apr 13 2020, 1:38 PM
cryptoad updated this revision to Diff 257173.Apr 13 2020, 5:40 PM

If no newline is found, proceed and log the buffer.

cryptoad updated this revision to Diff 257174.Apr 13 2020, 5:41 PM

Without the spurious s in the comment.

hctim accepted this revision.Apr 13 2020, 6:03 PM
This revision was automatically updated to reflect the committed changes.