From 10cd57fe54a30e2d9c00d8c9e95bbcf2eb5a8a35 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 23 Jun 2021 10:27:05 +0900 Subject: [PATCH 01/16] Release version 0.17.3 Changes: - Fix mount res dir - Fix memory management Change-Id: I4194ec97ce42bc1de6cd07c24ec70d622ed2dde6 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 ba01213..3fa46c6 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.2 +Version: 0.17.3 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 3d9a3767775e960e6ffca6be7eef6c884970300f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 30 Jun 2021 16:25:22 +0900 Subject: [PATCH 02/16] Check stdout fds redirection Before executing an application, the child process checks whether the stdout and stderr fds are redirected or not. If it's not, the child process tries to redirect stdout and stderr to dlog fd. And then, the child process tries to redirect stdout and stderr to journal stream fd if it's failed. Change-Id: I0abfbe06a1b1b615b65a6245243c07deaa155303 Signed-off-by: Hwankyu Jhun --- CMakeLists.txt | 1 + packaging/launchpad.spec | 1 + src/launchpad-process-pool/CMakeLists.txt | 1 + src/lib/common/src/launchpad_common.c | 24 ++++++++++++++++++++++++ src/lib/launchpad/CMakeLists.txt | 1 + 5 files changed, 28 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a8e0f5..fb3d5ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle) PKG_CHECK_MODULES(BUXTON2_DEPS REQUIRED buxton2) PKG_CHECK_MODULES(DBUS_DEPS REQUIRED dbus-1) PKG_CHECK_MODULES(DLOG_DEPS REQUIRED dlog) +PKG_CHECK_MODULES(DLOG_REDIRECT_STDOUT_DEPS REQUIRED dlog-redirect-stdout) PKG_CHECK_MODULES(ECORE_DEPS REQUIRED ecore) PKG_CHECK_MODULES(ECORE_CORE_DEPS REQUIRED ecore-core) PKG_CHECK_MODULES(ELEMENTARY_DEPS REQUIRED elementary) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 3fa46c6..38e1109 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -17,6 +17,7 @@ BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(dlog-redirect-stdout) BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(vconf) diff --git a/src/launchpad-process-pool/CMakeLists.txt b/src/launchpad-process-pool/CMakeLists.txt index 70732ff..b0af4fe 100644 --- a/src/launchpad-process-pool/CMakeLists.txt +++ b/src/launchpad-process-pool/CMakeLists.txt @@ -28,6 +28,7 @@ APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC BUNDLE_DEPS DBUS_DEPS DLOG_DEPS + DLOG_REDIRECT_STDOUT_DEPS GIO_DEPS INIPARSER_DEPS LIBCAP_DEPS diff --git a/src/lib/common/src/launchpad_common.c b/src/lib/common/src/launchpad_common.c index 61cb98c..16ec220 100644 --- a/src/lib/common/src/launchpad_common.c +++ b/src/lib/common/src/launchpad_common.c @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include "launchpad_common.h" #include "launchpad_types.h" @@ -957,6 +959,17 @@ static int __redirect_stdout(const char *ident) int ret; int fd; + if (dlog_is_log_fd(STDOUT_FILENO)) { + _W("STDOUT_FILENO is using dlog fd"); + return 0; + } + + ret = dlog_connect_fd(LOG_ID_APPS, STDOUT_FILENO, "STDOUT", DLOG_WARN); + if (ret == 0) { + _W("STDOUT_FILENO redirection is successful"); + return 0; + } + fd = sd_journal_stream_fd(ident, LOG_INFO, 0); if (fd < 0) { if (fd != -ENOENT) @@ -987,6 +1000,17 @@ static int __redirect_stderr(const char *ident) int ret; int fd; + if (dlog_is_log_fd(STDERR_FILENO)) { + _W("STDERR_FILENO is using dlog fd"); + return 0; + } + + ret = dlog_connect_fd(LOG_ID_APPS, STDERR_FILENO, "STDERR", DLOG_ERROR); + if (ret == 0) { + _W("STDERR_FILENO redirection is successful"); + return 0; + } + fd = sd_journal_stream_fd(ident, LOG_WARNING, 0); if (fd < 0) { if (fd != -ENOENT) diff --git a/src/lib/launchpad/CMakeLists.txt b/src/lib/launchpad/CMakeLists.txt index d43ea34..053920b 100644 --- a/src/lib/launchpad/CMakeLists.txt +++ b/src/lib/launchpad/CMakeLists.txt @@ -18,6 +18,7 @@ APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD} PUBLIC BUXTON2_DEPS DBUS_DEPS DLOG_DEPS + DLOG_REDIRECT_STDOUT_DEPS LIBCAP_DEPS LIBSYSTEMD_DEPS LIBTZPLATFORM_CONFIG_DEPS -- 2.7.4 From 8e009e1ca0ee724e7b5f3010c7d5df36d4e908d4 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 6 Jul 2021 08:08:44 +0900 Subject: [PATCH 03/16] Release version 0.17.4 Changes: - Check stdout fds redirection Change-Id: Iac8c777d3d58e3d658cfc770fc300e041ba1cb69 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 38e1109..0e9f341 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.3 +Version: 0.17.4 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 100b80da149e419d224282f43723e3338ca79fc3 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 6 Jul 2021 13:57:25 +0900 Subject: [PATCH 04/16] Remove dlog fd check Even if stdout fd is already redirected to dlog fd, calling dlog_connted_to() is needed to set the log tag. This patch removes calling dlog_is_log_fd(). Change-Id: If9fe1f28a68cfa62f02927945136f67581cd0f17 Signed-off-by: Hwankyu Jhun --- src/lib/common/src/launchpad_common.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/lib/common/src/launchpad_common.c b/src/lib/common/src/launchpad_common.c index 16ec220..0a3eaac 100644 --- a/src/lib/common/src/launchpad_common.c +++ b/src/lib/common/src/launchpad_common.c @@ -959,11 +959,6 @@ static int __redirect_stdout(const char *ident) int ret; int fd; - if (dlog_is_log_fd(STDOUT_FILENO)) { - _W("STDOUT_FILENO is using dlog fd"); - return 0; - } - ret = dlog_connect_fd(LOG_ID_APPS, STDOUT_FILENO, "STDOUT", DLOG_WARN); if (ret == 0) { _W("STDOUT_FILENO redirection is successful"); @@ -1000,11 +995,6 @@ static int __redirect_stderr(const char *ident) int ret; int fd; - if (dlog_is_log_fd(STDERR_FILENO)) { - _W("STDERR_FILENO is using dlog fd"); - return 0; - } - ret = dlog_connect_fd(LOG_ID_APPS, STDERR_FILENO, "STDERR", DLOG_ERROR); if (ret == 0) { _W("STDERR_FILENO redirection is successful"); -- 2.7.4 From 57ab166096000e1fc7ec5384560379edfe5ed2bc Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 7 Jul 2021 07:43:41 +0900 Subject: [PATCH 05/16] Release version 0.17.5 Changes: - Remove dlog fd check Change-Id: I08a5a85c7ec425f3f20c702af123b6998f602e16 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 0e9f341..0518474 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.17.4 +Version: 0.17.5 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 4e4552fe6768c26a2d776718c3c6a4d526cdb55c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 16 Jul 2021 20:16:46 +0900 Subject: [PATCH 06/16] Get LAUNCHPAD_LISTEN_FD variable from the environment Currently, the file descriptior is not generated sequentially in some devices. The launchpad-process-pool is not always started by systemd. In this case, the program sets LAUNCHPAD_LISTEN_FD variable to the environment. After this patch is applied, the launchpad-process-pool tries to get the fd from the environment if calling sd_listen_fd() is failed. Change-Id: Ice99b52282b9ed7322acc185c150b6c8550d0d8d Signed-off-by: Hwankyu Jhun --- src/launchpad-process-pool/src/launchpad.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/launchpad-process-pool/src/launchpad.c b/src/launchpad-process-pool/src/launchpad.c index be7a14a..8bc1d78 100644 --- a/src/launchpad-process-pool/src/launchpad.c +++ b/src/launchpad-process-pool/src/launchpad.c @@ -1385,18 +1385,37 @@ static int __create_sock_activation(void) return -1; } +static int __get_launchpad_listen_fd(void) +{ + const char *val; + + val = getenv("LAUNCHPAD_LISTEN_FD"); + if (!val) { + _E("Failed to get LAUNCHPAD_LISTEN_FD"); + return -1; + } + + _W("Listen Fd: %s", val); + return atoi(val); +} + static int __launchpad_pre_init(int argc, char **argv) { int fd; /* create launchpad sock */ fd = __create_sock_activation(); + if (fd >= 0) + return fd; + + fd = __get_launchpad_listen_fd(); + if (fd >= 0) + return fd; + + fd = _create_server_sock(PROCESS_POOL_LAUNCHPAD_SOCK); if (fd < 0) { - fd = _create_server_sock(PROCESS_POOL_LAUNCHPAD_SOCK); - if (fd < 0) { - _E("server sock error %d", fd); - return -1; - } + _E("server sock error %d", fd); + return -1; } return fd; -- 2.7.4 From 1e096dacfcf681d233b29be2da8c26966bcd2f42 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 19 Jul 2021 07:55:18 +0900 Subject: [PATCH 07/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 08/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 09/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 10/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 11/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 12/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 13/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 14/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 15/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 16/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