aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/microdump_writer/microdump_writer.cc
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org>2015-08-17 08:02:16 +0000
committerprimiano@chromium.org <primiano@chromium.org>2015-08-17 08:02:16 +0000
commita3e9c0264711807a0509eb5b5441227d39c755d7 (patch)
tree0e1c2fab040b5ebf91664b9bbc1b06b64a1c5238 /src/client/linux/microdump_writer/microdump_writer.cc
parentAdd check for executable stack/heap when rating Linux exploitability. (diff)
downloadbreakpad-a3e9c0264711807a0509eb5b5441227d39c755d7.tar.xz
[microdump] Fix hw architecture indication in build fingerprint line
r1456 introduced the possibility to customize the OS-line of the microdump, enabling to replace, in the case of android, the generic uname() info with the Android build fingerprint. While doing that, it mistakenly removed the HW architecture indication from the format. See crbug.com/520075 for more details. BUG=chromium:520075 R=mmandlis@chromium.org, torne@chromium.org Review URL: https://codereview.chromium.org/1288313002 . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1489 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/microdump_writer/microdump_writer.cc')
-rw-r--r--src/client/linux/microdump_writer/microdump_writer.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/client/linux/microdump_writer/microdump_writer.cc b/src/client/linux/microdump_writer/microdump_writer.cc
index 247387e2..d54d4909 100644
--- a/src/client/linux/microdump_writer/microdump_writer.cc
+++ b/src/client/linux/microdump_writer/microdump_writer.cc
@@ -166,8 +166,9 @@ class MicrodumpWriter {
const char kOSId[] = "L";
#endif
-// We cannot depend on uts.machine. On multiarch devices it always returns the
-// primary arch, not the one that match the executable being run.
+// Dump the runtime architecture. On multiarch devices it might not match the
+// hw architecture (the one returned by uname()), for instance in the case of
+// a 32-bit app running on a aarch64 device.
#if defined(__aarch64__)
const char kArch[] = "arm64";
#elif defined(__ARMEL__)
@@ -189,21 +190,24 @@ class MicrodumpWriter {
LogAppend(" ");
LogAppend(n_cpus);
LogAppend(" ");
+
+ // Dump the HW architecture (e.g., armv7l, aarch64).
+ struct utsname uts;
+ const bool has_uts_info = (uname(&uts) == 0);
+ const char* hwArch = has_uts_info ? uts.machine : "unknown_hw_arch";
+ LogAppend(hwArch);
+ LogAppend(" ");
+
// If the client has attached a build fingerprint to the MinidumpDescriptor
// use that one. Otherwise try to get some basic info from uname().
if (build_fingerprint_) {
LogAppend(build_fingerprint_);
+ } else if (has_uts_info) {
+ LogAppend(uts.release);
+ LogAppend(" ");
+ LogAppend(uts.version);
} else {
- struct utsname uts;
- if (uname(&uts) == 0) {
- LogAppend(uts.machine);
- LogAppend(" ");
- LogAppend(uts.release);
- LogAppend(" ");
- LogAppend(uts.version);
- } else {
- LogAppend("no build fingerprint available");
- }
+ LogAppend("no build fingerprint available");
}
LogCommitLine();
}