Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Alex Vakulenko | 262be3f | 2014-07-30 15:25:50 -0700 | [diff] [blame] | 5 | #include "debugd/src/log_tool.h" |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 6 | |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 7 | #include <glob.h> |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 8 | #include <grp.h> |
| 9 | #include <inttypes.h> |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 10 | #include <lzma.h> |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 11 | #include <pwd.h> |
| 12 | #include <stdint.h> |
| 13 | #include <sys/types.h> |
| 14 | #include <unistd.h> |
Ben Chan | 8e9f6d0 | 2017-09-26 23:04:21 -0700 | [diff] [blame] | 15 | #include <memory> |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 16 | #include <string> |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 17 | #include <utility> |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame] | 18 | #include <vector> |
| 19 | |
Ben Chan | ab93abf | 2017-01-24 13:32:51 -0800 | [diff] [blame] | 20 | #include <base/base64.h> |
Qijiang Fan | 713061e | 2021-03-08 15:45:12 +0900 | [diff] [blame] | 21 | #include <base/check.h> |
| 22 | #include <base/check_op.h> |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 23 | #include <base/files/file.h> |
| 24 | #include <base/files/file_path.h> |
Ben Chan | cd8fda4 | 2014-09-05 08:21:06 -0700 | [diff] [blame] | 25 | #include <base/files/file_util.h> |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 26 | #include <base/json/json_writer.h> |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 27 | #include <base/logging.h> |
Ben Chan | 9953a59 | 2014-02-05 23:32:00 -0800 | [diff] [blame] | 28 | #include <base/strings/string_split.h> |
| 29 | #include <base/strings/string_util.h> |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 30 | #include <base/strings/stringprintf.h> |
| 31 | #include <base/strings/utf_string_conversion_utils.h> |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 32 | #include <base/values.h> |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 33 | |
Rebecca Silberstein | e78af40 | 2014-10-02 10:55:04 -0700 | [diff] [blame] | 34 | #include <chromeos/dbus/service_constants.h> |
Eric Caruso | cc7106c | 2017-04-27 14:22:42 -0700 | [diff] [blame] | 35 | #include <shill/dbus-proxies.h> |
Rebecca Silberstein | e78af40 | 2014-10-02 10:55:04 -0700 | [diff] [blame] | 36 | |
Ben Chan | af12586 | 2017-02-08 23:11:18 -0800 | [diff] [blame] | 37 | #include "debugd/src/constants.h" |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 38 | #include "debugd/src/perf_tool.h" |
Alex Vakulenko | 262be3f | 2014-07-30 15:25:50 -0700 | [diff] [blame] | 39 | #include "debugd/src/process_with_output.h" |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 40 | |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 41 | #include <brillo/files/safe_fd.h> |
| 42 | #include <brillo/files/file_util.h> |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 43 | #include "brillo/key_value_store.h" |
| 44 | #include <brillo/osrelease_reader.h> |
mhasank | 86c46c7 | 2020-08-13 15:36:29 -0700 | [diff] [blame] | 45 | #include <brillo/cryptohome.h> |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 46 | |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 47 | namespace debugd { |
| 48 | |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 49 | using std::string; |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 50 | |
Eric Caruso | 96d03d3 | 2017-04-25 18:01:17 -0700 | [diff] [blame] | 51 | using Strings = std::vector<string>; |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 52 | |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 53 | namespace { |
| 54 | |
Ben Chan | af12586 | 2017-02-08 23:11:18 -0800 | [diff] [blame] | 55 | const char kRoot[] = "root"; |
| 56 | const char kShell[] = "/bin/sh"; |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 57 | constexpr char kLsbReleasePath[] = "/etc/lsb-release"; |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 58 | constexpr char kArcBugReportBackupFileName[] = "arc-bugreport.log"; |
mhasank | d2b8488 | 2020-05-04 17:02:19 -0700 | [diff] [blame] | 59 | constexpr char kArcBugReportBackupKey[] = "arc-bugreport-backup"; |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 60 | constexpr char kDaemonStoreBaseDir[] = "/run/daemon-store/debugd/"; |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 61 | |
| 62 | // Minimum time in seconds needed to allow shill to test active connections. |
| 63 | const int kConnectionTesterTimeoutSeconds = 5; |
Ben Chan | f6cd93a | 2012-10-14 19:37:00 -0700 | [diff] [blame] | 64 | |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 65 | // Default running perf for 2 seconds. |
| 66 | constexpr const int kPerfDurationSecs = 2; |
Chinglin Yu | 3c8d0a2 | 2019-02-20 11:32:52 +0800 | [diff] [blame] | 67 | // TODO(chinglinyu) Remove after crbug/934702 is fixed. |
| 68 | // The following description is added to 'perf-data' as a temporary solution |
| 69 | // before the update of feedback disclosure to users is done in crbug/934702. |
| 70 | constexpr const char kPerfDataDescription[] = |
| 71 | "perf-data contains performance profiling information about how much time " |
| 72 | "the system spends on various activities (program execution stack traces). " |
| 73 | "This might reveal some information about what system features and " |
| 74 | "resources are being used. The full detail of perf-data can be found in " |
| 75 | "the PerfDataProto protocol buffer message type in the chromium source " |
| 76 | "repository.\n"; |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 77 | |
Eric Caruso | a879fd9 | 2017-10-11 12:57:10 -0700 | [diff] [blame] | 78 | #define CMD_KERNEL_MODULE_PARAMS(module_name) \ |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 79 | "cd /sys/module/" #module_name "/parameters 2>/dev/null && grep -sH ^ *" |
Eric Caruso | a879fd9 | 2017-10-11 12:57:10 -0700 | [diff] [blame] | 80 | |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 81 | using Log = LogTool::Log; |
| 82 | constexpr Log::LogType kCommand = Log::kCommand; |
| 83 | constexpr Log::LogType kFile = Log::kFile; |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 84 | constexpr Log::LogType kGlob = Log::kGlob; |
mhasank | af5251d | 2020-04-29 18:53:03 -0700 | [diff] [blame] | 85 | |
| 86 | class ArcBugReportLog : public LogTool::Log { |
| 87 | public: |
| 88 | ArcBugReportLog() |
| 89 | : Log(kCommand, |
| 90 | "arc-bugreport", |
| 91 | "/usr/bin/nsenter -t1 -m /usr/sbin/android-sh -c " |
| 92 | "/system/bin/arc-bugreport", |
| 93 | kRoot, |
| 94 | kRoot, |
| 95 | 10 * 1024 * 1024 /*10 MiB*/, |
| 96 | LogTool::Encoding::kUtf8) {} |
| 97 | |
| 98 | virtual ~ArcBugReportLog() = default; |
| 99 | }; |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 100 | |
Miriam Zimmerman | d91d8e7 | 2019-06-27 12:24:04 -0700 | [diff] [blame] | 101 | // NOTE: IF YOU ADD AN ENTRY TO THIS LIST, PLEASE: |
| 102 | // * add a row to http://go/cros-feedback-audit and fill it out |
Miriam Zimmerman | 4f142ba | 2020-06-01 14:15:21 -0700 | [diff] [blame] | 103 | // * email cros-telemetry@ |
Miriam Zimmerman | d91d8e7 | 2019-06-27 12:24:04 -0700 | [diff] [blame] | 104 | // (Eventually we'll have a better process, but for now please do this.) |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 105 | // clang-format off |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 106 | const std::vector<Log> kCommandLogs { |
Mike Frysinger | b035099 | 2018-09-14 13:45:35 -0400 | [diff] [blame] | 107 | // We need to enter init's mount namespace because it has /home/chronos |
| 108 | // mounted which is where the consent knob lives. We don't have that mount |
| 109 | // in our own mount namespace (by design). https://crbug.com/884249 |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 110 | {kCommand, "CLIENT_ID", "/usr/bin/nsenter -t1 -m /usr/bin/metrics_client -i", |
| 111 | kRoot, kDebugfsGroup}, |
Nikolai Artemiev | 9a7c3a5 | 2021-03-09 12:31:25 +1100 | [diff] [blame] | 112 | // The device type / form factor e.g. CHROMEBOOK, CHROMEBOX, etc. |
| 113 | {kCommand, "DEVICETYPE", "cros_config /hardware-properties form-factor"}, |
Kimiyuki Onaka | 3aab14e | 2021-02-22 13:13:07 +0900 | [diff] [blame] | 114 | // We consistently use UTC in feedback reports. |
| 115 | {kCommand, "LOGDATE", "/bin/date --utc; /bin/date"}, |
Yusuke Sato | 27a3167 | 2019-04-29 15:26:37 -0700 | [diff] [blame] | 116 | // We need to enter init's mount namespace to access /home/root. Also, we use |
| 117 | // neither ARC container's mount namespace (with android-sh) nor |
| 118 | // /opt/google/containers/android/rootfs/android-data/ so that we can get |
| 119 | // results even when the container is down. |
| 120 | {kCommand, "android_app_storage", "/usr/bin/nsenter -t1 -m " |
| 121 | "/bin/sh -c \"/usr/bin/du -h /home/root/*/android-data/data/\"", |
| 122 | kRoot, kDebugfsGroup}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 123 | {kFile, "atrus_logs", "/var/log/atrus.log"}, |
| 124 | {kFile, "authpolicy", "/var/log/authpolicy.log"}, |
Kimiyuki Onaka | fc37289 | 2020-11-24 23:28:20 +0900 | [diff] [blame] | 125 | #if USE_ARCVM |
| 126 | {kCommand, "arcvm_console_output", "/usr/bin/vm_pstore_dump", "crosvm", |
Junichi Uekawa | ce96c6d | 2021-03-12 09:34:10 +0900 | [diff] [blame] | 127 | "crosvm", Log::kDefaultMaxBytes, LogTool::Encoding::kAutodetect, |
| 128 | true /* access_root_mount_ns */}, |
Kimiyuki Onaka | fc37289 | 2020-11-24 23:28:20 +0900 | [diff] [blame] | 129 | #endif // USE_ARCVM |
Brian Norris | afc9f63 | 2019-05-09 14:08:28 -0700 | [diff] [blame] | 130 | {kCommand, "bootstat_summary", "/usr/bin/bootstat_summary", |
| 131 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
Junichi Uekawa | ce96c6d | 2021-03-12 09:34:10 +0900 | [diff] [blame] | 132 | Log::kDefaultMaxBytes, LogTool::Encoding::kAutodetect, |
| 133 | true /* access_root_mount_ns */}, |
Craig Hesling | 5c384b5 | 2019-04-20 15:18:06 -0700 | [diff] [blame] | 134 | {kFile, "bio_crypto_init.LATEST", |
| 135 | "/var/log/bio_crypto_init/bio_crypto_init.LATEST"}, |
| 136 | {kFile, "bio_crypto_init.PREVIOUS", |
| 137 | "/var/log/bio_crypto_init/bio_crypto_init.PREVIOUS"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 138 | {kFile, "biod.LATEST", "/var/log/biod/biod.LATEST"}, |
| 139 | {kFile, "biod.PREVIOUS", "/var/log/biod/biod.PREVIOUS"}, |
Craig Hesling | 4c3891e | 2019-04-20 12:53:54 -0700 | [diff] [blame] | 140 | {kFile, "bio_fw_updater.LATEST", "/var/log/biod/bio_fw_updater.LATEST"}, |
| 141 | {kFile, "bio_fw_updater.PREVIOUS", "/var/log/biod/bio_fw_updater.PREVIOUS"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 142 | {kFile, "bios_info", "/var/log/bios_info.txt"}, |
| 143 | {kCommand, "bios_log", "cat /sys/firmware/log " |
| 144 | "/proc/device-tree/chosen/ap-console-buffer 2>/dev/null"}, |
| 145 | {kFile, "bios_times", "/var/log/bios_times.txt"}, |
Anand K Mistry | ccceb1e | 2020-01-16 14:00:49 +1100 | [diff] [blame] | 146 | // Slow or non-responsive block devices could cause this command to stall. Use |
| 147 | // a timeout to prevent this command from blocking log fetching. This command |
| 148 | // is expected to take O(100ms) in the normal case. |
| 149 | {kCommand, "blkid", "timeout -s KILL 5s /sbin/blkid", kRoot, kRoot}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 150 | {kFile, "buddyinfo", "/proc/buddyinfo"}, |
| 151 | {kCommand, "cbi_info", "/usr/share/userfeedback/scripts/cbi_info", kRoot, |
| 152 | kRoot}, |
| 153 | {kFile, "cheets_log", "/var/log/arc.log"}, |
| 154 | {kFile, "clobber.log", "/var/log/clobber.log"}, |
| 155 | {kFile, "clobber-state.log", "/var/log/clobber-state.log"}, |
Sonny Rao | bd3dc00 | 2020-05-27 21:40:35 -0700 | [diff] [blame] | 156 | {kCommand, "chromeos-pgmem", "/usr/bin/chromeos-pgmem", kRoot, kRoot}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 157 | {kFile, "chrome_system_log", "/var/log/chrome/chrome"}, |
| 158 | {kFile, "chrome_system_log.PREVIOUS", "/var/log/chrome/chrome.PREVIOUS"}, |
Mike Frysinger | 32cdf3e | 2017-08-14 18:17:06 -0400 | [diff] [blame] | 159 | // There might be more than one record, so grab them all. |
| 160 | // Plus, for <linux-3.19, it's named "console-ramoops", but for newer |
| 161 | // versions, it's named "console-ramoops-#". |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 162 | {kGlob, "console-ramoops", "/sys/fs/pstore/console-ramoops*"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 163 | {kFile, "cpuinfo", "/proc/cpuinfo"}, |
| 164 | {kFile, "cr50_version", "/var/cache/cr50-version"}, |
Nicolas Boichat | f3dd82d | 2020-09-07 15:11:15 +0800 | [diff] [blame] | 165 | {kFile, "cros_ec.log", "/var/log/cros_ec.log", |
| 166 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 167 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
| 168 | {kFile, "cros_ec.previous", "/var/log/cros_ec.previous", |
| 169 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 170 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 171 | {kFile, "cros_ec_panicinfo", "/sys/kernel/debug/cros_ec/panicinfo", |
Nicolas Boichat | 28272d7 | 2020-09-03 09:10:44 +0800 | [diff] [blame] | 172 | SandboxedProcess::kDefaultUser, kDebugfsGroup, Log::kDefaultMaxBytes, |
| 173 | LogTool::Encoding::kBase64}, |
Stephen Boyd | f00c5a0 | 2020-09-10 19:11:35 -0700 | [diff] [blame] | 174 | {kCommand, "cros_ec_pdinfo", |
| 175 | "for port in 0 1 2 3 4 5 6 7 8; do " |
| 176 | "echo \"-----------\"; " |
| 177 | // stderr output just tells us it failed |
| 178 | "ectool usbpd \"${port}\" 2>/dev/null || break; " |
| 179 | "done", kRoot, kRoot}, |
Nicolas Boichat | f3dd82d | 2020-09-07 15:11:15 +0800 | [diff] [blame] | 180 | {kFile, "cros_fp.previous", "/var/log/cros_fp.previous", |
| 181 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 182 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
| 183 | {kFile, "cros_fp.log", "/var/log/cros_fp.log", |
| 184 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 185 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
| 186 | {kFile, "cros_ish.previous", "/var/log/cros_ish.previous", |
| 187 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 188 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
| 189 | {kFile, "cros_ish.log", "/var/log/cros_ish.log", |
| 190 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 191 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
Nicolas Boichat | 579ccf3 | 2020-08-31 11:17:21 +0800 | [diff] [blame] | 192 | {kFile, "cros_scp.previous", "/var/log/cros_scp.previous", |
| 193 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 194 | 64 * 1024, LogTool::Encoding::kUtf8}, |
| 195 | {kFile, "cros_scp.log", "/var/log/cros_scp.log", |
| 196 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 197 | 64 * 1024, LogTool::Encoding::kUtf8}, |
David Munro | 0eb1ac3 | 2020-08-19 22:22:56 +1000 | [diff] [blame] | 198 | {kCommand, "crosvm.log", "nsenter -t1 -m /bin/sh -c 'tail -n+1" |
| 199 | " /run/daemon-store/crosvm/*/log/*.log.1" |
| 200 | " /run/daemon-store/crosvm/*/log/*.log'", kRoot, kRoot}, |
Steven 'Steve' Kendall | 33f7219 | 2021-02-16 16:36:16 -0500 | [diff] [blame] | 201 | // dmesg: add full timestamps to dmesg to match other logs. |
Jorge Lucangeli Obes | af8f79c | 2020-11-13 08:54:55 -0500 | [diff] [blame] | 202 | // 'dmesg' needs CAP_SYSLOG. |
Steven 'Steve' Kendall | 33f7219 | 2021-02-16 16:36:16 -0500 | [diff] [blame] | 203 | {kCommand, "dmesg", "TZ=UTC /bin/dmesg --time-format iso", kRoot, kRoot}, |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 204 | {kGlob, "drm_gem_objects", "/sys/kernel/debug/dri/?/gem", |
Stephen Boyd | a828716 | 2020-07-30 18:07:53 -0700 | [diff] [blame] | 205 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 206 | {kGlob, "drm_state", "/sys/kernel/debug/dri/?/state", |
Stephen Boyd | a828716 | 2020-07-30 18:07:53 -0700 | [diff] [blame] | 207 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 208 | {kFile, "ec_info", "/var/log/ec_info.txt"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 209 | {kCommand, "edid-decode", |
Stephen Boyd | af3118b | 2020-08-11 11:42:22 -0700 | [diff] [blame] | 210 | "for f in /sys/class/drm/card?-*/edid; do " |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 211 | "echo \"----------- ${f}\"; " |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 212 | // edid-decode's stderr output is redundant, so silence it. |
Jeffrey Kardatzke | 9ba9f32 | 2019-08-29 10:23:14 -0700 | [diff] [blame] | 213 | "edid-decode \"${f}\" 2>/dev/null; " |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 214 | "done"}, |
| 215 | {kFile, "eventlog", "/var/log/eventlog.txt"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 216 | {kCommand, "font_info", "/usr/share/userfeedback/scripts/font_info"}, |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 217 | {kGlob, "framebuffer", "/sys/kernel/debug/dri/?/framebuffer", |
Kuo-Hsin Yang | 95296e1 | 2020-03-06 17:52:35 +0800 | [diff] [blame] | 218 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Daniel Campello | 9f0b2b8 | 2020-10-23 11:01:01 -0600 | [diff] [blame] | 219 | {kCommand, "fwupd_state", "/sbin/initctl emit fwupdtool-getdevices;" |
| 220 | "cat /var/lib/fwupd/state.json", kRoot, kRoot}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 221 | {kCommand, "sensor_info", "/usr/share/userfeedback/scripts/sensor_info"}, |
| 222 | {kFile, "hammerd", "/var/log/hammerd.log"}, |
| 223 | {kCommand, "hardware_class", "/usr/bin/crossystem hwid"}, |
Yong Hong | 15e4b03 | 2020-03-05 15:41:31 +0800 | [diff] [blame] | 224 | {kFile, "hardware_verification_report", |
| 225 | "/var/cache/hardware_verifier.result"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 226 | {kCommand, "hostname", "/bin/hostname"}, |
| 227 | {kFile, "i915_gem_gtt", "/sys/kernel/debug/dri/0/i915_gem_gtt", |
| 228 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
| 229 | {kFile, "i915_gem_objects", "/sys/kernel/debug/dri/0/i915_gem_objects", |
| 230 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 231 | {kCommand, "i915_error_state", |
| 232 | "/usr/bin/xz -c /sys/kernel/debug/dri/0/i915_error_state 2>/dev/null", |
| 233 | SandboxedProcess::kDefaultUser, kDebugfsGroup, Log::kDefaultMaxBytes, |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 234 | LogTool::Encoding::kBase64}, |
Evan Benn | 0e373cc | 2021-01-07 15:10:26 +1100 | [diff] [blame] | 235 | {kFile, "amdgpu_gem_info", "/sys/kernel/debug/dri/0/amdgpu_gem_info", |
| 236 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
| 237 | {kFile, "amdgpu_gtt_mm", "/sys/kernel/debug/dri/0/amdgpu_gtt_mm", |
| 238 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
| 239 | {kFile, "amdgpu_vram_mm", "/sys/kernel/debug/dri/0/amdgpu_vram_mm", |
| 240 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 241 | {kCommand, "ifconfig", "/bin/ifconfig -a"}, |
| 242 | {kFile, "input_devices", "/proc/bus/input/devices"}, |
Eric Caruso | b1820c0 | 2017-08-24 15:39:56 -0700 | [diff] [blame] | 243 | // Hardware capabilities of the wiphy device. |
Alex Levin | e1c6d57 | 2019-09-17 14:45:33 -0700 | [diff] [blame] | 244 | {kFile, "interrupts", "/proc/interrupts"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 245 | {kCommand, "iw_list", "/usr/sbin/iw list"}, |
Eric Caruso | a879fd9 | 2017-10-11 12:57:10 -0700 | [diff] [blame] | 246 | #if USE_IWLWIFI_DUMP |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 247 | {kCommand, "iwlmvm_module_params", CMD_KERNEL_MODULE_PARAMS(iwlmvm)}, |
| 248 | {kCommand, "iwlwifi_module_params", CMD_KERNEL_MODULE_PARAMS(iwlwifi)}, |
Eric Caruso | a879fd9 | 2017-10-11 12:57:10 -0700 | [diff] [blame] | 249 | #endif // USE_IWLWIFI_DUMP |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 250 | {kGlob, "kernel-crashes", "/var/spool/crash/kernel.*.kcrash", |
Mike Frysinger | 2abf7a1 | 2020-12-16 05:39:02 -0500 | [diff] [blame] | 251 | SandboxedProcess::kDefaultUser, "crash-access"}, |
Anand K Mistry | ccceb1e | 2020-01-16 14:00:49 +1100 | [diff] [blame] | 252 | {kCommand, "lsblk", "timeout -s KILL 5s lsblk -a", kRoot, kRoot, |
Junichi Uekawa | ce96c6d | 2021-03-12 09:34:10 +0900 | [diff] [blame] | 253 | Log::kDefaultMaxBytes, LogTool::Encoding::kAutodetect, |
| 254 | true /* access_root_mount_ns */}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 255 | {kCommand, "lsmod", "lsmod"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 256 | {kCommand, "lsusb", "lsusb && lsusb -t"}, |
Kuo-Hsin Yang | 66d8983 | 2020-02-10 17:22:28 +0800 | [diff] [blame] | 257 | {kFile, "mali_memory", "/sys/kernel/debug/mali0/gpu_memory", |
| 258 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 259 | {kFile, "memd.parameters", "/var/log/memd/memd.parameters"}, |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 260 | {kGlob, "memd clips", "/var/log/memd/memd.clip*"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 261 | {kFile, "meminfo", "/proc/meminfo"}, |
| 262 | {kCommand, "memory_spd_info", |
| 263 | // mosys may use 'i2c-dev', which may not be loaded yet. |
| 264 | "modprobe i2c-dev 2>/dev/null && mosys -l memory spd print all 2>/dev/null", |
| 265 | kRoot, kDebugfsGroup}, |
Simon Que | cb63b9c | 2017-06-19 14:53:31 -0400 | [diff] [blame] | 266 | // The sed command finds the EDID blob (starting the line after "value:") and |
| 267 | // replaces the serial number with all zeroes. |
| 268 | // |
| 269 | // The EDID is printed as a hex dump over several lines, each line containing |
| 270 | // the contents of 16 bytes. The first 16 bytes are broken down as follows: |
| 271 | // uint64_t fixed_pattern; // Always 00 FF FF FF FF FF FF 00. |
| 272 | // uint16_t manufacturer_id; // Manufacturer ID, encoded as PNP IDs. |
| 273 | // uint16_t product_code; // Manufacturer product code, little-endian. |
| 274 | // uint32_t serial_number; // Serial number, little-endian. |
| 275 | // Source: https://en.wikipedia.org/wiki/EDID#EDID_1.3_data_format |
| 276 | // |
| 277 | // The subsequent substitution command looks for the fixed pattern followed by |
| 278 | // two 32-bit fields (manufacturer + product, serial number). It replaces the |
| 279 | // latter field with 8 bytes of zeroes. |
| 280 | // |
| 281 | // TODO(crbug.com/731133): Remove the sed command once modetest itself can |
| 282 | // remove serial numbers. |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 283 | {kCommand, "modetest", |
| 284 | "(modetest; modetest -M evdi; modetest -M udl) | " |
| 285 | "sed -E '/EDID/ {:a;n;/value:/!ba;n;" |
| 286 | "s/(00f{12}00)([0-9a-f]{8})([0-9a-f]{8})/\\1\\200000000/}'", |
| 287 | kRoot, kRoot}, |
| 288 | {kFile, "mount-encrypted", "/var/log/mount-encrypted.log"}, |
| 289 | {kFile, "mountinfo", "/proc/1/mountinfo"}, |
| 290 | {kCommand, "netlog", |
Brian Norris | 7258846 | 2021-01-25 19:32:31 -0800 | [diff] [blame] | 291 | "/usr/share/userfeedback/scripts/getmsgs /var/log/net.log", |
| 292 | SandboxedProcess::kDefaultUser, SandboxedProcess::kDefaultGroup, |
| 293 | Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 294 | {kFile, "nvmap_iovmm", "/sys/kernel/debug/nvmap/iovmm/allocations", |
| 295 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
| 296 | {kCommand, "oemdata", "/usr/share/cros/oemdata.sh", kRoot, kRoot}, |
Kuo-Hsin Yang | a69ecc6 | 2020-03-11 17:37:11 +0800 | [diff] [blame] | 297 | {kFile, "pagetypeinfo", "/proc/pagetypeinfo", kRoot}, |
Daisuke Nojiri | 3c6e6a1 | 2017-02-17 14:21:28 -0800 | [diff] [blame] | 298 | {kCommand, "pchg_info", "/usr/share/userfeedback/scripts/pchg_info", |
| 299 | kRoot, kRoot}, |
Jack Rosenthal | 3cf794a | 2020-02-19 13:32:56 -0700 | [diff] [blame] | 300 | {kFile, "platform_identity_name", |
| 301 | "/run/chromeos-config/v1/identity/platform-name"}, |
| 302 | {kFile, "platform_identity_model", "/run/chromeos-config/v1/name"}, |
| 303 | {kFile, "platform_identity_sku", "/run/chromeos-config/v1/identity/sku-id"}, |
| 304 | {kFile, "platform_identity_whitelabel_tag", |
| 305 | "/run/chromeos-config/v1/identity/whitelabel-tag"}, |
| 306 | {kFile, "platform_identity_customization_id", |
| 307 | "/run/chromeos-config/v1/identity/customization-id"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 308 | {kCommand, "power_supply_info", "/usr/bin/power_supply_info"}, |
| 309 | {kCommand, "power_supply_sysfs", "/usr/bin/print_sysfs_power_supply_data"}, |
| 310 | {kFile, "powerd.LATEST", "/var/log/power_manager/powerd.LATEST"}, |
| 311 | {kFile, "powerd.PREVIOUS", "/var/log/power_manager/powerd.PREVIOUS"}, |
| 312 | {kFile, "powerd.out", "/var/log/powerd.out"}, |
| 313 | {kFile, "powerwash_count", "/var/log/powerwash_count"}, |
Brian Norris | 4cde3d1 | 2019-04-16 10:10:34 -0700 | [diff] [blame] | 314 | {kCommand, "ps", "/bin/ps auxZ"}, |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 315 | {kGlob, "qcom_fw_info", "/sys/kernel/debug/qcom_socinfo/*/*", |
Stephen Boyd | 57779f9 | 2020-12-15 23:24:31 -0800 | [diff] [blame] | 316 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
yusukes | 34171ba | 2017-04-27 15:46:01 -0700 | [diff] [blame] | 317 | // /proc/slabinfo is owned by root and has 0400 permission. |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 318 | {kFile, "slabinfo", "/proc/slabinfo", kRoot, kRoot}, |
| 319 | {kFile, "storage_info", "/var/log/storage_info.txt"}, |
| 320 | {kCommand, "swap_info", "/usr/share/cros/init/swap.sh status 2>/dev/null", |
| 321 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
| 322 | {kCommand, "syslog", |
| 323 | "/usr/share/userfeedback/scripts/getmsgs /var/log/messages"}, |
| 324 | {kCommand, "system_log_stats", |
| 325 | "echo 'BLOCK_SIZE=1024'; " |
| 326 | "find /var/log/ -type f -exec du --block-size=1024 {} + | sort -n -r", |
| 327 | kRoot, kRoot}, |
| 328 | {kCommand, "threads", "/bin/ps -T axo pid,ppid,spid,pcpu,ni,stat,time,comm"}, |
| 329 | {kFile, "tlsdate", "/var/log/tlsdate.log"}, |
Nick Sanders | ad5dc13 | 2019-11-15 15:59:42 -0800 | [diff] [blame] | 330 | {kCommand, "top thread", "/usr/bin/top -Hbc -w128 -n 1 | head -n 40"}, |
| 331 | {kCommand, "top memory", |
| 332 | "/usr/bin/top -o \"+%MEM\" -w128 -bcn 1 | head -n 57"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 333 | {kCommand, "touch_fw_version", |
Stephen Boyd | db9eb2f | 2020-08-11 11:25:41 -0700 | [diff] [blame] | 334 | "grep -aE" |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 335 | " -e 'synaptics: Touchpad model'" |
| 336 | " -e 'chromeos-[a-z]*-touch-[a-z]*-update'" |
| 337 | " /var/log/messages | tail -n 20"}, |
| 338 | {kCommand, "tpm-firmware-updater", "/usr/share/userfeedback/scripts/getmsgs " |
| 339 | "/var/log/tpm-firmware-updater.log"}, |
Mattias Nissler | 887dce2 | 2017-07-03 14:44:35 +0200 | [diff] [blame] | 340 | // TODO(jorgelo,mnissler): Don't run this as root. |
| 341 | // On TPM 1.2 devices this will likely require adding a new user to the 'tss' |
| 342 | // group. |
| 343 | // On TPM 2.0 devices 'get_version_info' uses D-Bus and therefore can run as |
| 344 | // any user. |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 345 | {kCommand, "tpm_version", "/usr/sbin/tpm-manager get_version_info", kRoot, |
| 346 | kRoot}, |
Prashant Malani | 39ddecd | 2021-02-25 17:11:39 -0800 | [diff] [blame] | 347 | // typecd logs average around 56K. VID/PIDs are obfuscated from the printed |
| 348 | // PD identity information. |
| 349 | {kFile, "typecd", "/var/log/typecd.log"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 350 | {kCommand, "atmel_ts_refs", |
| 351 | "/opt/google/touch/scripts/atmel_tools.sh ts r", kRoot, kRoot}, |
| 352 | {kCommand, "atmel_tp_refs", |
| 353 | "/opt/google/touch/scripts/atmel_tools.sh tp r", kRoot, kRoot}, |
| 354 | {kCommand, "atmel_ts_deltas", |
| 355 | "/opt/google/touch/scripts/atmel_tools.sh ts d", kRoot, kRoot}, |
| 356 | {kCommand, "atmel_tp_deltas", |
| 357 | "/opt/google/touch/scripts/atmel_tools.sh tp d", kRoot, kRoot}, |
| 358 | {kFile, "stateful_trim_state", "/var/lib/trim/stateful_trim_state"}, |
| 359 | {kFile, "stateful_trim_data", "/var/lib/trim/stateful_trim_data"}, |
| 360 | {kFile, "ui_log", "/var/log/ui/ui.LATEST"}, |
| 361 | {kCommand, "uname", "/bin/uname -a"}, |
| 362 | {kCommand, "update_engine.log", |
| 363 | "cat $(ls -1tr /var/log/update_engine | tail -5 | sed" |
| 364 | " s.^./var/log/update_engine/.)"}, |
Chris Morin | ca15271 | 2019-05-03 13:17:28 -0700 | [diff] [blame] | 365 | {kFile, "upstart", "/var/log/upstart.log"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 366 | {kCommand, "uptime", "/usr/bin/cut -d' ' -f1 /proc/uptime"}, |
Prashant Malani | 9704ed0 | 2021-02-10 16:19:22 -0800 | [diff] [blame] | 367 | {kCommand, "usb4 devices", "/usr/libexec/debugd/helpers/usb4_devinfo_helper", |
| 368 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 369 | {kFile, "verified boot", "/var/log/debug_vboot_noisy.log"}, |
| 370 | {kFile, "vmlog.1.LATEST", "/var/log/vmlog/vmlog.1.LATEST"}, |
| 371 | {kFile, "vmlog.1.PREVIOUS", "/var/log/vmlog/vmlog.1.PREVIOUS"}, |
| 372 | {kFile, "vmlog.LATEST", "/var/log/vmlog/vmlog.LATEST"}, |
| 373 | {kFile, "vmlog.PREVIOUS", "/var/log/vmlog/vmlog.PREVIOUS"}, |
| 374 | {kFile, "vmstat", "/proc/vmstat"}, |
| 375 | {kFile, "vpd_2.0", "/var/log/vpd_2.0.txt"}, |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 376 | {kFile, "zram compressed data size", "/sys/block/zram0/compr_data_size"}, |
| 377 | {kFile, "zram original data size", "/sys/block/zram0/orig_data_size"}, |
| 378 | {kFile, "zram total memory used", "/sys/block/zram0/mem_used_total"}, |
| 379 | {kFile, "zram total reads", "/sys/block/zram0/num_reads"}, |
| 380 | {kFile, "zram total writes", "/sys/block/zram0/num_writes"}, |
| 381 | {kCommand, "zram new stats names", |
| 382 | "echo orig_size compr_size used_total limit used_max zero_pages migrated"}, |
| 383 | {kFile, "zram new stats values", "/sys/block/zram0/mm_stat"}, |
| 384 | {kFile, "cros_tp version", "/sys/class/chromeos/cros_tp/version"}, |
| 385 | {kCommand, "cros_tp console", "/usr/sbin/ectool --name=cros_tp console", |
| 386 | kRoot, kRoot}, |
| 387 | {kCommand, "cros_tp frame", "/usr/sbin/ectool --name=cros_tp tpframeget", |
| 388 | kRoot, kRoot}, |
| 389 | {kCommand, "crostini", "/usr/bin/cicerone_client --get_info"}, |
Sean Paul | bfc5c42 | 2020-07-24 11:03:51 -0400 | [diff] [blame] | 390 | // TODO(seanpaul): Once we've finished moving over to the upstream tracefs |
| 391 | // implementation, remove drm_trace_legacy. Tracked in |
| 392 | // b/163580546. |
| 393 | {kFile, "drm_trace_legacy", "/sys/kernel/debug/dri/trace", |
| 394 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
| 395 | {kFile, "drm_trace", "/sys/kernel/debug/tracing/instances/drm/trace", |
Sean Paul | 5ce118f | 2019-12-05 08:41:32 -0500 | [diff] [blame] | 396 | SandboxedProcess::kDefaultUser, kDebugfsGroup}, |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 397 | // Stuff pulled out of the original list. These need access to the running X |
| 398 | // session, which we'd rather not give to debugd, or return info specific to |
| 399 | // the current session (in the setsid(2) sense), which is not useful for |
| 400 | // debugd |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 401 | // {kCommand, "env", "set"}, |
| 402 | // {kCommand, "setxkbmap", "/usr/bin/setxkbmap -print -query"}, |
| 403 | // {kCommand, "xrandr", "/usr/bin/xrandr --verbose} |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 404 | }; |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 405 | // clang-format on |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 406 | |
Arowa Suliman | 3bc729c | 2021-03-09 13:25:00 -0800 | [diff] [blame] | 407 | const std::vector<Log> kCommandLogsVerbose{ |
Arowa Suliman | 19ef633 | 2021-04-09 17:23:16 -0700 | [diff] [blame^] | 408 | // PCI config space accesses are limited without CAP_SYS_ADMIN. |
| 409 | {kCommand, "lspci_verbose", "/usr/sbin/lspci -vvvnn", kRoot, kRoot}, |
Arowa Suliman | 3bc729c | 2021-03-09 13:25:00 -0800 | [diff] [blame] | 410 | }; |
| 411 | |
| 412 | const std::vector<Log> kCommandLogsShort{ |
| 413 | {kCommand, "lspci", "/usr/sbin/lspci"}, |
| 414 | }; |
| 415 | |
Junichi Uekawa | ba686c8 | 2020-09-01 16:24:24 +0900 | [diff] [blame] | 416 | // Extra logs are logs such as netstat and logcat which should appear in |
| 417 | // chrome://system but not in feedback reports. Open sockets may have privacy |
| 418 | // implications, and logcat is already incorporated via arc-bugreport. |
| 419 | // |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 420 | // clang-format off |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 421 | const std::vector<Log> kExtraLogs { |
Ben Chan | 36e4228 | 2014-02-12 22:32:34 -0800 | [diff] [blame] | 422 | #if USE_CELLULAR |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 423 | {kCommand, "mm-status", "/usr/bin/modem status"}, |
Ben Chan | 36e4228 | 2014-02-12 22:32:34 -0800 | [diff] [blame] | 424 | #endif // USE_CELLULAR |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 425 | {kCommand, "network-devices", "/usr/bin/connectivity show devices"}, |
| 426 | {kCommand, "network-services", "/usr/bin/connectivity show services"}, |
Jeffrey Kardatzke | 36791f2 | 2019-07-11 11:53:22 -0700 | [diff] [blame] | 427 | {kCommand, "wifi_status_no_anonymize", |
| 428 | "/usr/bin/network_diag --wifi-internal --no-log"}, |
Chris Morin | 253a2b0 | 2019-04-12 16:04:25 -0700 | [diff] [blame] | 429 | // --processes requires root. |
| 430 | {kCommand, "netstat", |
| 431 | "/sbin/ss --all --query inet --numeric --processes", kRoot, kRoot}, |
Kansho Nishida | 6ae546f | 2019-08-13 17:14:58 +0900 | [diff] [blame] | 432 | {kCommand, "logcat", |
| 433 | "/usr/bin/nsenter -t1 -m /usr/sbin/android-sh -c '/system/bin/logcat -d'", |
Chris Morin | 253a2b0 | 2019-04-12 16:04:25 -0700 | [diff] [blame] | 434 | kRoot, kRoot, Log::kDefaultMaxBytes, LogTool::Encoding::kUtf8}, |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 435 | }; |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 436 | // clang-format on |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 437 | |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 438 | // clang-format off |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 439 | const std::vector<Log> kFeedbackLogs { |
Will Donnelly | ac90514 | 2021-02-16 09:52:06 -0800 | [diff] [blame] | 440 | {kGlob, "iwlwifi_firmware_version", |
| 441 | "/sys/kernel/debug/iwlwifi/*/iwlmvm/fw_ver", kRoot, kRoot}, |
| 442 | {kCommand, "iwlwifi_sysasserts", |
| 443 | "croslog --show-cursor=false --identifier=kernel --priority=err" |
| 444 | " --grep='iwlwifi.*ADVANCED_SYSASSERT' | tail -n 3"}, |
| 445 | {kCommand, "iwlwifi_sysasserts_count", |
| 446 | "croslog --show-cursor=false --identifier=kernel --priority=err" |
| 447 | " --grep='iwlwifi.*ADVANCED_SYSASSERT' | wc -l"}, |
Ben Chan | 36e4228 | 2014-02-12 22:32:34 -0800 | [diff] [blame] | 448 | #if USE_CELLULAR |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 449 | {kCommand, "mm-status", "/usr/bin/modem status-feedback"}, |
Ben Chan | 36e4228 | 2014-02-12 22:32:34 -0800 | [diff] [blame] | 450 | #endif // USE_CELLULAR |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 451 | {kCommand, "network-devices", |
| 452 | "/usr/bin/connectivity show-feedback devices"}, |
| 453 | {kCommand, "network-services", |
| 454 | "/usr/bin/connectivity show-feedback services"}, |
Will Donnelly | ac90514 | 2021-02-16 09:52:06 -0800 | [diff] [blame] | 455 | {kCommand, "shill_connection_diagnostic", |
| 456 | "croslog --show-cursor=false --identifier=shill" |
| 457 | " --grep='Connection issue:' | tail -n 3"}, |
| 458 | {kCommand, "wifi_connection_attempts", |
| 459 | "croslog --show-cursor=false --identifier=kernel" |
| 460 | " --grep='(authenticate|associate) with' | wc -l"}, |
| 461 | {kCommand, "wifi_connection_timeouts", |
| 462 | "croslog --show-cursor=false --identifier=kernel" |
| 463 | " --grep='(authentication|association).*timed out' | wc -l"}, |
| 464 | {kCommand, "wifi_driver_errors", |
| 465 | "croslog --show-cursor=false --identifier=kernel --priority=err" |
| 466 | " --grep='(iwlwifi|mwifiex|ath10k)' | tail -n 3"}, |
| 467 | {kCommand, "wifi_driver_errors_count", |
| 468 | "croslog --show-cursor=false --identifier=kernel --priority=err" |
| 469 | " --grep='(iwlwifi|mwifiex|ath10k)' | wc -l"}, |
Jeffrey Kardatzke | 36791f2 | 2019-07-11 11:53:22 -0700 | [diff] [blame] | 470 | {kCommand, "wifi_status", |
| 471 | "/usr/bin/network_diag --wifi-internal --no-log --anonymize"}, |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 472 | }; |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 473 | // clang-format on |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 474 | |
Jeffrey Kardatzke | e3ec6fd | 2019-08-05 12:25:17 -0700 | [diff] [blame] | 475 | // Fills |dictionary| with the contents of the logs in |logs|. |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 476 | void GetLogsInDictionary(const std::vector<Log>& logs, |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 477 | base::Value* dictionary) { |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 478 | for (const Log& log : logs) { |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 479 | dictionary->SetStringKey(log.GetName(), log.GetLogData()); |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 480 | } |
| 481 | } |
| 482 | |
| 483 | // Serializes the |dictionary| into the file with the given |fd| in a JSON |
| 484 | // format. |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 485 | void SerializeLogsAsJSON(const base::Value& dictionary, |
Eric Caruso | 0b24188 | 2018-04-04 13:43:46 -0700 | [diff] [blame] | 486 | const base::ScopedFD& fd) { |
Eric Caruso | 96d03d3 | 2017-04-25 18:01:17 -0700 | [diff] [blame] | 487 | string logs_json; |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 488 | base::JSONWriter::WriteWithOptions( |
| 489 | dictionary, base::JSONWriter::OPTIONS_PRETTY_PRINT, &logs_json); |
Eric Caruso | 0b24188 | 2018-04-04 13:43:46 -0700 | [diff] [blame] | 490 | base::WriteFileDescriptor(fd.get(), logs_json.c_str(), logs_json.size()); |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 491 | } |
| 492 | |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 493 | bool GetNamedLogFrom(const string& name, |
| 494 | const std::vector<Log>& logs, |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 495 | string* result) { |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 496 | for (const Log& log : logs) { |
| 497 | if (name == log.GetName()) { |
| 498 | *result = log.GetLogData(); |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 499 | return true; |
| 500 | } |
| 501 | } |
| 502 | *result = "<invalid log name>"; |
| 503 | return false; |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 504 | } |
| 505 | |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 506 | void GetLogsFrom(const std::vector<Log>& logs, LogTool::LogMap* map) { |
| 507 | for (const Log& log : logs) |
| 508 | (*map)[log.GetName()] = log.GetLogData(); |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 509 | } |
| 510 | |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 511 | void GetLsbReleaseInfo(LogTool::LogMap* map) { |
| 512 | const base::FilePath lsb_release(kLsbReleasePath); |
| 513 | brillo::KeyValueStore store; |
| 514 | if (!store.Load(lsb_release)) { |
| 515 | // /etc/lsb-release might not be present (cros deploying a new |
| 516 | // configuration or no fields set at all). Just print a debug |
| 517 | // message and continue. |
| 518 | DLOG(INFO) << "Could not load fields from " << lsb_release.value(); |
| 519 | } else { |
| 520 | for (const auto& key : store.GetKeys()) { |
Nikolai Artemiev | 9a7c3a5 | 2021-03-09 12:31:25 +1100 | [diff] [blame] | 521 | // The DEVICETYPE from /etc/lsb-release may not be correct on some |
| 522 | // unibuild devices, so filter it out. The correct DEVICETYPE is |
| 523 | // logged separately using an entry in kCommandLogs that invokes |
| 524 | // `cros_config /hardware-properties form-factor` |
| 525 | if (key != "DEVICETYPE") { |
| 526 | std::string value; |
| 527 | store.GetString(key, &value); |
| 528 | (*map)[key] = value; |
| 529 | } |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 530 | } |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | void GetOsReleaseInfo(LogTool::LogMap* map) { |
| 535 | brillo::OsReleaseReader reader; |
| 536 | reader.Load(); |
| 537 | for (const auto& key : reader.GetKeys()) { |
| 538 | std::string value; |
| 539 | reader.GetString(key, &value); |
| 540 | (*map)["os-release " + key] = value; |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | void PopulateDictionaryValue(const LogTool::LogMap& map, |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 545 | base::Value* dictionary) { |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 546 | for (const auto& kv : map) { |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 547 | dictionary->SetStringKey(kv.first, kv.second); |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 548 | } |
| 549 | } |
| 550 | |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 551 | bool CompressXzBuffer(const std::vector<uint8_t>& in_buffer, |
| 552 | std::vector<uint8_t>* out_buffer) { |
| 553 | size_t out_size = lzma_stream_buffer_bound(in_buffer.size()); |
| 554 | out_buffer->resize(out_size); |
| 555 | size_t out_pos = 0; |
| 556 | |
| 557 | lzma_ret ret = lzma_easy_buffer_encode( |
| 558 | LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64, nullptr, in_buffer.data(), |
| 559 | in_buffer.size(), out_buffer->data(), &out_pos, out_size); |
| 560 | |
| 561 | if (ret != LZMA_OK) { |
| 562 | out_buffer->clear(); |
| 563 | return false; |
| 564 | } |
| 565 | |
| 566 | out_buffer->resize(out_pos); |
| 567 | return true; |
| 568 | } |
| 569 | |
| 570 | void GetPerfData(LogTool::LogMap* map) { |
| 571 | // Run perf to collect system-wide performance profile when user triggers |
| 572 | // feedback report. Perf runs at sampling frequency of ~500 hz (499 is used |
| 573 | // to avoid sampling periodic system activities), with callstack in each |
| 574 | // sample (-g). |
| 575 | std::vector<std::string> perf_args = { |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 576 | "perf", "record", "-a", "-g", "-F", "499", |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 577 | }; |
| 578 | std::vector<uint8_t> perf_data; |
| 579 | int32_t status; |
| 580 | |
| 581 | debugd::PerfTool perf_tool; |
| 582 | if (!perf_tool.GetPerfOutput(kPerfDurationSecs, perf_args, &perf_data, |
| 583 | nullptr, &status, nullptr)) |
| 584 | return; |
| 585 | |
| 586 | // XZ compress the profile data. |
| 587 | std::vector<uint8_t> perf_data_xz; |
| 588 | if (!CompressXzBuffer(perf_data, &perf_data_xz)) |
| 589 | return; |
| 590 | |
| 591 | // Base64 encode the compressed data. |
| 592 | std::string perf_data_str(reinterpret_cast<const char*>(perf_data_xz.data()), |
| 593 | perf_data_xz.size()); |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 594 | (*map)["perf-data"] = std::string(kPerfDataDescription) + |
| 595 | LogTool::EncodeString(std::move(perf_data_str), |
| 596 | LogTool::Encoding::kBase64); |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 597 | } |
| 598 | |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 599 | } // namespace |
| 600 | |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 601 | Log::Log(Log::LogType type, |
| 602 | std::string name, |
| 603 | std::string data, |
| 604 | std::string user, |
| 605 | std::string group, |
| 606 | int64_t max_bytes, |
Brian Norris | afc9f63 | 2019-05-09 14:08:28 -0700 | [diff] [blame] | 607 | LogTool::Encoding encoding, |
| 608 | bool access_root_mount_ns) |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 609 | : type_(type), |
| 610 | name_(name), |
| 611 | data_(data), |
| 612 | user_(user), |
| 613 | group_(group), |
| 614 | max_bytes_(max_bytes), |
Brian Norris | afc9f63 | 2019-05-09 14:08:28 -0700 | [diff] [blame] | 615 | encoding_(encoding), |
| 616 | access_root_mount_ns_(access_root_mount_ns) {} |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 617 | |
| 618 | std::string Log::GetName() const { |
| 619 | return name_; |
| 620 | } |
| 621 | |
| 622 | std::string Log::GetLogData() const { |
| 623 | // The reason this code uses a switch statement on a type enum rather than |
| 624 | // using inheritance/virtual dispatch is so that all of the Log objects can |
| 625 | // be constructed statically. Switching to heap allocated subclasses of Log |
| 626 | // makes the code that declares all of the log entries much more verbose |
| 627 | // and harder to understand. |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 628 | std::string output; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 629 | switch (type_) { |
| 630 | case kCommand: |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 631 | output = GetCommandLogData(); |
| 632 | break; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 633 | case kFile: |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 634 | output = GetFileLogData(); |
| 635 | break; |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 636 | case kGlob: |
| 637 | output = GetGlobLogData(); |
| 638 | break; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 639 | default: |
Mike Frysinger | df3be7f | 2020-12-16 03:17:42 -0500 | [diff] [blame] | 640 | DCHECK(false) << "unknown log type"; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 641 | return "<unknown log type>"; |
| 642 | } |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 643 | |
| 644 | if (output.empty()) |
| 645 | return "<empty>"; |
| 646 | |
| 647 | return LogTool::EncodeString(std::move(output), encoding_); |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 648 | } |
| 649 | |
| 650 | // TODO(ellyjones): sandbox. crosbug.com/35122 |
| 651 | std::string Log::GetCommandLogData() const { |
Mike Frysinger | df3be7f | 2020-12-16 03:17:42 -0500 | [diff] [blame] | 652 | DCHECK_EQ(type_, kCommand); |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 653 | if (type_ != kCommand) |
| 654 | return "<log type mismatch>"; |
| 655 | std::string tailed_cmdline = |
| 656 | base::StringPrintf("%s | tail -c %" PRId64, data_.c_str(), max_bytes_); |
| 657 | ProcessWithOutput p; |
| 658 | if (minijail_disabled_for_test_) |
| 659 | p.set_use_minijail(false); |
| 660 | if (!user_.empty() && !group_.empty()) |
| 661 | p.SandboxAs(user_, group_); |
Brian Norris | afc9f63 | 2019-05-09 14:08:28 -0700 | [diff] [blame] | 662 | if (access_root_mount_ns_) |
| 663 | p.AllowAccessRootMountNamespace(); |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 664 | if (!p.Init()) |
| 665 | return "<not available>"; |
| 666 | p.AddArg(kShell); |
| 667 | p.AddStringOption("-c", tailed_cmdline); |
| 668 | if (p.Run()) |
| 669 | return "<not available>"; |
| 670 | std::string output; |
| 671 | p.GetOutput(&output); |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 672 | return output; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 673 | } |
| 674 | |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 675 | // static |
| 676 | std::string Log::GetFileData(const base::FilePath& path, |
| 677 | int64_t max_bytes, |
| 678 | const std::string& user, |
| 679 | const std::string& group) { |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 680 | uid_t old_euid = geteuid(); |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 681 | uid_t new_euid = UidForUser(user); |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 682 | gid_t old_egid = getegid(); |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 683 | gid_t new_egid = GidForGroup(group); |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 684 | |
| 685 | if (new_euid == -1 || new_egid == -1) { |
| 686 | return "<not available>"; |
| 687 | } |
| 688 | |
| 689 | // Make sure to set group first, since if we set user first we lose root |
| 690 | // and therefore the ability to set our effective gid to arbitrary gids. |
| 691 | if (setegid(new_egid)) { |
| 692 | PLOG(ERROR) << "Failed to set effective group id to " << new_egid; |
| 693 | return "<not available>"; |
| 694 | } |
| 695 | if (seteuid(new_euid)) { |
| 696 | PLOG(ERROR) << "Failed to set effective user id to " << new_euid; |
| 697 | if (setegid(old_egid)) |
| 698 | PLOG(ERROR) << "Failed to restore effective group id to " << old_egid; |
| 699 | return "<not available>"; |
| 700 | } |
| 701 | |
| 702 | std::string contents; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 703 | // Handle special files that don't properly report length/allow lseek. |
| 704 | if (base::FilePath("/dev").IsParent(path) || |
| 705 | base::FilePath("/proc").IsParent(path) || |
| 706 | base::FilePath("/sys").IsParent(path)) { |
| 707 | if (!base::ReadFileToString(path, &contents)) |
| 708 | contents = "<not available>"; |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 709 | if (contents.size() > max_bytes) |
| 710 | contents.erase(0, contents.size() - max_bytes); |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 711 | } else { |
| 712 | base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 713 | if (!file.IsValid()) { |
| 714 | contents = "<not available>"; |
| 715 | } else { |
| 716 | int64_t length = file.GetLength(); |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 717 | if (length > max_bytes) { |
| 718 | file.Seek(base::File::FROM_END, -max_bytes); |
| 719 | length = max_bytes; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 720 | } |
| 721 | std::vector<char> buf(length); |
| 722 | int read = file.ReadAtCurrentPos(buf.data(), buf.size()); |
| 723 | if (read < 0) { |
| 724 | PLOG(ERROR) << "Could not read from file " << path.value(); |
| 725 | } else { |
| 726 | contents = std::string(buf.begin(), buf.begin() + read); |
| 727 | } |
| 728 | } |
| 729 | } |
| 730 | |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 731 | // Make sure we restore our old euid/egid before returning. |
| 732 | if (seteuid(old_euid)) |
| 733 | PLOG(ERROR) << "Failed to restore effective user id to " << old_euid; |
| 734 | |
| 735 | if (setegid(old_egid)) |
| 736 | PLOG(ERROR) << "Failed to restore effective group id to " << old_egid; |
| 737 | |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 738 | return contents; |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 739 | } |
| 740 | |
Mike Frysinger | 020c240 | 2020-12-16 05:40:53 -0500 | [diff] [blame] | 741 | std::string Log::GetFileLogData() const { |
| 742 | DCHECK_EQ(type_, kFile); |
| 743 | if (type_ != kFile) |
| 744 | return "<log type mismatch>"; |
| 745 | |
| 746 | return GetFileData(base::FilePath(data_), max_bytes_, user_, group_); |
| 747 | } |
| 748 | |
| 749 | std::string Log::GetGlobLogData() const { |
| 750 | DCHECK_EQ(type_, kGlob); |
| 751 | if (type_ != kGlob) |
| 752 | return "<log type mismatch>"; |
| 753 | |
| 754 | // NB: base::FileEnumerator requires a directory to walk, and a pattern to |
| 755 | // match against each result. Here we accept full paths with globs in them. |
| 756 | glob_t g; |
| 757 | // NB: Feel free to add GLOB_BRACE if a user comes up. |
| 758 | int gret = glob(data_.c_str(), 0, nullptr, &g); |
| 759 | if (gret == GLOB_NOMATCH) { |
| 760 | globfree(&g); |
| 761 | return "<no matches>"; |
| 762 | } else if (gret) { |
| 763 | globfree(&g); |
| 764 | PLOG(ERROR) << "glob " << data_ << " failed"; |
| 765 | return "<not available>"; |
| 766 | } |
| 767 | |
| 768 | // The results array will hold 2 entries per file: the filename, and the |
| 769 | // results of reading that file. |
| 770 | size_t output_size = 0; |
| 771 | std::vector<std::string> results; |
| 772 | results.reserve(g.gl_pathc * 2); |
| 773 | |
| 774 | for (size_t pathc = 0; pathc < g.gl_pathc; ++pathc) { |
| 775 | const base::FilePath path(g.gl_pathv[pathc]); |
| 776 | std::string contents = GetFileData(path, max_bytes_, user_, group_); |
| 777 | // NB: The 3 represents the bytes we add in the output string below. |
| 778 | output_size += path.value().size() + contents.size() + 3; |
| 779 | results.push_back(path.value()); |
| 780 | results.push_back(contents); |
| 781 | } |
| 782 | globfree(&g); |
| 783 | |
| 784 | // Combine the results into a single string. We have a header with the |
| 785 | // filename followed by that file's contents. Very basic format. |
| 786 | std::string output; |
| 787 | output.reserve(output_size); |
| 788 | for (auto iter = results.begin(); iter != results.end(); ++iter) { |
| 789 | output += *iter + ":\n"; |
| 790 | ++iter; |
| 791 | output += *iter + "\n"; |
| 792 | } |
| 793 | |
| 794 | return output; |
| 795 | } |
| 796 | |
Fletcher Woodruff | 07c2853 | 2019-01-24 11:08:53 -0700 | [diff] [blame] | 797 | void Log::DisableMinijailForTest() { |
| 798 | minijail_disabled_for_test_ = true; |
| 799 | } |
| 800 | |
| 801 | // static |
| 802 | uid_t Log::UidForUser(const std::string& user) { |
| 803 | struct passwd entry; |
| 804 | struct passwd* result; |
| 805 | std::vector<char> buf(1024); |
| 806 | getpwnam_r(user.c_str(), &entry, &buf[0], buf.size(), &result); |
| 807 | if (!result) { |
| 808 | LOG(ERROR) << "User not found: " << user; |
| 809 | return -1; |
| 810 | } |
| 811 | return entry.pw_uid; |
| 812 | } |
| 813 | |
| 814 | // static |
| 815 | gid_t Log::GidForGroup(const std::string& group) { |
| 816 | struct group entry; |
| 817 | struct group* result; |
| 818 | std::vector<char> buf(1024); |
| 819 | getgrnam_r(group.c_str(), &entry, &buf[0], buf.size(), &result); |
| 820 | if (!result) { |
| 821 | LOG(ERROR) << "Group not found: " << group; |
| 822 | return -1; |
| 823 | } |
| 824 | return entry.gr_gid; |
| 825 | } |
| 826 | |
mhasank | af5251d | 2020-04-29 18:53:03 -0700 | [diff] [blame] | 827 | LogTool::LogTool( |
| 828 | scoped_refptr<dbus::Bus> bus, |
| 829 | std::unique_ptr<org::chromium::CryptohomeInterfaceProxyInterface> |
| 830 | cryptohome_proxy, |
| 831 | std::unique_ptr<LogTool::Log> arc_bug_report_log, |
| 832 | const base::FilePath& daemon_store_base_dir) |
| 833 | : bus_(bus), |
| 834 | cryptohome_proxy_(std::move(cryptohome_proxy)), |
| 835 | arc_bug_report_log_(std::move(arc_bug_report_log)), |
| 836 | daemon_store_base_dir_(daemon_store_base_dir) {} |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 837 | |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 838 | LogTool::LogTool(scoped_refptr<dbus::Bus> bus) |
mhasank | af5251d | 2020-04-29 18:53:03 -0700 | [diff] [blame] | 839 | : LogTool(bus, |
| 840 | std::make_unique<org::chromium::CryptohomeInterfaceProxy>(bus), |
| 841 | std::make_unique<ArcBugReportLog>(), |
| 842 | base::FilePath(kDaemonStoreBaseDir)) {} |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 843 | |
mhasank | 7186aae | 2020-09-16 20:06:00 -0700 | [diff] [blame] | 844 | bool LogTool::IsUserHashValid(const std::string& userhash) { |
| 845 | return brillo::cryptohome::home::IsSanitizedUserName(userhash) && |
| 846 | base::PathExists(daemon_store_base_dir_.Append(userhash)); |
| 847 | } |
| 848 | |
Fletcher Woodruff | 70f2723 | 2019-01-24 11:41:34 -0700 | [diff] [blame] | 849 | void LogTool::CreateConnectivityReport(bool wait_for_results) { |
Rebecca Silberstein | e78af40 | 2014-10-02 10:55:04 -0700 | [diff] [blame] | 850 | // Perform ConnectivityTrial to report connection state in feedback log. |
Ben Chan | 8e9f6d0 | 2017-09-26 23:04:21 -0700 | [diff] [blame] | 851 | auto shill = std::make_unique<org::chromium::flimflam::ManagerProxy>(bus_); |
Rebecca Silberstein | e78af40 | 2014-10-02 10:55:04 -0700 | [diff] [blame] | 852 | // Give the connection trial time to test the connection and log the results |
| 853 | // before collecting the logs for feedback. |
| 854 | // TODO(silberst): Replace the simple approach of a single timeout with a more |
| 855 | // coordinated effort. |
Fletcher Woodruff | 70f2723 | 2019-01-24 11:41:34 -0700 | [diff] [blame] | 856 | if (shill && shill->CreateConnectivityReport(nullptr) && wait_for_results) |
Eric Caruso | cc7106c | 2017-04-27 14:22:42 -0700 | [diff] [blame] | 857 | sleep(kConnectionTesterTimeoutSeconds); |
Rebecca Silberstein | e78af40 | 2014-10-02 10:55:04 -0700 | [diff] [blame] | 858 | } |
| 859 | |
Eric Caruso | c93a15c | 2017-04-24 16:15:12 -0700 | [diff] [blame] | 860 | string LogTool::GetLog(const string& name) { |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 861 | string result; |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 862 | GetNamedLogFrom(name, kCommandLogs, &result) || |
Arowa Suliman | 3bc729c | 2021-03-09 13:25:00 -0800 | [diff] [blame] | 863 | GetNamedLogFrom(name, kCommandLogsShort, &result) || |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 864 | GetNamedLogFrom(name, kExtraLogs, &result) || |
| 865 | GetNamedLogFrom(name, kFeedbackLogs, &result); |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 866 | return result; |
| 867 | } |
| 868 | |
Eric Caruso | f9091f8 | 2017-04-28 14:18:59 -0700 | [diff] [blame] | 869 | LogTool::LogMap LogTool::GetAllLogs() { |
Fletcher Woodruff | 70f2723 | 2019-01-24 11:41:34 -0700 | [diff] [blame] | 870 | CreateConnectivityReport(false); |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 871 | LogMap result; |
Arowa Suliman | 3bc729c | 2021-03-09 13:25:00 -0800 | [diff] [blame] | 872 | GetLogsFrom(kCommandLogsShort, &result); |
Ben Chan | cf7d641 | 2017-08-10 22:30:09 -0700 | [diff] [blame] | 873 | GetLogsFrom(kCommandLogs, &result); |
| 874 | GetLogsFrom(kExtraLogs, &result); |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 875 | GetLsbReleaseInfo(&result); |
| 876 | GetOsReleaseInfo(&result); |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 877 | return result; |
| 878 | } |
| 879 | |
Brian Norris | ca4fc04 | 2018-04-03 00:24:26 -0700 | [diff] [blame] | 880 | LogTool::LogMap LogTool::GetAllDebugLogs() { |
Fletcher Woodruff | 70f2723 | 2019-01-24 11:41:34 -0700 | [diff] [blame] | 881 | CreateConnectivityReport(true); |
Brian Norris | ca4fc04 | 2018-04-03 00:24:26 -0700 | [diff] [blame] | 882 | LogMap result; |
Arowa Suliman | 3bc729c | 2021-03-09 13:25:00 -0800 | [diff] [blame] | 883 | GetLogsFrom(kCommandLogsShort, &result); |
Brian Norris | ca4fc04 | 2018-04-03 00:24:26 -0700 | [diff] [blame] | 884 | GetLogsFrom(kCommandLogs, &result); |
| 885 | GetLogsFrom(kExtraLogs, &result); |
mhasank | d2b8488 | 2020-05-04 17:02:19 -0700 | [diff] [blame] | 886 | result[arc_bug_report_log_->GetName()] = GetArcBugReport("", nullptr); |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 887 | GetLsbReleaseInfo(&result); |
| 888 | GetOsReleaseInfo(&result); |
Brian Norris | ca4fc04 | 2018-04-03 00:24:26 -0700 | [diff] [blame] | 889 | return result; |
| 890 | } |
| 891 | |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 892 | void LogTool::GetBigFeedbackLogs(const base::ScopedFD& fd, |
| 893 | const std::string& username) { |
Fletcher Woodruff | 70f2723 | 2019-01-24 11:41:34 -0700 | [diff] [blame] | 894 | CreateConnectivityReport(true); |
Chinglin Yu | aeb4ec7 | 2018-12-10 18:53:30 +0800 | [diff] [blame] | 895 | LogMap map; |
| 896 | GetPerfData(&map); |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 897 | base::Value dictionary(base::Value::Type::DICTIONARY); |
Arowa Suliman | 3bc729c | 2021-03-09 13:25:00 -0800 | [diff] [blame] | 898 | GetLogsInDictionary(kCommandLogsVerbose, &dictionary); |
Jeffrey Kardatzke | e3ec6fd | 2019-08-05 12:25:17 -0700 | [diff] [blame] | 899 | GetLogsInDictionary(kCommandLogs, &dictionary); |
| 900 | GetLogsInDictionary(kFeedbackLogs, &dictionary); |
mhasank | d2b8488 | 2020-05-04 17:02:19 -0700 | [diff] [blame] | 901 | bool is_backup; |
| 902 | std::string arc_bug_report = GetArcBugReport(username, &is_backup); |
hscham | 2311cc2 | 2020-10-28 12:13:10 +0900 | [diff] [blame] | 903 | dictionary.SetStringKey(kArcBugReportBackupKey, |
| 904 | (is_backup ? "true" : "false")); |
| 905 | dictionary.SetStringKey(arc_bug_report_log_->GetName(), arc_bug_report); |
Kartik Hegde | 1c4b97b | 2018-09-09 19:09:34 -0600 | [diff] [blame] | 906 | GetLsbReleaseInfo(&map); |
| 907 | GetOsReleaseInfo(&map); |
| 908 | PopulateDictionaryValue(map, &dictionary); |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 909 | SerializeLogsAsJSON(dictionary, fd); |
| 910 | } |
| 911 | |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 912 | std::string GetSanitizedUsername( |
| 913 | org::chromium::CryptohomeInterfaceProxyInterface* cryptohome_proxy, |
mhasank | af5251d | 2020-04-29 18:53:03 -0700 | [diff] [blame] | 914 | const std::string& username) { |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 915 | if (username.empty()) { |
| 916 | return std::string(); |
| 917 | } |
| 918 | |
| 919 | std::string sanitized_username; |
| 920 | brillo::ErrorPtr error; |
| 921 | if (!cryptohome_proxy->GetSanitizedUsername(username, &sanitized_username, |
| 922 | &error)) { |
| 923 | LOG(ERROR) << "Failed to call GetSanitizedUsername, error: " |
| 924 | << error->GetMessage(); |
| 925 | return std::string(); |
| 926 | } |
| 927 | |
| 928 | return sanitized_username; |
| 929 | } |
| 930 | |
mhasank | d2b8488 | 2020-05-04 17:02:19 -0700 | [diff] [blame] | 931 | std::string LogTool::GetArcBugReport(const std::string& username, |
| 932 | bool* is_backup) { |
| 933 | if (is_backup) { |
| 934 | *is_backup = true; |
| 935 | } |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 936 | std::string userhash = |
| 937 | GetSanitizedUsername(cryptohome_proxy_.get(), username); |
| 938 | |
| 939 | std::string contents; |
| 940 | if (userhash.empty() || |
| 941 | arc_bug_report_backups_.find(userhash) == arc_bug_report_backups_.end() || |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 942 | !base::ReadFileToString(daemon_store_base_dir_.Append(userhash).Append( |
| 943 | kArcBugReportBackupFileName), |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 944 | &contents)) { |
| 945 | // If |userhash| was not empty, but was not found in the backup set |
| 946 | // or the file did not exist, attempt to delete the file. |
| 947 | if (!userhash.empty()) { |
mhasank | 40a8048 | 2020-09-09 17:44:24 -0700 | [diff] [blame] | 948 | DeleteArcBugReportBackup(username); |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 949 | } |
mhasank | d2b8488 | 2020-05-04 17:02:19 -0700 | [diff] [blame] | 950 | if (is_backup) { |
| 951 | *is_backup = false; |
| 952 | } |
mhasank | af5251d | 2020-04-29 18:53:03 -0700 | [diff] [blame] | 953 | contents = arc_bug_report_log_->GetLogData(); |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | return contents; |
| 957 | } |
| 958 | |
mhasank | 7186aae | 2020-09-16 20:06:00 -0700 | [diff] [blame] | 959 | void LogTool::BackupArcBugReport(const std::string& username) { |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 960 | DLOG(INFO) << "Backing up ARC bug report"; |
| 961 | |
mhasank | 40a8048 | 2020-09-09 17:44:24 -0700 | [diff] [blame] | 962 | const std::string userhash = |
mhasank | 7186aae | 2020-09-16 20:06:00 -0700 | [diff] [blame] | 963 | GetSanitizedUsername(cryptohome_proxy_.get(), username); |
| 964 | if (!IsUserHashValid(userhash)) { |
| 965 | LOG(ERROR) << "Invalid userhash '" << userhash << "'"; |
| 966 | return; |
| 967 | } |
mhasank | 40a8048 | 2020-09-09 17:44:24 -0700 | [diff] [blame] | 968 | |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 969 | brillo::SafeFD backupDir( |
| 970 | brillo::SafeFD::Root() |
| 971 | .first.OpenExistingDir(daemon_store_base_dir_.Append(userhash)) |
| 972 | .first); |
| 973 | if (!backupDir.is_valid()) { |
| 974 | LOG(ERROR) << "Failed to open ARC bug report backup dir at " |
| 975 | << daemon_store_base_dir_.Append(userhash).value(); |
| 976 | return; |
| 977 | } |
| 978 | |
| 979 | brillo::SafeFD backupFile( |
| 980 | brillo::OpenOrRemakeFile(&backupDir, kArcBugReportBackupFileName).first); |
| 981 | if (!backupFile.is_valid()) { |
| 982 | LOG(ERROR) << "Failed to open ARC bug report file at " |
| 983 | << daemon_store_base_dir_.Append(userhash) |
| 984 | .Append(kArcBugReportBackupFileName) |
| 985 | .value(); |
| 986 | return; |
| 987 | } |
| 988 | |
mhasank | af5251d | 2020-04-29 18:53:03 -0700 | [diff] [blame] | 989 | const std::string logData = arc_bug_report_log_->GetLogData(); |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 990 | |
| 991 | if (backupFile.Write(logData.c_str(), logData.length()) == |
| 992 | brillo::SafeFD::Error::kNoError) { |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 993 | arc_bug_report_backups_.insert(userhash); |
| 994 | } else { |
mhasank | 7186aae | 2020-09-16 20:06:00 -0700 | [diff] [blame] | 995 | PLOG(ERROR) << "Failed to back up ARC bug report"; |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 996 | } |
| 997 | } |
| 998 | |
mhasank | 7186aae | 2020-09-16 20:06:00 -0700 | [diff] [blame] | 999 | void LogTool::DeleteArcBugReportBackup(const std::string& username) { |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 1000 | DLOG(INFO) << "Deleting the ARC bug report backup"; |
| 1001 | |
mhasank | 40a8048 | 2020-09-09 17:44:24 -0700 | [diff] [blame] | 1002 | const std::string userhash = |
mhasank | 7186aae | 2020-09-16 20:06:00 -0700 | [diff] [blame] | 1003 | GetSanitizedUsername(cryptohome_proxy_.get(), username); |
| 1004 | if (!IsUserHashValid(userhash)) { |
| 1005 | LOG(ERROR) << "Invalid userhash '" << userhash << "'"; |
| 1006 | return; |
| 1007 | } |
mhasank | 40a8048 | 2020-09-09 17:44:24 -0700 | [diff] [blame] | 1008 | |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 1009 | brillo::SafeFD backupDir( |
| 1010 | brillo::SafeFD::Root() |
| 1011 | .first.OpenExistingDir(daemon_store_base_dir_.Append(userhash)) |
| 1012 | .first); |
| 1013 | if (!backupDir.is_valid()) { |
| 1014 | LOG(ERROR) << "Failed to open ARC bug report backup dir at " |
| 1015 | << daemon_store_base_dir_.Append(userhash).value(); |
| 1016 | return; |
| 1017 | } |
| 1018 | |
mhasank | 4f599d3 | 2020-04-09 22:07:35 -0700 | [diff] [blame] | 1019 | arc_bug_report_backups_.erase(userhash); |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 1020 | |
Muhammad Hasan Khan | ea17283 | 2021-04-01 13:39:30 -0700 | [diff] [blame] | 1021 | if (base::PathExists(daemon_store_base_dir_.Append(userhash).Append( |
| 1022 | kArcBugReportBackupFileName)) && |
| 1023 | backupDir.Unlink(kArcBugReportBackupFileName) != |
| 1024 | brillo::SafeFD::Error::kNoError) { |
Ereth McKnight-MacNeil | ca3fff2 | 2021-01-21 23:31:40 -0800 | [diff] [blame] | 1025 | PLOG(ERROR) << "Failed to delete ARC bug report backup at " |
| 1026 | << daemon_store_base_dir_.Append(userhash) |
| 1027 | .Append(kArcBugReportBackupFileName) |
| 1028 | .value(); |
mhasank | 80cbe4d | 2020-04-02 22:46:08 -0700 | [diff] [blame] | 1029 | } |
| 1030 | } |
| 1031 | |
Jeffrey Kardatzke | e3ec6fd | 2019-08-05 12:25:17 -0700 | [diff] [blame] | 1032 | void LogTool::GetJournalLog(const base::ScopedFD& fd) { |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 1033 | Log journal(kCommand, "journal.export", "journalctl -n 10000 -o export", |
| 1034 | "syslog", "syslog", 10 * 1024 * 1024, LogTool::Encoding::kBinary); |
Jeffrey Kardatzke | e3ec6fd | 2019-08-05 12:25:17 -0700 | [diff] [blame] | 1035 | std::string output = journal.GetLogData(); |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 1036 | base::WriteFileDescriptor(fd.get(), output.data(), output.size()); |
| 1037 | } |
| 1038 | |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 1039 | // static |
Tom Hughes | d6c2d39 | 2020-08-24 18:12:11 -0700 | [diff] [blame] | 1040 | string LogTool::EncodeString(string value, LogTool::Encoding source_encoding) { |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 1041 | if (source_encoding == LogTool::Encoding::kBinary) |
| 1042 | return value; |
| 1043 | |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 1044 | if (source_encoding == LogTool::Encoding::kAutodetect) { |
| 1045 | if (base::IsStringUTF8(value)) |
| 1046 | return value; |
Chris Morin | 790fd26 | 2019-04-03 20:29:36 -0700 | [diff] [blame] | 1047 | source_encoding = LogTool::Encoding::kBase64; |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 1048 | } |
| 1049 | |
| 1050 | if (source_encoding == LogTool::Encoding::kUtf8) { |
| 1051 | string output; |
| 1052 | const char* src = value.data(); |
| 1053 | int32_t src_len = static_cast<int32_t>(value.length()); |
| 1054 | |
| 1055 | output.reserve(value.size()); |
| 1056 | for (int32_t char_index = 0; char_index < src_len; char_index++) { |
| 1057 | uint32_t code_point; |
| 1058 | if (!base::ReadUnicodeCharacter(src, src_len, &char_index, &code_point) || |
| 1059 | !base::IsValidCharacter(code_point)) { |
| 1060 | // Replace invalid characters with U+FFFD REPLACEMENT CHARACTER. |
| 1061 | code_point = 0xFFFD; |
| 1062 | } |
| 1063 | base::WriteUnicodeCharacter(code_point, &output); |
| 1064 | } |
| 1065 | return output; |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 1066 | } |
Chris Morin | 853d344 | 2019-04-01 21:35:13 -0700 | [diff] [blame] | 1067 | |
| 1068 | base::Base64Encode(value, &value); |
| 1069 | return "<base64>: " + value; |
Luis Hector Chavez | fc2566f | 2018-09-13 15:00:36 -0700 | [diff] [blame] | 1070 | } |
| 1071 | |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame] | 1072 | } // namespace debugd |