From 1e096dacfcf681d233b29be2da8c26966bcd2f42 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 19 Jul 2021 07:55:18 +0900 Subject: [PATCH 01/16] Fix static anlaysis issue - Fix buffer size to remove using large stack Change-Id: I2ad8f73c1ec06dfdfb37286887dd3528f86a8a64 Signed-off-by: Hwankyu Jhun --- src/lib/common/src/launchpad_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/common/src/launchpad_common.c b/src/lib/common/src/launchpad_common.c index 0a3eaac..17ab641 100644 --- a/src/lib/common/src/launchpad_common.c +++ b/src/lib/common/src/launchpad_common.c @@ -352,7 +352,7 @@ app_pkt_t *_recv_pkt_raw(int fd) { int len; int ret; - unsigned char buf[AUL_SOCK_MAXBUFF]; + unsigned char buf[AUL_PKT_HEADER_SIZE]; app_pkt_t *pkt; int cmd; int datalen; -- 2.7.4 From c4a904daf1b1228fb5a4cd69c29211f801c0d7c1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 19 Jul 2021 08:16:11 +0900 Subject: [PATCH 02/16] Release version 0.17.6 Changes: - Get LAUNCHPAD_LISTEN_FD variable from the environment - Fix static anlaysis issue Change-Id: I68f0dd0c0eb1c3f754c44b70dc3b778936b80a24 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 0518474..8e74efe 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.5 +Version: 0.17.6 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 72daf1904c7ba6f38a3b968bd8f4061d61c01d7e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 28 Jul 2021 08:37:55 +0900 Subject: [PATCH 03/16] Print error logs If calling the getcwd() is failed, the loader process prints an error log. Change-Id: Ic34bcffdc7aa5facf9b52ef06406506072a00850 Signed-off-by: Hwankyu Jhun --- src/app-defined-loader/src/app-defined-loader.cc | 1 + src/launchpad-loader/src/launchpad_loader.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app-defined-loader/src/app-defined-loader.cc b/src/app-defined-loader/src/app-defined-loader.cc index da8e3c6..3fe7085 100644 --- a/src/app-defined-loader/src/app-defined-loader.cc +++ b/src/app-defined-loader/src/app-defined-loader.cc @@ -242,6 +242,7 @@ class AppDefinedLoader { char old_cwd[PATH_MAX] = {0, }; AppDefinedLoader* loader = static_cast(user_data); if (getcwd(old_cwd, sizeof(old_cwd)) == nullptr) { + _E("getcwd() is failed"); loader->DoDlOpen(false, old_cwd, ""); } else { char* libdir = _get_libdir(argv[LOADER_ARG_PATH]); diff --git a/src/launchpad-loader/src/launchpad_loader.c b/src/launchpad-loader/src/launchpad_loader.c index fbe0b76..cda2457 100644 --- a/src/launchpad-loader/src/launchpad_loader.c +++ b/src/launchpad-loader/src/launchpad_loader.c @@ -325,8 +325,10 @@ static int __loader_terminate_cb(int argc, char **argv, void *user_data) SECURE_LOGD("[candidate] Launch real application (%s)", argv[LOADER_ARG_PATH]); - if (getcwd(old_cwd, sizeof(old_cwd)) == NULL) + if (getcwd(old_cwd, sizeof(old_cwd)) == NULL) { + _E("getcwd() is failed"); goto do_dlopen; + } libdir = _get_libdir(argv[LOADER_ARG_PATH]); if (libdir == NULL) -- 2.7.4 From 5457e5e5e5729d1b33f1e5f90696c0105425612e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 28 Jul 2021 15:31:12 +0900 Subject: [PATCH 04/16] Release version 0.17.7 Changes: - Print error logs Change-Id: Ib67d9d294f39666aa2cdd0defc2229c86c91b491 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 8e74efe..6854ab8 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.6 +Version: 0.17.7 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 071d9b72e4b1265ee329c43a47be7dff076c59ba Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 5 Aug 2021 08:42:24 +0900 Subject: [PATCH 05/16] Check threshold in memory monitor If the threshold is equal to 100, the launchpad-process-pool doesn't start monitoring the system memory. Change-Id: If8b3224fabfbf3e871a73287fddd1be41880a4d7 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/src/launchpad_memory_monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/launchpad-process-pool/src/launchpad_memory_monitor.c b/src/launchpad-process-pool/src/launchpad_memory_monitor.c index 5bd52ab..7bd3d4a 100644 --- a/src/launchpad-process-pool/src/launchpad_memory_monitor.c +++ b/src/launchpad-process-pool/src/launchpad_memory_monitor.c @@ -69,6 +69,9 @@ static void __memory_monitor_stop(void) static void __memory_monitor_start(void) { + if (__monitor.threshold == 100) + return; + if (__monitor.tag) return; -- 2.7.4 From eb5ef5d6cb4bff366f1f24be32174d932a27fb96 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 5 Aug 2021 09:22:34 +0900 Subject: [PATCH 06/16] Release version 0.17.8 Changes: - Check threshold in memory monitor Change-Id: I3d4857b328cdf2feb47ca8cacfb6b3b655210e61 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 6854ab8..57c4d49 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.7 +Version: 0.17.8 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 170d086362136a6145bac003a6ae9cc14c6302f1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 12 Aug 2021 07:53:17 +0900 Subject: [PATCH 07/16] Fix memory monitor function If the threshold is 100, the memory_monitor_is_low_memory() function always returns false. The value of the threshold that is 100 means the feature is disabled. Change-Id: I5c72297ca11dfa3d70c39c412a5bee1bc3f76790 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/src/launchpad_memory_monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/launchpad-process-pool/src/launchpad_memory_monitor.c b/src/launchpad-process-pool/src/launchpad_memory_monitor.c index 7bd3d4a..d4d4b2d 100644 --- a/src/launchpad-process-pool/src/launchpad_memory_monitor.c +++ b/src/launchpad-process-pool/src/launchpad_memory_monitor.c @@ -96,6 +96,9 @@ bool _memory_monitor_is_low_memory(void) { unsigned int mem_used_ratio = 0; + if (__monitor.threshold == 100) + return false; + _proc_get_mem_used_ratio(&mem_used_ratio); _W("previous used ratio(%u), current used ratio(%u)", -- 2.7.4 From 7899485398dbc09ff688efa81bff249e983ebe68 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 12 Aug 2021 08:46:24 +0900 Subject: [PATCH 08/16] Release version 0.17.9 Changes: - Fix memory monitor function Change-Id: I2d54c93369ea098d86826db1725d0129000fc5e3 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 57c4d49..3259eeb 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.8 +Version: 0.17.9 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From d001503f0263e8a6e758f0bad2b1325373a5e489 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 6 Sep 2021 14:46:47 +0900 Subject: [PATCH 09/16] Fix executable file check Before checking the executable file, the launchpad-process-pool checks whether the type of the application is "capp" or "c++app". Other applications are executec using the launcher. (e.g. wrt) Change-Id: Ib6a1931dd43d838524e4b907ac4965846fa3c991 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/src/launchpad.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/launchpad-process-pool/src/launchpad.c b/src/launchpad-process-pool/src/launchpad.c index 8bc1d78..d3bbf50 100644 --- a/src/launchpad-process-pool/src/launchpad.c +++ b/src/launchpad-process-pool/src/launchpad.c @@ -2254,12 +2254,17 @@ static bool __handle_launch_event(int fd, io_condition_e cond, void *data) installed_storage = bundle_get_val(kb, AUL_K_INSTALLED_STORAGE); if (!installed_storage || strcmp(installed_storage, "external") != 0) { - if (access(app_path, X_OK) != 0) { - ret = -errno; - _E("%s is not executable. errno(%d)", app_path, errno); - __send_result_to_caller(clifd, ret); - clifd = -1; - goto end; + if (menu_info->app_type && + (!strcmp(menu_info->app_type, "capp") || + !strcmp(menu_info->app_type, "c++app"))) { + if (access(app_path, X_OK) != 0) { + ret = -errno; + _E("%s is not executable. errno(%d)", + app_path, errno); + __send_result_to_caller(clifd, ret); + clifd = -1; + goto end; + } } } -- 2.7.4 From ae1f15b4d4dcc4eab4fd65897674b957f755d44a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 7 Sep 2021 16:50:44 +0900 Subject: [PATCH 10/16] Release version 0.17.10 Changes: - Fix executable file check Change-Id: Id916b6d13de37f3ec054706aa9fa49bcf29a9fa1 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 3259eeb..f075125 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.9 +Version: 0.17.10 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 7ca0d1918da2cbbe0dc0fd14b9e0e108f1bbc985 Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Mon, 25 Oct 2021 15:55:09 +0900 Subject: [PATCH 11/16] Add prelaunch callback prelaunch callback is called to before being called security_manager_prepare_app() Change-Id: Ib658ed698966dd4a7cd063bf3316e6f37dacca18 Signed-off-by: Changgyu Choi --- src/app-defined-loader/src/app-defined-loader.cc | 1 + src/lib/launchpad/inc/launchpad.h | 4 ++++ src/lib/launchpad/src/launchpad_lib.c | 11 +++++++++++ 3 files changed, 16 insertions(+) diff --git a/src/app-defined-loader/src/app-defined-loader.cc b/src/app-defined-loader/src/app-defined-loader.cc index 3fe7085..4ae4471 100644 --- a/src/app-defined-loader/src/app-defined-loader.cc +++ b/src/app-defined-loader/src/app-defined-loader.cc @@ -54,6 +54,7 @@ class AppDefinedLoader { AppDefinedLoader(int argc, char** argv) : argc_(argc), argv_(argv) { lifecycle_cb_ = std::make_shared(); lifecycle_cb_->create = OnCreate; + lifecycle_cb_->prelaunch = nullptr; lifecycle_cb_->launch = OnLaunch; lifecycle_cb_->terminate = OnTerminate; diff --git a/src/lib/launchpad/inc/launchpad.h b/src/lib/launchpad/inc/launchpad.h index 7d20175..86ea976 100644 --- a/src/lib/launchpad/inc/launchpad.h +++ b/src/lib/launchpad/inc/launchpad.h @@ -24,6 +24,9 @@ extern "C" { #endif typedef void (*loader_create_cb)(bundle *extra, int type, void *user_data); +typedef int (*loader_prelaunch_cb)(int argc, char **argv, const char *app_path, + const char *appid, const char *pkgid, const char *pkg_type, + void *user_data); typedef int (*loader_launch_cb)(int argc, char **argv, const char *app_path, const char *appid, const char *pkgid, const char *pkg_type, void *user_data); @@ -38,6 +41,7 @@ typedef void (*loader_remove_fd_cb)(void *user_data, int fd); typedef struct { loader_create_cb create; + loader_prelaunch_cb prelaunch; loader_launch_cb launch; loader_terminate_cb terminate; } loader_lifecycle_callback_s; diff --git a/src/lib/launchpad/src/launchpad_lib.c b/src/lib/launchpad/src/launchpad_lib.c index 05fa2c3..c4e7a95 100644 --- a/src/lib/launchpad/src/launchpad_lib.c +++ b/src/lib/launchpad/src/launchpad_lib.c @@ -251,6 +251,17 @@ static int __candidate_process_launchpad_main_loop(app_pkt_t *pkt, tmp_argv = _create_argc_argv(kb, &tmp_argc); + if (__loader_callbacks->prelaunch) { + ret = __loader_callbacks->prelaunch(tmp_argc, tmp_argv, + app_path, menu_info->appid, menu_info->pkgid, + menu_info->pkg_type, __loader_user_data); + + if (ret < 0) { + _E("prelaunch callback fail (%d)", ret); + exit(-1); + } + } + __default_launch_cb(kb, menu_info->appid, app_path, menu_info->root_path, menu_info->pkgid, menu_info->pkg_type, type, menu_info->global); -- 2.7.4 From dd5567b8cc6765bd5166536abe5bc80bcbf1e245 Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Tue, 26 Oct 2021 13:20:03 +0900 Subject: [PATCH 12/16] Release version 0.18.0 Changes: - Add prelaunch callback Change-Id: I324c850ef186a5c96c7e5115816c62fd6e79eb7c Signed-off-by: Changgyu Choi --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index f075125..4a6e3dd 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.10 +Version: 0.18.0 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 75ec7ef375e4222395a2ed1bfc30ff9c96d7800e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 29 Oct 2021 15:09:19 +0900 Subject: [PATCH 13/16] Set child subreaper attribute When the hydra loader is terminated, the parent process ID of the application that is launched using the loader process is created by the hydra loader is changed to the launchpad-process-pool. Currently, the hydra loader is terminated, the application is always running as zombie process. After this patch is applied, even though the hydra load is terminated, the launchpad-process-pool gets the SIGCHLD signal when the application is terminated. Change-Id: I5d1d05e25c6a0803e925c857106367cc74382631 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/src/launchpad.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/launchpad-process-pool/src/launchpad.c b/src/launchpad-process-pool/src/launchpad.c index d3bbf50..3d57531 100644 --- a/src/launchpad-process-pool/src/launchpad.c +++ b/src/launchpad-process-pool/src/launchpad.c @@ -3241,6 +3241,8 @@ int main(int argc, char **argv) GMainLoop *mainloop = NULL; _print_hwc_log("%s(%d): START", __FUNCTION__, __LINE__); + prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0); + mainloop = g_main_loop_new(NULL, FALSE); if (!mainloop) { _E("Failed to create glib main loop"); -- 2.7.4 From a57309451bfb0007976aae9684cdc98eab4025b5 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 29 Oct 2021 16:02:00 +0900 Subject: [PATCH 14/16] Release version 0.18.1 Changes: - Set child subreaper attribute Change-Id: I04a882e3f3d4a9c3611bf3035be10f6e3316d351 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 4a6e3dd..b0a556a 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.18.0 +Version: 0.18.1 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 40a09d54f5dc014a3fb276bfbbaafd61b5f0ec26 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 29 Oct 2021 16:56:39 +0900 Subject: [PATCH 15/16] Adjust sending startup signal After creating the app socket, the startup signal will be sent. Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/265335/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/amd/+/265818/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/launchpad/+/265825/ Change-Id: Ib06bdf45b51b44bc9225b40333bb0b30968951b4 Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/src/launchpad.c | 2 +- src/lib/launchpad/src/launchpad_lib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launchpad-process-pool/src/launchpad.c b/src/launchpad-process-pool/src/launchpad.c index 3d57531..516079c 100644 --- a/src/launchpad-process-pool/src/launchpad.c +++ b/src/launchpad-process-pool/src/launchpad.c @@ -1269,7 +1269,6 @@ static int __prepare_exec(const char *appid, const char *app_path, if (ret != SECURITY_MANAGER_SUCCESS) return PAD_ERR_REJECTED; - _send_cmd_to_amd(APP_STARTUP_SIGNAL); if (bundle_get_type(kb, AUL_K_SDK) == BUNDLE_TYPE_NONE) _setup_stdio(basename(app_path)); @@ -1309,6 +1308,7 @@ static int __prepare_exec(const char *appid, const char *app_path, return PAD_ERR_FAILED; } + _send_cmd_to_amd(APP_STARTUP_SIGNAL); return 0; } diff --git a/src/lib/launchpad/src/launchpad_lib.c b/src/lib/launchpad/src/launchpad_lib.c index c4e7a95..e14894f 100644 --- a/src/lib/launchpad/src/launchpad_lib.c +++ b/src/lib/launchpad/src/launchpad_lib.c @@ -102,7 +102,6 @@ static int __prepare_exec(const char *appid, const char *app_path, return -1; } - _send_cmd_to_amd(APP_STARTUP_SIGNAL); _setup_stdio(basename(app_path)); ret = buxton_open(&bxt_cli, NULL, NULL); @@ -159,6 +158,7 @@ static int __prepare_exec(const char *appid, const char *app_path, if (ret < 0) return -1; + _send_cmd_to_amd(APP_STARTUP_SIGNAL); return 0; } -- 2.7.4 From 5cd1f3dfa1d17422fdae54e9c27bac15e7d83819 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 3 Nov 2021 12:58:54 +0900 Subject: [PATCH 16/16] Release version 0.18.2 Changes: - Adjust sending startup signal Change-Id: I19da8d0663214b98cdc7163a0e40ae71e50c8044 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 b0a556a..55021a7 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.18.1 +Version: 0.18.2 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4