Commit b4980855 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

[mojo] Tweak oversized IPC crash dumps

Crash dumping for oversized IPCs was recently moved to serialization
instead of transmission. However it turns out that CommitSize is
called at the very end of serialization, which might not be finalized
until just before transmission anyway.

Dumping in AppendMessage instead of CommitSize means catching
errors earlier in serialization where we consistently have a
useful stack trace to work with.

Fixed: 1121073
Change-Id: I8aba6d08625af40b8b34329003ff736729f8a1b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2372882
Auto-Submit: Ken Rockot <rockot@google.com>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801199}
parent 181f6701
...@@ -515,6 +515,16 @@ MojoResult UserMessageImpl::AppendData(uint32_t additional_payload_size, ...@@ -515,6 +515,16 @@ MojoResult UserMessageImpl::AppendData(uint32_t additional_payload_size,
} }
} }
if (!unlimited_size_ &&
user_payload_size_ > GetConfiguration().max_message_num_bytes) {
// We want to be aware of new undocumented cases of very large IPCs. Crashes
// which result from this stack should be addressed by either marking the
// corresponding mojom interface method with an [UnlimitedSize] attribute;
// or preferably by refactoring to avoid such large message contents, for
// example by batching calls or leveraging shared memory where feasible.
base::debug::DumpWithoutCrashing();
}
return MOJO_RESULT_OK; return MOJO_RESULT_OK;
} }
...@@ -535,16 +545,6 @@ MojoResult UserMessageImpl::CommitSize() { ...@@ -535,16 +545,6 @@ MojoResult UserMessageImpl::CommitSize() {
pending_handle_attachments_.clear(); pending_handle_attachments_.clear();
} }
if (!unlimited_size_ &&
user_payload_size_ > GetConfiguration().max_message_num_bytes) {
// We want to be aware of new undocumented cases of very large IPCs. Crashes
// which result from this stack should be addressed by either marking the
// corresponding mojom interface method with an [UnlimitedSize] attribute;
// or preferably by refactoring to avoid such large message contents, for
// example by batching calls or leveraging shared memory where feasible.
base::debug::DumpWithoutCrashing();
}
is_committed_ = true; is_committed_ = true;
return MOJO_RESULT_OK; return MOJO_RESULT_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment