summaryrefslogtreecommitdiff
path: root/dexopt_chroot_setup
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-05-03 12:19:45 +0100
committer Jiakai Zhang <jiakaiz@google.com> 2024-05-03 16:16:48 +0000
commit51300eb2b71936ec69ab6737a2270b5019b6b888 (patch)
treed4ea6292331508da49d941bb4b082952f5916509 /dexopt_chroot_setup
parent7c26f98bf3d95616d516dd8cdb0ff4ef64e0b219 (diff)
Add process name suffix for Pre-reboot Dexopt chroot.
Example crash logs: 05-01 09:59:58.374 2675 2675 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 05-01 09:59:58.374 2675 2675 F DEBUG : Build fingerprint: 'generic/aosp_cf_x86_64_phone/vsoc_x86_64:VanillaIceCream/MAIN.9d8f75cf/eng.jiakai.20240430.120128:userdebug/test-keys' 05-01 09:59:58.374 2675 2675 F DEBUG : Revision: '0' 05-01 09:59:58.374 2675 2675 F DEBUG : ABI: 'x86' 05-01 09:59:58.374 2675 2675 F DEBUG : Timestamp: 2024-05-01 09:59:58.161156831+0000 05-01 09:59:58.374 2675 2675 F DEBUG : Process uptime: 2s 05-01 09:59:58.374 2675 2675 F DEBUG : Cmdline: /apex/com.android.art/bin/dex2oat32 (Pre-reboot Dexopt chroot) --zip-fd=14 --zip-location=/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk ... 05-01 09:59:58.375 2675 2675 F DEBUG : pid: 2669, tid: 2669, name: dex2oat32 >>> /apex/com.android.art/bin/dex2oat32 (Pre-reboot Dexopt chroot) <<< 05-01 09:59:58.375 2675 2675 F DEBUG : uid: 1082 05-01 09:59:58.375 2675 2675 F DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- 05-01 09:59:58.375 2675 2675 F DEBUG : Abort message: 'test' ... Bug: 311377497 Test: Trigger a crash and see the logs. Change-Id: I84bf82afa1fe272b4a9f68e863447b11ea4d425d
Diffstat (limited to 'dexopt_chroot_setup')
-rw-r--r--dexopt_chroot_setup/dexopt_chroot_setup.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/dexopt_chroot_setup/dexopt_chroot_setup.cc b/dexopt_chroot_setup/dexopt_chroot_setup.cc
index 967cb20c1e..f7d1ea4d37 100644
--- a/dexopt_chroot_setup/dexopt_chroot_setup.cc
+++ b/dexopt_chroot_setup/dexopt_chroot_setup.cc
@@ -97,13 +97,17 @@ Result<void> Run(std::string_view log_name, const std::vector<std::string>& args
return {};
}
-Result<std::string> GetArtExec() {
+Result<CmdlineBuilder> GetArtExecCmdlineBuilder() {
std::string error_msg;
std::string art_root = GetArtRootSafe(&error_msg);
if (!error_msg.empty()) {
return Error() << error_msg;
}
- return art_root + "/bin/art_exec";
+ CmdlineBuilder args;
+ args.Add(art_root + "/bin/art_exec")
+ .Add("--chroot=%s", DexoptChrootSetup::CHROOT_DIR)
+ .Add("--process-name-suffix=Pre-reboot Dexopt chroot");
+ return args;
}
Result<void> CreateDir(const std::string& path) {
@@ -408,19 +412,15 @@ Result<void> DexoptChrootSetup::SetUpChroot(const std::optional<std::string>& ot
PLOG(WARNING) << "Failed to generate empty linker config to suppress warnings";
}
- CmdlineBuilder args;
- args.Add(OR_RETURN(GetArtExec()))
- .Add("--chroot=%s", CHROOT_DIR)
- .Add("--")
+ CmdlineBuilder args = OR_RETURN(GetArtExecCmdlineBuilder());
+ args.Add("--")
.Add("/system/bin/apexd")
.Add("--otachroot-bootstrap")
.AddIf(!IsOtaUpdate(ota_slot), "--also-include-staged-apexes");
OR_RETURN(Run("apexd", args.Get()));
- args = CmdlineBuilder();
- args.Add(OR_RETURN(GetArtExec()))
- .Add("--chroot=%s", CHROOT_DIR)
- .Add("--drop-capabilities")
+ args = OR_RETURN(GetArtExecCmdlineBuilder());
+ args.Add("--drop-capabilities")
.Add("--")
.Add("/apex/com.android.runtime/bin/linkerconfig")
.Add("--target")
@@ -432,10 +432,8 @@ Result<void> DexoptChrootSetup::SetUpChroot(const std::optional<std::string>& ot
Result<void> DexoptChrootSetup::TearDownChroot() const {
if (OS::FileExists(PathInChroot("/system/bin/apexd").c_str())) {
- CmdlineBuilder args;
- args.Add(OR_RETURN(GetArtExec()))
- .Add("--chroot=%s", CHROOT_DIR)
- .Add("--")
+ CmdlineBuilder args = OR_RETURN(GetArtExecCmdlineBuilder());
+ args.Add("--")
.Add("/system/bin/apexd")
.Add("--unmount-all")
.Add("--also-include-staged-apexes");