breakpad/src
rmcilroy@chromium.org 82d0ff76a6 Extend mapping merge to include reserved but unused mappings.
When parsing /proc/pid/maps, current code merges adjacent entries that
refer to the same library and where the start of the second is equal to
the end of the first, for example:

  40022000-40025000 r-xp 00000000 b3:11 827        /system/lib/liblog.so
  40025000-40026000 r--p 00002000 b3:11 827        /system/lib/liblog.so
  40026000-40027000 rw-p 00003000 b3:11 827        /system/lib/liblog.so

When the system linker loads a library it first reserves all the address
space required, from the smallest start to the largest end address, using
an anonymous mapping, and then maps loaded segments inside that reservation.
If the loaded segments do not fully occupy the reservation this leaves
gaps, and these gaps prevent merges that should occur from occurring:

  40417000-4044a000 r-xp 00000000 b3:11 820        /system/lib/libjpeg.so
> 4044a000-4044b000 ---p 00000000 00:00 0
  4044b000-4044c000 r--p 00033000 b3:11 820        /system/lib/libjpeg.so
  4044c000-4044d000 rw-p 00034000 b3:11 820        /system/lib/libjpeg.so

Where the segments that follow this gap do not contain executable code
the failure to merge does not affect breakpad operation.  However, where
they do then the merge needs to occur.  Packing relocations in a large
library splits the executable segment into two, resulting in:

  73b0c000-73b21000 r-xp 00000000 b3:19 786460     /data/.../libchrome.2160.0.so
> 73b21000-73d12000 ---p 00000000 00:00 0
  73d12000-75a90000 r-xp 00014000 b3:19 786460     /data/.../libchrome.2160.0.so
  75a90000-75c0d000 rw-p 01d91000 b3:19 786460     /data/.../libchrome.2160.0.so

Here the mapping at 73d12000-75a90000 must be merged into 73b0c000-73b21000
so that breakpad correctly calculates the base address for text.

This change enables the full merge by also merging anonymous maps which
result from unused reservation, identified as '---p' with offset 0, and
which follow on from an executable mapping, into that executable mapping.

BUG=chromium:394703
R=rmcilroy@chromium.org, thestig@chromium.org

Review URL: https://breakpad.appspot.com/7714003

Patch from Simon Baldwin <simonb@chromium.org>.

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1380 4c0a9323-5329-0410-9bdc-e9ce6186880e
2014-09-19 15:00:04 +00:00
..
build Rename gyp variable use_titlecase_in_grd_files -> use_titlecase_in_grd. 2014-09-10 12:47:46 +00:00
client Extend mapping merge to include reserved but unused mappings. 2014-09-19 15:00:04 +00:00
common GoogleCrashdumpUploader: adds Upload(string*) API to get the HTTP response. 2014-09-18 16:48:49 +00:00
google_breakpad Introduce stub microdump processor classes. 2014-09-10 19:12:30 +00:00
processor Update processor.gyp file with new files added as part of microdump 2014-09-10 22:16:29 +00:00
third_party Add GYP build for the src/tools directory on Mac and Linux. 2014-07-24 15:22:51 +00:00
tools Making the Mac build of crash_report work again after the last SVN sync 2014-09-16 19:15:08 +00:00
breakpad_googletest_includes.h disable unittests under ASAN that use memory crashes 2013-12-11 05:38:34 +00:00
config.h.in Use AM_MAINTAINER_MODE so configure supports --enable-maintainer-mode 2013-12-10 12:28:11 +00:00