Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Issue 1923383002: Revert of Extend mapping merge to include reserved but unused mappings. (Closed)

Created:
4 years, 7 months ago by petrcermak
Modified:
4 years, 7 months ago
Base URL:
https://chromium.googlesource.com/breakpad/breakpad/src.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Revert of Extend mapping merge to include reserved but unused mappings. (https://breakpad.appspot.com/7714003) Reason for revert: It is causing breakpad crash reports to be invalid (see the associated bug). Merging empty holes in r-x mappings was originally introduced in https://breakpad.appspot.com/7714003 to deal with the first generation of relro packing, which could introduce holes within a .so mapping: [libchrome.so] [guard region] [libchrome.so] However, the logic is broken for the case of two *different* adjacent .so mappings with a guard region in the middle: [libfoo.so] [guard region] [libchrome.so] In this case the guard region is mistakenly associated with libfoo.so, but that is not the right thing to do. In fact, the second generation of rerlo packing added the guard region to prevent mmaps from overlapping and to give room for the non-zero vaddr of relro-packed libraries, which require an anticipated load bias. As the first generation of relro packing is not used anymore, there is no reason to keep this buggy code, which causes failures in decoding crashes where an arbitrary library is mapped immediately before a rerlo packed library. Original issue's 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 BUG=chromium:499747 R=primiano@chromium.org, rmcilroy@chromium.org Committed: https://chromium.googlesource.com/breakpad/breakpad/+/17ad0c18b179c135fc5a3d2bba199c3fa4276035

Patch Set 1 #

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

Messages

Total messages: 11 (4 generated)
petrcermak
Hi, Please review this patch. Thanks, Petr
4 years, 7 months ago (2016-04-27 15:54:21 UTC) #3
rmcilroy
LGTM, thanks.
4 years, 7 months ago (2016-04-27 16:12:48 UTC) #4
Primiano Tucci (use gerrit)
On 2016/04/27 15:54:21, petrcermak wrote: > Hi, > > Please review this patch. > > ...
4 years, 7 months ago (2016-04-27 16:14:36 UTC) #5
petrcermak
On 2016/04/27 16:14:36, Primiano Tucci wrote: > On 2016/04/27 15:54:21, petrcermak wrote: > > Hi, ...
4 years, 7 months ago (2016-04-27 16:43:43 UTC) #7
Primiano Tucci (use gerrit)
On 2016/04/27 16:43:43, petrcermak wrote: > On 2016/04/27 16:14:36, Primiano Tucci wrote: > > On ...
4 years, 7 months ago (2016-04-27 16:45:55 UTC) #8
petrcermak
On 2016/04/27 16:45:55, Primiano Tucci wrote: > On 2016/04/27 16:43:43, petrcermak wrote: > > On ...
4 years, 7 months ago (2016-04-28 13:34:19 UTC) #9
Primiano Tucci (use gerrit)
4 years, 7 months ago (2016-04-28 15:49:49 UTC) #11
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
17ad0c18b179c135fc5a3d2bba199c3fa4276035 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698