Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4632)

Issue 7714003: Extend mapping merge to include reserved but unused mappings. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 7 months ago by simonb
Modified:
9 years, 7 months ago
Base URL:
http://google-breakpad.googlecode.com/svn/trunk/src
Visibility:
Public.

Description

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

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
M client/linux/minidump_writer/linux_dumper.cc View 2 chunks +18 lines, -0 lines 0 comments Download

Messages

Total messages: 7
simonb
9 years, 7 months ago #1
Lei Zhang (chromium)
lgtm but I think Ted knows the code a little better. Added him in case ...
9 years, 7 months ago #2
rmcilroy
On 2014/09/17 23:29:46, Lei Zhang (chromium) wrote: > lgtm but I think Ted knows the ...
9 years, 7 months ago #3
rmcilroy
On 2014/09/18 11:19:04, rmcilroy wrote: > On 2014/09/17 23:29:46, Lei Zhang (chromium) wrote: > > ...
9 years, 7 months ago #4
rmcilroy
On 2014/09/19 14:58:18, rmcilroy wrote: > On 2014/09/18 11:19:04, rmcilroy wrote: > > On 2014/09/17 ...
9 years, 7 months ago #5
Ted Mielczarek
On 2014/09/19 14:58:18, rmcilroy wrote: > I'm assuming you had no comments Ted - if ...
9 years, 7 months ago #6
simonb
9 years, 7 months ago #7
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted