From cd744acecc4b1889f7452d67103b3fc5a015631d Mon Sep 17 00:00:00 2001 From: "rmcilroy@chromium.org" Date: Tue, 30 Jun 2015 13:30:22 +0000 Subject: [PATCH] Adjust breakpad module size to match adjusted start_addr. When changing a module's start_addr to account for Android packed relocations, also adjust its size field so that the apparent module end addr calculated by the breakpad processor does not alter. Ensures that the mapping entry from a packed library is consistent with that which an unpacked one would produce. BUG=499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1211863002. Patch from Simon Baldwin . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1465 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/minidump_writer/linux_dumper.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc index 00d18189..43b74ad9 100644 --- a/src/client/linux/minidump_writer/linux_dumper.cc +++ b/src/client/linux/minidump_writer/linux_dumper.cc @@ -510,10 +510,15 @@ void LinuxDumper::LatePostprocessMappings() { } if (ehdr.e_type == ET_DYN) { // Compute the effective load bias for this mapped library, and update - // the mapping to hold that rather than |start_addr|. Where the library - // does not contain Android packed relocations, GetEffectiveLoadBias() - // returns |start_addr| and the mapping entry is not changed. - mapping->start_addr = GetEffectiveLoadBias(&ehdr, mapping->start_addr); + // the mapping to hold that rather than |start_addr|, at the same time + // adjusting |size| to account for the change in |start_addr|. Where + // the library does not contain Android packed relocations, + // GetEffectiveLoadBias() returns |start_addr| and the mapping entry + // is not changed. + const uintptr_t load_bias = GetEffectiveLoadBias(&ehdr, + mapping->start_addr); + mapping->size += mapping->start_addr - load_bias; + mapping->start_addr = load_bias; } } }