debugd: add 2 new dbus messages to get RW FW version and board ID from an image
Those new messages will be used in cr50-verify-ro.sh in a future CL.
Add 2 util functions to process gsctool output.
Add one more argument to ProcessWithOutput::RunProcess to allow disabling
sandbox. This is needed for VerifyRoTool to access suzy-q on behalf of chronos.
I will replace the argument with 2 args, user and group, after we create a new
user and group to access suzy-q.
BUG=b:113893821
TEST=manually ran the following commands on a soraka device.
$ dbus-send --system --print-reply --fixed --dest=org.chromium.debugd \
org.chromium.degbud.GetGscImageRWFirmwareVer string:cr50.bin.prod
IMAGE_RW_FW_VER=0.3.10
$ dbus-send --system --print-reply --fixed --dest=org.chromium.debugd \
org.chromium.degbud.GetGscImageBoardID string:cr50.bin.prod
IMAGE_BID_STRING=00000000
IMAGE_BID_MASK=00000000
IMAGE_BID_FLAGS=00000000
CQ-DEPEND=CL:1278414
Change-Id: Ibaa3d756962c62df6594295b02496e95bb21cde3
Reviewed-on: https://chromium-review.googlesource.com/1278697
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Wei-Cheng Xiao <garryxiao@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
diff --git a/debugd/src/process_with_output.cc b/debugd/src/process_with_output.cc
index c28137f..4ec0dad 100644
--- a/debugd/src/process_with_output.cc
+++ b/debugd/src/process_with_output.cc
@@ -95,12 +95,15 @@
int ProcessWithOutput::RunProcess(const std::string& command,
const ArgList& arguments,
bool requires_root,
+ bool disable_sandbox,
const std::string* stdin,
std::string* stdout,
std::string* stderr,
brillo::ErrorPtr* error) {
ProcessWithOutput process;
- if (requires_root) {
+ if (disable_sandbox) {
+ process.DisableSandbox();
+ } else if (requires_root) {
process.SandboxAs("root", "root");
}
return DoRunProcess(
@@ -119,8 +122,8 @@
DEBUGD_ADD_ERROR(error, kDBusErrorString, kPathLengthErrorString);
return kRunError;
}
- return RunProcess(
- helper_path, arguments, requires_root, stdin, stdout, stderr, error);
+ return RunProcess(helper_path, arguments, requires_root,
+ false /* disable_sandbox */, stdin, stdout, stderr, error);
}
int ProcessWithOutput::RunProcessFromHelper(const std::string& command,