From c2467077b93523c9ab2b8a7548145201dc891328 Mon Sep 17 00:00:00 2001 From: Joshua Peraza Date: Tue, 11 Jun 2019 11:48:14 -0700 Subject: Enable truncation of module ranges ELF modules are loaded in memory in several, possibly discontiguous, segments. If the holes between segments are large enough, other things, possibly other ELF modules may be mapped in that space. Crashpad records the range of modules as the base address of the lowest mapped segment to the high address of the highest mapped segment. This means that when one module is mapped into a hole in another, it appears to the Breakpad processor as overlapping modules. Module ranges are relevant to the Breakpad processor during stackwalking for identifying which module a particular program counter belongs to (i.e. mapping the address to a module's text segment). This patch addresses this issue of overlapping modules by truncating the range of the module with the lower base address. A typical module's text segment is the first loaded segment which would leave the text segment range unaffected. Module producers can restrict the size of holes in their ELF modules with the flag "-Wl,-z,max-page-size=4096", preventing other modules from being mapped in their address range. Properly contemplating ELF module address ranges would require extensions to the minidump format to encode any holes. crbug.com/crashpad/298 This patch also renames the concept of "shrinking down" (which truncated the upper of two overlapping ranges) to "truncate upper". Change-Id: I4599201f1e43918db036c390961f8b39e3af1849 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1646932 Reviewed-by: Mark Mentovai --- src/processor/basic_code_modules.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/processor/basic_code_modules.h') diff --git a/src/processor/basic_code_modules.h b/src/processor/basic_code_modules.h index 50f8a03d..45ebc53b 100644 --- a/src/processor/basic_code_modules.h +++ b/src/processor/basic_code_modules.h @@ -58,7 +58,7 @@ class BasicCodeModules : public CodeModules { // the CodeModules and CodeModule interfaces without requiring all of the // resources that other implementations may require. A copy will be // made of each contained CodeModule using CodeModule::Copy. - explicit BasicCodeModules(const CodeModules *that); + BasicCodeModules(const CodeModules *that, MergeRangeStrategy strategy); virtual ~BasicCodeModules(); @@ -71,7 +71,6 @@ class BasicCodeModules : public CodeModules { virtual const CodeModules* Copy() const; virtual std::vector > GetShrunkRangeModules() const; - virtual bool IsModuleShrinkEnabled() const; protected: BasicCodeModules(); -- cgit v1.2.1