From ca78f2ecabe62ef28ab78d145ba71625f2858cf4 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 20 Jun 2023 06:28:34 +0000 Subject: [PATCH 01/16] Release version 0.35.0 Changes: - Remove blocking and unblocking all sub threads - Support Launch Mode Change-Id: I1d1e2f56c1bf288817b98c21770feffcaf4f14d0 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 7fdcd56..cc0f6e1 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.34.1 +Version: 0.35.0 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From d12df20a44399cafd4a375edd2543d8878193dc3 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 20 Jun 2023 22:42:59 +0000 Subject: [PATCH 02/16] Fix a bug related to the onboot timer setting Before setting the onboot timer, the launchpad checks whether the loader context was prepared or not. Unfortunately, the touched flag was not set. This patch add the flag set in the Prepare() method. Change-Id: Id6be61426bb2d3d2a86f350a159900ae41e890a5 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/loader_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/launchpad-process-pool/loader_context.cc b/src/launchpad-process-pool/loader_context.cc index 84fa007..729a7a3 100644 --- a/src/launchpad-process-pool/loader_context.cc +++ b/src/launchpad-process-pool/loader_context.cc @@ -225,6 +225,7 @@ pid_t LoaderContext::Prepare() { SetLiveTimer(); MemoryMonitor::GetInst().Reset(); + touched_ = true; return pid_; } @@ -453,7 +454,6 @@ gboolean LoaderContext::OnBootTimeoutCb(gpointer user_data) { _W("Loader(%d:%s) is starting by the on-boot timer option", context->GetType(), context->GetLoaderName().c_str()); context->Prepare(); - context->touched_ = true; return G_SOURCE_REMOVE; } -- 2.7.4 From adf792842fa94f212ad633e72312ef04708b0a01 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 21 Jun 2023 06:01:50 +0000 Subject: [PATCH 03/16] Release version 0.35.1 Changes: - Fix a bug related to the onboot timer setting Change-Id: Ia658884279b791581148761501a8a03b00dd59c8 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index cc0f6e1..e3356f6 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.35.0 +Version: 0.35.1 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 3266023dac5d65463e9d1e5dc94b2cf93086e04c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 00:50:55 +0000 Subject: [PATCH 04/16] Remove exit() call Even if execv() call is failed, the launchpad-loader must not call the exit(). It can cause the deadlock issue if the library does not consider caling exit handlers immediately. Change-Id: Ieae9da9c9a5162a4dc5da3d78460a8e02c7cdf5d Signed-off-by: Hwankyu Jhun --- src/launchpad-loader/launchpad_loader.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/launchpad-loader/launchpad_loader.cc b/src/launchpad-loader/launchpad_loader.cc index 24981c0..eb660be 100644 --- a/src/launchpad-loader/launchpad_loader.cc +++ b/src/launchpad-loader/launchpad_loader.cc @@ -275,10 +275,9 @@ int LaunchpadLoader::DoExec(int argc, char** argv, const std::string& lib_dir) { char err_buf[1024]; fprintf(stderr, "Failed to execute a file. path: %s, errno: %d(%s)\n", argv[0], errno, strerror_r(errno, err_buf, sizeof(err_buf))); - exit(EXIT_FAILURE); } - return 0; + return -1; } int LaunchpadLoader::OnTerminate(int argc, char** argv) { -- 2.7.4 From 6c22de6fcbb73202fd9e040e641d40d04d708d7b Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 01:55:07 +0000 Subject: [PATCH 05/16] Fix wrong sigchild handler The event listener should be called when getting the sigchld signal. Change-Id: I9dc085b04237c1df3df84f73b1345032c4fe9cc3 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/sigchld_event.cc | 6 +++--- src/lib/launchpad-hydra/signal_manager.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/launchpad-process-pool/sigchld_event.cc b/src/launchpad-process-pool/sigchld_event.cc index b53624b..42aeec4 100644 --- a/src/launchpad-process-pool/sigchld_event.cc +++ b/src/launchpad-process-pool/sigchld_event.cc @@ -56,10 +56,10 @@ void SigchldEvent::OnIOEventReceived(int fd, int condition) { while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) { if (child_pid == child_pgid) killpg(child_pgid, SIGKILL); - - if (listener_ != nullptr) - listener_->OnSigchld(child_pid, status); } + + if (listener_ != nullptr) + listener_->OnSigchld(child_pid, status); } while (ret == 0); } diff --git a/src/lib/launchpad-hydra/signal_manager.cc b/src/lib/launchpad-hydra/signal_manager.cc index 71daa33..1c22c7f 100644 --- a/src/lib/launchpad-hydra/signal_manager.cc +++ b/src/lib/launchpad-hydra/signal_manager.cc @@ -120,10 +120,10 @@ void SignalManager::OnIOEventReceived(int fd, uint32_t revents) { while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) { if (child_pid == child_pgid) killpg(child_pgid, SIGKILL); - - if (listener_ != nullptr) - listener_->OnSigchldReceived(child_pid, status); } + + if (listener_ != nullptr) + listener_->OnSigchldReceived(child_pid, status); } while (ret == 0); } -- 2.7.4 From eb5ac943ae31bb6690c6b6da70e0cec4976749bb Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 02:09:12 +0000 Subject: [PATCH 06/16] Release version 0.35.2 Changes: - Remove exit() call - Fix wrong sigchild handler Change-Id: Ib5ce2d196cd7dbd1065da75f538bd7448963b088 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index e3356f6..a85255c 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.35.1 +Version: 0.35.2 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 62f6437b97d2b229d43bd0cc3d3c14ba6badc499 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 05:41:00 +0000 Subject: [PATCH 07/16] Fix a bug about sigchld handler When calling the OnSigchldReceived() of the EventListener, the pid and the status should be set properly. Change-Id: Icc5b1fd0875dc92c3bf513e0e3afe12d6b6e538a Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/sigchld_event.cc | 2 +- src/lib/launchpad-hydra/signal_manager.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launchpad-process-pool/sigchld_event.cc b/src/launchpad-process-pool/sigchld_event.cc index 42aeec4..69dfd17 100644 --- a/src/launchpad-process-pool/sigchld_event.cc +++ b/src/launchpad-process-pool/sigchld_event.cc @@ -59,7 +59,7 @@ void SigchldEvent::OnIOEventReceived(int fd, int condition) { } if (listener_ != nullptr) - listener_->OnSigchld(child_pid, status); + listener_->OnSigchld(info.ssi_pid, info.ssi_status); } while (ret == 0); } diff --git a/src/lib/launchpad-hydra/signal_manager.cc b/src/lib/launchpad-hydra/signal_manager.cc index 1c22c7f..578d161 100644 --- a/src/lib/launchpad-hydra/signal_manager.cc +++ b/src/lib/launchpad-hydra/signal_manager.cc @@ -123,7 +123,7 @@ void SignalManager::OnIOEventReceived(int fd, uint32_t revents) { } if (listener_ != nullptr) - listener_->OnSigchldReceived(child_pid, status); + listener_->OnSigchldReceived(info.ssi_pid, info.ssi_status); } while (ret == 0); } -- 2.7.4 From 953173eb53cc14d2e321cbce02c0d96a37cef568 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 05:55:21 +0000 Subject: [PATCH 08/16] Release version 0.35.3 Changes: - Fix a bug about sigchld handler Change-Id: Idbb1a2b694d783e0a1133a1b24fb907321bd2552 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index a85255c..0d2c5ec 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.35.2 +Version: 0.35.3 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 9357f6868a748edb0c51a870245b7b92fe1a3258 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 09:27:23 +0000 Subject: [PATCH 09/16] Revert "Fix a bug about sigchld handler" This reverts commit 62f6437b97d2b229d43bd0cc3d3c14ba6badc499. Change-Id: I54b772c7c61c9c0954c85fc189456d68e09c2f4a --- src/launchpad-process-pool/sigchld_event.cc | 2 +- src/lib/launchpad-hydra/signal_manager.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launchpad-process-pool/sigchld_event.cc b/src/launchpad-process-pool/sigchld_event.cc index 69dfd17..42aeec4 100644 --- a/src/launchpad-process-pool/sigchld_event.cc +++ b/src/launchpad-process-pool/sigchld_event.cc @@ -59,7 +59,7 @@ void SigchldEvent::OnIOEventReceived(int fd, int condition) { } if (listener_ != nullptr) - listener_->OnSigchld(info.ssi_pid, info.ssi_status); + listener_->OnSigchld(child_pid, status); } while (ret == 0); } diff --git a/src/lib/launchpad-hydra/signal_manager.cc b/src/lib/launchpad-hydra/signal_manager.cc index 578d161..1c22c7f 100644 --- a/src/lib/launchpad-hydra/signal_manager.cc +++ b/src/lib/launchpad-hydra/signal_manager.cc @@ -123,7 +123,7 @@ void SignalManager::OnIOEventReceived(int fd, uint32_t revents) { } if (listener_ != nullptr) - listener_->OnSigchldReceived(info.ssi_pid, info.ssi_status); + listener_->OnSigchldReceived(child_pid, status); } while (ret == 0); } -- 2.7.4 From bfa9c489093ac41306c8c07aedd01ad5a4f8b3a0 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 22 Jun 2023 09:27:58 +0000 Subject: [PATCH 10/16] Revert "Fix wrong sigchild handler" This reverts commit 6c22de6fcbb73202fd9e040e641d40d04d708d7b. Change-Id: Ib8b095cf2a3ed12bf4bc3f4e28a0456ab23160d1 --- src/launchpad-process-pool/sigchld_event.cc | 6 +++--- src/lib/launchpad-hydra/signal_manager.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/launchpad-process-pool/sigchld_event.cc b/src/launchpad-process-pool/sigchld_event.cc index 42aeec4..b53624b 100644 --- a/src/launchpad-process-pool/sigchld_event.cc +++ b/src/launchpad-process-pool/sigchld_event.cc @@ -56,10 +56,10 @@ void SigchldEvent::OnIOEventReceived(int fd, int condition) { while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) { if (child_pid == child_pgid) killpg(child_pgid, SIGKILL); - } - if (listener_ != nullptr) - listener_->OnSigchld(child_pid, status); + if (listener_ != nullptr) + listener_->OnSigchld(child_pid, status); + } } while (ret == 0); } diff --git a/src/lib/launchpad-hydra/signal_manager.cc b/src/lib/launchpad-hydra/signal_manager.cc index 1c22c7f..71daa33 100644 --- a/src/lib/launchpad-hydra/signal_manager.cc +++ b/src/lib/launchpad-hydra/signal_manager.cc @@ -120,10 +120,10 @@ void SignalManager::OnIOEventReceived(int fd, uint32_t revents) { while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) { if (child_pid == child_pgid) killpg(child_pgid, SIGKILL); - } - if (listener_ != nullptr) - listener_->OnSigchldReceived(child_pid, status); + if (listener_ != nullptr) + listener_->OnSigchldReceived(child_pid, status); + } } while (ret == 0); } -- 2.7.4 From 563653568fd889ea2c12f786a34d18231c53901c Mon Sep 17 00:00:00 2001 From: Mateusz Moscicki Date: Fri, 16 Jun 2023 10:18:29 +0200 Subject: [PATCH 11/16] Add step that forces private connections in libsyscommon This is used to ensure that applications launched by launchpad get their own connection with the appropriate label, rather than using the connection that was established before the label change. Change-Id: I1536904207b2b73a5478c6bde973c0e9296a8f87 --- CMakeLists.txt | 3 ++- packaging/launchpad.spec | 2 ++ src/launchpad-process-pool/CMakeLists.txt | 1 + src/lib/launchpad/step_prepare_execution.cc | 8 ++++++++ src/lib/launchpad/step_prepare_execution.hh | 1 + tests/launchpad-process-pool-unittest/CMakeLists.txt | 1 + 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67bdb59..a8ba71f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ PKG_CHECK_MODULES(DLOG_REDIRECT_STDOUT_DEPS REQUIRED dlog-redirect-stdout) PKG_CHECK_MODULES(ECORE_CORE_DEPS REQUIRED ecore-core) PKG_CHECK_MODULES(ECORE_DEPS REQUIRED ecore) PKG_CHECK_MODULES(ELEMENTARY_DEPS REQUIRED elementary) -PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0) +PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0 gio-unix-2.0) PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock) PKG_CHECK_MODULES(INIPARSER_DEPS REQUIRED iniparser) PKG_CHECK_MODULES(LIBCAP_DEPS REQUIRED libcap) @@ -75,6 +75,7 @@ PKG_CHECK_MODULES(TANCHOR_DEPS REQUIRED tanchor) PKG_CHECK_MODULES(TIZEN_SHARED_QUEUE_DEPS REQUIRED tizen-shared-queue) PKG_CHECK_MODULES(TTRACE_DEPS REQUIRED ttrace) PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf) +PKG_CHECK_MODULES(LIBSYSCOMMON_DEPS REQUIRED libsyscommon) ENABLE_TESTING() ADD_TEST(NAME ${TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST} diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 0d2c5ec..13ff036 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -23,11 +23,13 @@ BuildRequires: pkgconfig(dlog-redirect-stdout) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(gmock) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(libcap) BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(libsystemd) +BuildRequires: pkgconfig(libsyscommon) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(parcel) diff --git a/src/launchpad-process-pool/CMakeLists.txt b/src/launchpad-process-pool/CMakeLists.txt index 062173c..4832ebb 100644 --- a/src/launchpad-process-pool/CMakeLists.txt +++ b/src/launchpad-process-pool/CMakeLists.txt @@ -37,6 +37,7 @@ APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC LIBCAP_DEPS LIBSMACK_DEPS LIBSYSTEMD_DEPS + LIBSYSCOMMON_DEPS LIBTZPLATFORM_CONFIG_DEPS SECURITY_MANAGER_DEPS TANCHOR_DEPS diff --git a/src/lib/launchpad/step_prepare_execution.cc b/src/lib/launchpad/step_prepare_execution.cc index 1c19ce0..951e5e2 100644 --- a/src/lib/launchpad/step_prepare_execution.cc +++ b/src/lib/launchpad/step_prepare_execution.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +62,8 @@ StepPrepareExecution::StepPrepareExecution() { std::placeholders::_1), std::bind(&StepPrepareExecution::PrepareIdFile, this, std::placeholders::_1), + std::bind(&StepPrepareExecution::LibsyscommonSwitchToPrivateConn, this, + std::placeholders::_1), std::bind(&StepPrepareExecution::SendStartupSignal, this, std::placeholders::_1), }; @@ -189,6 +192,11 @@ int StepPrepareExecution::PrepareIdFile(AppInfo* app_info) { return 0; } +int StepPrepareExecution::LibsyscommonSwitchToPrivateConn(AppInfo* app_info) { + _I("Switching to private connection."); + return gdbus_switch_to_private_connection(); +} + int StepPrepareExecution::SendStartupSignal(AppInfo* app_info) { if (Util::SendCmdToAmd(AmdCmd::AppStartupSignal) != 0) _W("Failed to send startup signal"); diff --git a/src/lib/launchpad/step_prepare_execution.hh b/src/lib/launchpad/step_prepare_execution.hh index f95514b..eea1c7e 100644 --- a/src/lib/launchpad/step_prepare_execution.hh +++ b/src/lib/launchpad/step_prepare_execution.hh @@ -43,6 +43,7 @@ class StepPrepareExecution { int WaitTepMount(AppInfo* app_info); int PrepareAppSocket(AppInfo* app_info); int PrepareIdFile(AppInfo* app_info); + int LibsyscommonSwitchToPrivateConn(AppInfo* app_info); int SendStartupSignal(AppInfo* app_info); private: diff --git a/tests/launchpad-process-pool-unittest/CMakeLists.txt b/tests/launchpad-process-pool-unittest/CMakeLists.txt index 9dd8db5..5b92bde 100644 --- a/tests/launchpad-process-pool-unittest/CMakeLists.txt +++ b/tests/launchpad-process-pool-unittest/CMakeLists.txt @@ -33,6 +33,7 @@ APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST} PUBLIC INIPARSER_DEPS LIBCAP_DEPS LIBSMACK_DEPS + LIBSYSCOMMON_DEPS LIBSYSTEMD_DEPS LIBTZPLATFORM_CONFIG_DEPS SECURITY_MANAGER_DEPS -- 2.7.4 From 1c917a48a57bf37db4e48a82284748117d08df48 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 23 Jun 2023 02:17:31 +0000 Subject: [PATCH 12/16] Release version 0.35.4 Changes: - Add step that forces private connections in libsyscommon Change-Id: I9703e0596a9af98f816e07b23bd17945d222a536 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 13ff036..775348e 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.35.3 +Version: 0.35.4 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 9af1764a76be8575fdcaaed2c2bfe2e98ff8c862 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Jun 2023 04:46:25 +0000 Subject: [PATCH 13/16] Revert "Add step that forces private connections in libsyscommon" This reverts commit 563653568fd889ea2c12f786a34d18231c53901c. Change-Id: Ib47f2747a6026337472a18aef61c8457a2747e0d --- CMakeLists.txt | 3 +-- packaging/launchpad.spec | 2 -- src/launchpad-process-pool/CMakeLists.txt | 1 - src/lib/launchpad/step_prepare_execution.cc | 8 -------- src/lib/launchpad/step_prepare_execution.hh | 1 - tests/launchpad-process-pool-unittest/CMakeLists.txt | 1 - 6 files changed, 1 insertion(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8ba71f..67bdb59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ PKG_CHECK_MODULES(DLOG_REDIRECT_STDOUT_DEPS REQUIRED dlog-redirect-stdout) PKG_CHECK_MODULES(ECORE_CORE_DEPS REQUIRED ecore-core) PKG_CHECK_MODULES(ECORE_DEPS REQUIRED ecore) PKG_CHECK_MODULES(ELEMENTARY_DEPS REQUIRED elementary) -PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0 gio-unix-2.0) +PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0) PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock) PKG_CHECK_MODULES(INIPARSER_DEPS REQUIRED iniparser) PKG_CHECK_MODULES(LIBCAP_DEPS REQUIRED libcap) @@ -75,7 +75,6 @@ PKG_CHECK_MODULES(TANCHOR_DEPS REQUIRED tanchor) PKG_CHECK_MODULES(TIZEN_SHARED_QUEUE_DEPS REQUIRED tizen-shared-queue) PKG_CHECK_MODULES(TTRACE_DEPS REQUIRED ttrace) PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf) -PKG_CHECK_MODULES(LIBSYSCOMMON_DEPS REQUIRED libsyscommon) ENABLE_TESTING() ADD_TEST(NAME ${TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST} diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 775348e..9ef2c67 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -23,13 +23,11 @@ BuildRequires: pkgconfig(dlog-redirect-stdout) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(gio-2.0) -BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(gmock) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(libcap) BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(libsystemd) -BuildRequires: pkgconfig(libsyscommon) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(parcel) diff --git a/src/launchpad-process-pool/CMakeLists.txt b/src/launchpad-process-pool/CMakeLists.txt index 4832ebb..062173c 100644 --- a/src/launchpad-process-pool/CMakeLists.txt +++ b/src/launchpad-process-pool/CMakeLists.txt @@ -37,7 +37,6 @@ APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC LIBCAP_DEPS LIBSMACK_DEPS LIBSYSTEMD_DEPS - LIBSYSCOMMON_DEPS LIBTZPLATFORM_CONFIG_DEPS SECURITY_MANAGER_DEPS TANCHOR_DEPS diff --git a/src/lib/launchpad/step_prepare_execution.cc b/src/lib/launchpad/step_prepare_execution.cc index 951e5e2..1c19ce0 100644 --- a/src/lib/launchpad/step_prepare_execution.cc +++ b/src/lib/launchpad/step_prepare_execution.cc @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -62,8 +61,6 @@ StepPrepareExecution::StepPrepareExecution() { std::placeholders::_1), std::bind(&StepPrepareExecution::PrepareIdFile, this, std::placeholders::_1), - std::bind(&StepPrepareExecution::LibsyscommonSwitchToPrivateConn, this, - std::placeholders::_1), std::bind(&StepPrepareExecution::SendStartupSignal, this, std::placeholders::_1), }; @@ -192,11 +189,6 @@ int StepPrepareExecution::PrepareIdFile(AppInfo* app_info) { return 0; } -int StepPrepareExecution::LibsyscommonSwitchToPrivateConn(AppInfo* app_info) { - _I("Switching to private connection."); - return gdbus_switch_to_private_connection(); -} - int StepPrepareExecution::SendStartupSignal(AppInfo* app_info) { if (Util::SendCmdToAmd(AmdCmd::AppStartupSignal) != 0) _W("Failed to send startup signal"); diff --git a/src/lib/launchpad/step_prepare_execution.hh b/src/lib/launchpad/step_prepare_execution.hh index eea1c7e..f95514b 100644 --- a/src/lib/launchpad/step_prepare_execution.hh +++ b/src/lib/launchpad/step_prepare_execution.hh @@ -43,7 +43,6 @@ class StepPrepareExecution { int WaitTepMount(AppInfo* app_info); int PrepareAppSocket(AppInfo* app_info); int PrepareIdFile(AppInfo* app_info); - int LibsyscommonSwitchToPrivateConn(AppInfo* app_info); int SendStartupSignal(AppInfo* app_info); private: diff --git a/tests/launchpad-process-pool-unittest/CMakeLists.txt b/tests/launchpad-process-pool-unittest/CMakeLists.txt index 5b92bde..9dd8db5 100644 --- a/tests/launchpad-process-pool-unittest/CMakeLists.txt +++ b/tests/launchpad-process-pool-unittest/CMakeLists.txt @@ -33,7 +33,6 @@ APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PROCESS_POOL_UNITTEST} PUBLIC INIPARSER_DEPS LIBCAP_DEPS LIBSMACK_DEPS - LIBSYSCOMMON_DEPS LIBSYSTEMD_DEPS LIBTZPLATFORM_CONFIG_DEPS SECURITY_MANAGER_DEPS -- 2.7.4 From 6526047fd7f00175a08a6f5a20ac05f2c73cb558 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Jun 2023 04:47:40 +0000 Subject: [PATCH 14/16] Release version 0.35.5 Changes: - Revert "Add step that forces private connections in libsyscommon" Change-Id: I7c162b0795fccafb794443ced903926ff90f8511 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 9ef2c67..ad6eb96 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.35.4 +Version: 0.35.5 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 2f09202227a75c97c994ed956393e4ef3539811c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Jun 2023 01:47:05 +0000 Subject: [PATCH 15/16] Add a new launch mode The "Always Loader With Low Priority" mode is added to the LaunchMode. If it's set, an application will be executed using the loader process. And, the loader process is executed with the low priority. When getting the launch request, the launchpad-process-pool sets the high priority to the process using the boosting API. Change-Id: I46a6eef78c263c01f4a757717cbb069f4b8b28f5 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/conf/launchpad.conf.in | 4 ++++ src/launchpad-process-pool/config.cc | 4 ++++ src/launchpad-process-pool/config.hh | 1 + src/launchpad-process-pool/launchpad.cc | 13 +++++++++++-- src/launchpad-process-pool/loader_context.cc | 5 ++++- src/lib/launchpad-common/sched_priority.cc | 12 ++++++++---- src/lib/launchpad-common/sched_priority.hh | 3 +++ src/lib/launchpad-hydra/launchpad_hydra.cc | 1 - src/lib/launchpad/launchpad_loader.cc | 1 - 9 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/launchpad-process-pool/conf/launchpad.conf.in b/src/launchpad-process-pool/conf/launchpad.conf.in index cc29900..e05b7ba 100644 --- a/src/launchpad-process-pool/conf/launchpad.conf.in +++ b/src/launchpad-process-pool/conf/launchpad.conf.in @@ -31,5 +31,9 @@ NumberOfLoaderProcesses=1 ## Mode=Always_Loader_Without_CPUChecker ## - This mode is the modified version of "Mode=Always_Loader". ## - After processing the launch request, the launchpad executes a new loader process without CPU Checker. +## Mode=Always_Loader_With_Low_Priority +## - This mode is the modified version of "Mode=Always_Loader_Without_CPUChecker". +## - When the loader process is executed, the launchpad sets the low scheduling priority to the running process. +## - And then, the launchpad sets the normal priority to the running process if the launch request is delivered. [LaunchMode] Mode=Default_Operation diff --git a/src/launchpad-process-pool/config.cc b/src/launchpad-process-pool/config.cc index fa82d48..00f7689 100644 --- a/src/launchpad-process-pool/config.cc +++ b/src/launchpad-process-pool/config.cc @@ -56,6 +56,8 @@ constexpr const char kValueModeDefaultOperation[] = "DEFAULT_OPERATION"; constexpr const char kValueModeAlwaysLoader[] = "ALWAYS_LOADER"; constexpr const char kValueModeAlwaysLoaderWithoutCPUChecker[] = "ALWAYS_LOADER_WITHOUT_CPUCHECKER"; +constexpr const char kValueModeAlwaysLoaderWithLowPriority[] = + "ALWAYS_LOADER_WITH_LOW_PRIORITY"; } // namespace @@ -197,6 +199,8 @@ Config::LaunchMode::LaunchMode(const IniParser& parser) { mode_ = LaunchMode::Mode::AlwaysLoader; else if (mode == kValueModeAlwaysLoaderWithoutCPUChecker) mode_ = LaunchMode::Mode::AlwaysLoaderWithoutCPUChecker; + else if (mode == kValueModeAlwaysLoaderWithLowPriority) + mode_ = LaunchMode::Mode::AlwaysLoaderWithLowPriority; } _W("[LaunchMode] mode: %d(%s)", static_cast(mode_), mode.c_str()); diff --git a/src/launchpad-process-pool/config.hh b/src/launchpad-process-pool/config.hh index 7d77e47..0daf5b2 100644 --- a/src/launchpad-process-pool/config.hh +++ b/src/launchpad-process-pool/config.hh @@ -98,6 +98,7 @@ class Config { DefaultOperation = 1, AlwaysLoader = 2, AlwaysLoaderWithoutCPUChecker = 3, + AlwaysLoaderWithLowPriority = 4, }; explicit LaunchMode(const IniParser& parser); diff --git a/src/launchpad-process-pool/launchpad.cc b/src/launchpad-process-pool/launchpad.cc index ad33449..64dab34 100644 --- a/src/launchpad-process-pool/launchpad.cc +++ b/src/launchpad-process-pool/launchpad.cc @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -385,6 +386,7 @@ bool Launchpad::CanUseLoaderContext( // Config::LaunchMode::Mode::AlwaysLoader // Config::LaunchMode::Mode::AlwaysLoaderWithoutCPUChecker + // Config::LaunchMode::Mode::AlwaysLoaderWithLowPriority if (context->GetPid() > 0) return true; @@ -477,8 +479,10 @@ Launchpad::LaunchResult Launchpad::ForkProcessing( Launchpad::LaunchResult Launchpad::LaunchRequestPend( std::shared_ptr request) { auto loader_context = request->GetAvailableLoaderContext(); - if (loader_context->IsPrepared()) + if (loader_context->IsPrepared()) { + SchedPriority::Set(loader_context->GetPid(), 0); return LaunchResult::Continue; + } _W("Loader context is not prepared"); loader_context->Ref(); @@ -515,6 +519,7 @@ Launchpad::LaunchResult Launchpad::LaunchRequestDo( request->SetPid(loader_context->Deploy(app_info)); if ((mode_ == Config::LaunchMode::Mode::AlwaysLoaderWithoutCPUChecker) || + (mode_ == Config::LaunchMode::Mode::AlwaysLoaderWithLowPriority) || (mode_ == Config::LaunchMode::Mode::AlwaysLoader && loader_context->RefCount() > 0)) loader_context->Prepare(); @@ -618,8 +623,12 @@ void Launchpad::OnLoaderPrepared(LoaderContext* loader_context) { void Launchpad::OnLoaderLaunched(LoaderContext* loader_context) { _W("Loader is launched. name(%s), pid(%d)", loader_context->GetLoaderName().c_str(), loader_context->GetPid()); - if (loader_context->RefCount() == 0) + if (loader_context->RefCount() == 0) { + if (mode_ == Config::LaunchMode::Mode::AlwaysLoaderWithLowPriority) + SchedPriority::Set(loader_context->GetPid(), 19); + return; + } for (auto& request : pending_requests_) { auto context = request->GetAvailableLoaderContext(); diff --git a/src/launchpad-process-pool/loader_context.cc b/src/launchpad-process-pool/loader_context.cc index 729a7a3..17b327e 100644 --- a/src/launchpad-process-pool/loader_context.cc +++ b/src/launchpad-process-pool/loader_context.cc @@ -34,6 +34,7 @@ #include #include "launchpad-process-pool/app_labels_monitor.hh" +#include "launchpad-process-pool/config.hh" #include "launchpad-process-pool/loader_executor.hh" #include "launchpad-process-pool/log.hh" #include "launchpad-process-pool/log_private.hh" @@ -209,8 +210,10 @@ void LoaderContext::Dispose() { } pid_t LoaderContext::Prepare() { + bool set_priority = (Config::GetInst().GetLaunchMode().GetMode() != + Config::LaunchMode::Mode::AlwaysLoaderWithLowPriority); pid_ = LoaderExecutor::GetInst().Execute(this, - loader_info_->GetSchedPriority()); + set_priority ? loader_info_->GetSchedPriority() : 0); _W("Prepare. type(%d), name(%s), pid(%d)", GetType(), GetLoaderName().c_str(), pid_); if (pid_ == -1) { diff --git a/src/lib/launchpad-common/sched_priority.cc b/src/lib/launchpad-common/sched_priority.cc index 19ccc91..a19d04c 100644 --- a/src/lib/launchpad-common/sched_priority.cc +++ b/src/lib/launchpad-common/sched_priority.cc @@ -24,12 +24,16 @@ namespace launchpad { int SchedPriority::Set(int priority) { - int ret = setpriority(PRIO_PGRP, 0, priority); + return Set(0, priority); +} + +int SchedPriority::Set(pid_t pid, int priority) { + int ret = setpriority(PRIO_PGRP, pid, priority); if (ret != 0) { - _E("Failed to set process priority. priority(%d), errno(%d)", - priority, errno); + _E("Failed to set priority proriority. who(%d), priority(%d), errno(%d)", + pid, priority, errno); } else { - _D("Setting priority(%d) is sucessful", priority); + _D("Setting priority(%d) is sucessful. who(%d)", priority, pid); } return ret; diff --git a/src/lib/launchpad-common/sched_priority.hh b/src/lib/launchpad-common/sched_priority.hh index 5b6e58a..f96fdd6 100644 --- a/src/lib/launchpad-common/sched_priority.hh +++ b/src/lib/launchpad-common/sched_priority.hh @@ -17,6 +17,8 @@ #ifndef LIB_LAUNCHPAD_COMMON_SCHED_PRIORITY_HH_ #define LIB_LAUNCHPAD_COMMON_SCHED_PRIORITY_HH_ +#include + #undef EXPORT_API #define EXPORT_API __attribute__((visibility("default"))) @@ -25,6 +27,7 @@ namespace launchpad { class EXPORT_API SchedPriority { public: static int Set(int priority); + static int Set(pid_t pid, int priority); static int Get(); }; diff --git a/src/lib/launchpad-hydra/launchpad_hydra.cc b/src/lib/launchpad-hydra/launchpad_hydra.cc index c2648ab..f9fcae6 100644 --- a/src/lib/launchpad-hydra/launchpad_hydra.cc +++ b/src/lib/launchpad-hydra/launchpad_hydra.cc @@ -130,7 +130,6 @@ void LaunchpadHydra::Run(hydra_lifecycle_callback_s* callback, candidate_pid_ = executor_->Execute(argc_, argv_); _D("Candidate process(%d)", candidate_pid_); socket_->Send(&candidate_pid_, sizeof(candidate_pid_)); - SchedPriority::Set(0); EventLoop::GetInst().Run(); OnTerminate(); diff --git a/src/lib/launchpad/launchpad_loader.cc b/src/lib/launchpad/launchpad_loader.cc index eac8621..14dc76e 100644 --- a/src/lib/launchpad/launchpad_loader.cc +++ b/src/lib/launchpad/launchpad_loader.cc @@ -110,7 +110,6 @@ int LaunchpadLoader::Run(loader_lifecycle_callback_s* callback, return -1; } - SchedPriority::Set(0); OnAdapterLoopBegin(); return OnTerminate(); } -- 2.7.4 From e8b91892fa0eb7cea7de5f62e18bed06aeaa04bc Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Jun 2023 06:31:43 +0000 Subject: [PATCH 16/16] Release version 0.35.6 Changes: - Add a new launch mode Change-Id: I0918885124cb5dad524e807d71e636cd62eae8ad Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index ad6eb96..1787aaf 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.35.5 +Version: 0.35.6 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4