summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorJ. Richard Barnette <jrbarnette@chromium.org>2011-08-25 11:22:43 -0700
committerGerrit <chrome-bot@google.com>2012-04-17 11:17:19 -0700
commitdbffddce5a4e582265582f3aed7cc0c976ccd3c1 (patch)
tree6c418aff20607b81513db304693a129487fb9820 /host
parentcd10a969260879ac2ecd83ef89c0ab9f3830f28a (diff)
downloadvboot-dbffddce5a4e582265582f3aed7cc0c976ccd3c1.tar.gz
Adjust the behavior of 'crossystem cros_debug' for recovery mode
Previously, 'cros_debug' would ignore the kernel command line if the system was booted in recovery mode. The check provided no particular security benefit; it served only to complicate the work of developers who wanted to boot debug images over USB with dev-key signed firmware. BUG=chromium-os:19236 TEST=Test 'crossystem cros_debug' on a system in the cited use case Change-Id: Ie664c50984411340a10896137022d7d4ff503d0a Reviewed-on: https://gerrit.chromium.org/gerrit/6663 Commit-Ready: Richard Barnette <jrbarnette@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'host')
-rw-r--r--host/lib/crossystem.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 5c2addea..27d45c38 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -123,20 +123,12 @@ int VbGetCrosDebug(void) {
char buf[4096] = "";
char *t, *saveptr;
- /* Try reading firmware type. */
- if (VbGetArchPropertyString("mainfw_type", buf, sizeof(buf))) {
- if (0 == strcmp(buf, "recovery"))
- return 0; /* Recovery mode never allows debug. */
- else if (0 == strcmp(buf, "developer"))
- return 1; /* Developer firmware always allows debug. */
- }
-
- /* Normal new firmware, older ChromeOS firmware, or non-Chrome firmware.
- * For all these cases, check /proc/cmdline for cros_[no]debug. */
- f = fopen(KERNEL_CMDLINE_PATH, "rt");
- if (f) {
+ /* If the currently running system specifies its debug status, use
+ * that in preference to other indicators. */
+ f = fopen(KERNEL_CMDLINE_PATH, "r");
+ if (NULL != f) {
if (NULL == fgets(buf, sizeof(buf), f))
- *buf = 0;
+ buf[0] = 0;
fclose(f);
}
for (t = strtok_r(buf, " ", &saveptr); t; t=strtok_r(NULL, " ", &saveptr)) {
@@ -146,8 +138,7 @@ int VbGetCrosDebug(void) {
return 0;
}
- /* Normal new firmware or older Chrome OS firmware allows debug if the
- * dev switch is on. */
+ /* Command line is silent; allow debug if the dev switch is on. */
if (1 == VbGetSystemPropertyInt("devsw_boot"))
return 1;