aboutsummaryrefslogtreecommitdiff
path: root/src/google_breakpad/processor
diff options
context:
space:
mode:
authorIvan Penkov <ivanpe@chromium.org>2016-06-20 11:14:47 -0700
committerIvan Penkov <ivanpe@chromium.org>2016-06-20 11:14:47 -0700
commit24f5931c5e0120982c0cbf1896641e3ef2bdd52f (patch)
tree68b24e2ded67b0cabcfb7c6e534e17640997e7b9 /src/google_breakpad/processor
parentlinux-syscall-support: pull in latest version (diff)
downloadbreakpad-24f5931c5e0120982c0cbf1896641e3ef2bdd52f.tar.xz
Server-side workaround to handle overlapping modules.
This change is resolving an issue that was caused by the combination of: - Android system libraries being relro packed in N+. - Breakpad dealing with relro packed libraries in a hack way. This is a fix for http://crbug/611824. I also found an use-after-free issue (bug in Minidump::SeekToStreamType). I disallowed the MinidumpStreamInfo copy and assign constructors and the compiler detected another similar issue in Minidump::Print. Then I disabled the copy and assign constructors for most classes in minidump.h (just in case). There are a couple of classes where I couldn't disallow them (since assign is used). This will require a small refactor so I left it out of this CL. R=mark@chromium.org Review URL: https://codereview.chromium.org/2060663002 .
Diffstat (limited to 'src/google_breakpad/processor')
-rw-r--r--src/google_breakpad/processor/code_module.h9
-rw-r--r--src/google_breakpad/processor/code_modules.h13
-rw-r--r--src/google_breakpad/processor/microdump.h3
-rw-r--r--src/google_breakpad/processor/minidump.h46
-rw-r--r--src/google_breakpad/processor/process_state.h11
5 files changed, 79 insertions, 3 deletions
diff --git a/src/google_breakpad/processor/code_module.h b/src/google_breakpad/processor/code_module.h
index 4e892824..b139907c 100644
--- a/src/google_breakpad/processor/code_module.h
+++ b/src/google_breakpad/processor/code_module.h
@@ -86,7 +86,14 @@ class CodeModule {
// ownership of. The new CodeModule may be of a different concrete class
// than the CodeModule being copied, but will behave identically to the
// copied CodeModule as far as the CodeModule interface is concerned.
- virtual const CodeModule* Copy() const = 0;
+ virtual CodeModule* Copy() const = 0;
+
+ // Getter and setter for shrink_down_delta. This is used when the address
+ // range for a module is shrunk down due to address range conflicts with
+ // other modules. The base_address and size fields are not updated and they
+ // should always reflect the original values (reported in the minidump).
+ virtual uint64_t shrink_down_delta() const = 0;
+ virtual void SetShrinkDownDelta(uint64_t shrink_down_delta) = 0;
};
} // namespace google_breakpad
diff --git a/src/google_breakpad/processor/code_modules.h b/src/google_breakpad/processor/code_modules.h
index a38579af..509137cb 100644
--- a/src/google_breakpad/processor/code_modules.h
+++ b/src/google_breakpad/processor/code_modules.h
@@ -35,7 +35,12 @@
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
+#include <stddef.h>
+
+#include <vector>
+
#include "google_breakpad/common/breakpad_types.h"
+#include "processor/linked_ptr.h"
namespace google_breakpad {
@@ -91,6 +96,14 @@ class CodeModules {
// returns objects in may differ between a copy and the original CodeModules
// object.
virtual const CodeModules* Copy() const = 0;
+
+ // Returns a vector of all modules which address ranges needed to be shrunk
+ // down due to address range conflicts with other modules.
+ virtual std::vector<linked_ptr<const CodeModule> >
+ GetShrunkRangeModules() const = 0;
+
+ // Returns true, if module address range shrink is enabled.
+ virtual bool IsModuleShrinkEnabled() const = 0;
};
} // namespace google_breakpad
diff --git a/src/google_breakpad/processor/microdump.h b/src/google_breakpad/processor/microdump.h
index 7268d2c0..0e2cb749 100644
--- a/src/google_breakpad/processor/microdump.h
+++ b/src/google_breakpad/processor/microdump.h
@@ -58,6 +58,9 @@ class MicrodumpModules : public BasicCodeModules {
public:
// Takes over ownership of |module|.
void Add(const CodeModule* module);
+
+ // Enables/disables module address range shrink.
+ void SetEnableModuleShrink(bool is_enabled);
};
// MicrodumpContext carries a CPU-specific context.
diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h
index 2b5025e4..88a3926a 100644
--- a/src/google_breakpad/processor/minidump.h
+++ b/src/google_breakpad/processor/minidump.h
@@ -151,6 +151,8 @@ class MinidumpStream : public MinidumpObject {
// that implements MinidumpStream can compare expected_size to a
// known size as an integrity check.
virtual bool Read(uint32_t expected_size) = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpStream);
};
@@ -191,6 +193,8 @@ class MinidumpContext : public DumpContext {
// for access to data about the minidump file itself, such as whether
// it should be byte-swapped.
Minidump* minidump_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpContext);
};
@@ -358,6 +362,8 @@ class MinidumpThreadList : public MinidumpStream {
// The list of threads.
MinidumpThreads* threads_;
uint32_t thread_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpThreadList);
};
@@ -392,7 +398,14 @@ class MinidumpModule : public MinidumpObject,
virtual string debug_file() const;
virtual string debug_identifier() const;
virtual string version() const;
- virtual const CodeModule* Copy() const;
+ virtual CodeModule* Copy() const;
+
+ // Getter and setter for shrink_down_delta. This is used when the address
+ // range for a module is shrunk down due to address range conflicts with
+ // other modules. The base_address and size fields are not updated and they
+ // should always reflect the original values (reported in the minidump).
+ virtual uint64_t shrink_down_delta() const;
+ virtual void SetShrinkDownDelta(uint64_t shrink_down_delta);
// The CodeView record, which contains information to locate the module's
// debugging information (pdb). This is returned as uint8_t* because
@@ -501,6 +514,13 @@ class MinidumpModuleList : public MinidumpStream,
virtual const MinidumpModule* GetModuleAtIndex(unsigned int index) const;
virtual const CodeModules* Copy() const;
+ // Returns a vector of all modules which address ranges needed to be shrunk
+ // down due to address range conflicts with other modules.
+ virtual vector<linked_ptr<const CodeModule> > GetShrunkRangeModules() const;
+
+ // Returns true, if module address range shrink is enabled.
+ virtual bool IsModuleShrinkEnabled() const;
+
// Print a human-readable representation of the object to stdout.
void Print();
@@ -525,6 +545,8 @@ class MinidumpModuleList : public MinidumpStream,
MinidumpModules *modules_;
uint32_t module_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpModuleList);
};
@@ -587,6 +609,8 @@ class MinidumpMemoryList : public MinidumpStream {
// The list of regions.
MemoryRegions *regions_;
uint32_t region_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryList);
};
@@ -626,6 +650,8 @@ class MinidumpException : public MinidumpStream {
MDRawExceptionStream exception_;
MinidumpContext* context_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpException);
};
// MinidumpAssertion wraps MDRawAssertionInfo, which contains information
@@ -666,6 +692,8 @@ class MinidumpAssertion : public MinidumpStream {
string expression_;
string function_;
string file_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpAssertion);
};
@@ -719,6 +747,8 @@ class MinidumpSystemInfo : public MinidumpStream {
// A string identifying the CPU vendor, if known.
const string* cpu_vendor_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpSystemInfo);
};
@@ -752,6 +782,8 @@ class MinidumpMiscInfo : public MinidumpStream {
string daylight_name_;
string build_string_;
string dbg_bld_str_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpMiscInfo);
};
@@ -784,6 +816,8 @@ class MinidumpBreakpadInfo : public MinidumpStream {
bool Read(uint32_t expected_size_);
MDRawBreakpadInfo breakpad_info_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpBreakpadInfo);
};
// MinidumpMemoryInfo wraps MDRawMemoryInfo, which provides information
@@ -854,6 +888,8 @@ class MinidumpMemoryInfoList : public MinidumpStream {
MinidumpMemoryInfos* infos_;
uint32_t info_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryInfoList);
};
// MinidumpLinuxMaps wraps information about a single mapped memory region
@@ -1061,6 +1097,9 @@ class Minidump {
// Print a human-readable representation of the object to stdout.
void Print();
+ // Is the OS Android.
+ bool IsAndroid();
+
private:
// MinidumpStreamInfo is used in the MinidumpStreamMap. It lets
// the Minidump object locate interesting streams quickly, and
@@ -1074,6 +1113,9 @@ class Minidump {
// Pointer to the stream if cached, or NULL if not yet populated
MinidumpStream* stream;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MinidumpStreamInfo);
};
typedef vector<MDRawDirectory> MinidumpDirectoryEntries;
@@ -1121,6 +1163,8 @@ class Minidump {
// construction or after a failed Read(); true following a successful
// Read().
bool valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(Minidump);
};
diff --git a/src/google_breakpad/processor/process_state.h b/src/google_breakpad/processor/process_state.h
index 728656f2..9f12b0c6 100644
--- a/src/google_breakpad/processor/process_state.h
+++ b/src/google_breakpad/processor/process_state.h
@@ -39,8 +39,10 @@
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
-#include "google_breakpad/processor/system_info.h"
+#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/minidump.h"
+#include "google_breakpad/processor/system_info.h"
+#include "processor/linked_ptr.h"
namespace google_breakpad {
@@ -109,6 +111,9 @@ class ProcessState {
}
const SystemInfo* system_info() const { return &system_info_; }
const CodeModules* modules() const { return modules_; }
+ const vector<linked_ptr<const CodeModule> >* shrunk_range_modules() const {
+ return &shrunk_range_modules_;
+ }
const vector<const CodeModule*>* modules_without_symbols() const {
return &modules_without_symbols_;
}
@@ -172,6 +177,10 @@ class ProcessState {
// ProcessState.
const CodeModules *modules_;
+ // The modules which virtual address ranges were shrunk down due to
+ // virtual address conflicts.
+ vector<linked_ptr<const CodeModule> > shrunk_range_modules_;
+
// The modules that didn't have symbols when the report was processed.
vector<const CodeModule*> modules_without_symbols_;