From 36e4fa72efc2fa71ab28e3c3d00c5790ef8d9c50 Mon Sep 17 00:00:00 2001 From: jiangyuwei Date: Thu, 16 May 2024 09:56:08 +0800 Subject: [PATCH] [M120 Migration][VD] Add waiting for RW image mount When UWE is used but RW image was not mounted yet, Engine could wrongly dlopen RO package. This patch adds additional waiting for RW mount to prevent from opening RO package by mistake. Max waiting time for RW mount: 10s Reference: - https://review.tizen.org/gerrit/301389/ Change-Id: Ie83cde9ac0fe41391ecc6f01887da52d3d431c89 Signed-off-by: jiangyuwei --- .../downloadable/chromium_efl_install.cc | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/tizen_src/downloadable/chromium_efl_install.cc b/tizen_src/downloadable/chromium_efl_install.cc index a1694fc5aaeb..a382e4fbb15a 100644 --- a/tizen_src/downloadable/chromium_efl_install.cc +++ b/tizen_src/downloadable/chromium_efl_install.cc @@ -73,7 +73,10 @@ __attribute__((destructor)) void close_log_file() { #define SUCCESS 0 #define FAIL -1 -const char* kChromiumMountReady = "/tmp/.chromium_mount.ready"; +const char* kChromiumUpdateOrPreloadMountReady = + "/tmp/.chromium_update_or_preload_mount.ready"; +const char* kChromiumUpgradeMountReady = "/tmp/.chromium_upgrade_mount.ready"; +const char* kChromiumUpgradeTPKExists = "/tmp/.chromium_upgrade_tpk.exists"; const char* kColdBootRequester = "chromium-efl"; const char* kLaunchFail = "rtc/memory/WebApp/LaunchFail"; const char* kPSAgentReady = "/run/ps_agent.pid"; @@ -153,12 +156,6 @@ static int mount(bool mount, const char* args, bool use_system = false) { return FAIL; } - if (LwipcEventDone(kChromiumMountReady) < 0) { - // The Lwipc api simply calls the ioctl() inside the function. - // Failure of this API means that there are some kernel issues. - LOG(ERROR) << kChromiumMountReady << " Event Failed."; - } - return SUCCESS; } @@ -166,10 +163,10 @@ static int MountPatchedTPK() { int result = FAIL; if (!access(LIB_RO_ROOT_DIR "/version", F_OK)) { LOG(INFO) << LIB_RO_ROOT_DIR "/version file already exists."; - if (LwipcEventDone(kChromiumMountReady) < 0) { + if (LwipcEventDone(kChromiumUpdateOrPreloadMountReady) < 0) { // The Lwipc api simply calls the ioctl() inside the function. // Failure of this API means that there are some kernel issues. - LOG(ERROR) << kChromiumMountReady << " Event Failed."; + LOG(ERROR) << kChromiumUpdateOrPreloadMountReady << " Event Failed."; } return SUCCESS; } @@ -178,17 +175,43 @@ static int MountPatchedTPK() { LOG(INFO) << PATH_UPDATED_CHROMIUM_EFL_IMG << " exists."; kTargetTPK = "WebEngine Updated TPK "; result = mount(true, MOUNT_ARGS_UPDATED_CHROMIUM); + + if (LwipcEventDone(kChromiumUpdateOrPreloadMountReady) < 0) { + // The Lwipc api simply calls the ioctl() inside the function. + // Failure of this API means that there are some kernel issues. + LOG(ERROR) << kChromiumUpdateOrPreloadMountReady << " Event Failed."; + } } if (result != SUCCESS && !access(PATH_PRELOAD_CHROMIUM_EFL_IMG, F_OK)) { LOG(INFO) << PATH_PRELOAD_CHROMIUM_EFL_IMG << " exists."; kTargetTPK = "WebEngine Preload TPK "; result = mount(true, MOUNT_ARGS_PRELOAD_CHROMIUM); + + if (LwipcEventDone(kChromiumUpdateOrPreloadMountReady) < 0) { + // The Lwipc api simply calls the ioctl() inside the function. + // Failure of this API means that there are some kernel issues. + LOG(ERROR) << kChromiumUpdateOrPreloadMountReady << " Event Failed."; + } } return result; } +static void AlertUpgradeTPK() { + if (!access(PATH_UPGRADE_CHROMIUM_EFL_IMG, F_OK)) { + LOG(INFO) << PATH_UPGRADE_CHROMIUM_EFL_IMG << " exists."; + + if (LwipcEventDone(kChromiumUpgradeTPKExists) < 0) { + // The Lwipc api simply calls the ioctl() inside the function. + // Failure of this API means that there are some kernel issues. + LOG(ERROR) << kChromiumUpgradeTPKExists << " Event Failed."; + } + } else { + LOG(INFO) << "No WebEngine Upgrade TPK found"; + } +} + static void MountUpgradeTPK() { if (!access(LIB_UPGRADE_ROOT_DIR "/version", F_OK)) { RequestColdBoot(); @@ -199,6 +222,11 @@ static void MountUpgradeTPK() { LOG(INFO) << PATH_UPGRADE_CHROMIUM_EFL_IMG << " exists."; kTargetTPK = "WebEngine Upgrade TPK "; mount(true, MOUNT_ARGS_UPGRADE_CHROMIUM); + if (LwipcEventDone(kChromiumUpgradeMountReady) < 0) { + // The Lwipc api simply calls the ioctl() inside the function. + // Failure of this API means that there are some kernel issues. + LOG(ERROR) << kChromiumUpgradeMountReady << " Event Failed."; + } } else { LOG(INFO) << "No WebEngine Upgrade TPK found"; } @@ -241,6 +269,7 @@ int main(int argc, char* argv[]) { } if (option == InstallTpk) { // InstallTpk + AlertUpgradeTPK(); // TV does not install tpk. Built-in installer installs. // To avoid concurrency problem, a lock must be shared with installer. // -- 2.34.1