From ac554a40cbf710c30fb815e94b084e0b9195acfd Mon Sep 17 00:00:00 2001 From: Jusung Son Date: Tue, 25 Feb 2020 14:26:08 +0900 Subject: [PATCH 01/16] Fix resource leak Change-Id: I480ea356548a4ce25a4e6ebb6028474bd011a950 Signed-off-by: Jusung Son --- src/launchpad/src/launchpad.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index 43540d6..79ac8f6 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -2457,6 +2457,9 @@ static bool __on_file_change(const char *event_name, uint32_t mask, { char buf[PATH_MAX]; char *ext; + loader_info_t* info; + candidate_process_context_t *cpc; + if (!event_name) { _E("Invalid parameter"); return true; @@ -2472,7 +2475,12 @@ static bool __on_file_change(const char *event_name, uint32_t mask, app_defined_loader_info_list = _loader_info_load_file( app_defined_loader_info_list, buf); } else if (mask & IN_DELETE) { - snprintf(buf, ext - event_name, "%s", event_name); + snprintf(buf, ext - event_name + 1, "%s", event_name); + + info = _loader_info_find_loader_by_loader_name( + app_defined_loader_info_list, buf); + cpc = __find_slot_from_loader_name(info->name); + __remove_slot(cpc->type, cpc->loader_id); app_defined_loader_info_list = _loader_info_unload( app_defined_loader_info_list, buf); } -- 2.7.4 From 4c482bd730a33b5752c87d0b100884622ef26f41 Mon Sep 17 00:00:00 2001 From: Jusung Son Date: Tue, 25 Feb 2020 17:15:32 +0900 Subject: [PATCH 02/16] Apply time-to-live range for app-defined loader - min : 30sec, max 60sec Change-Id: Id31bc158a6841ee3240552e9bc8ccddd91973bc1 Signed-off-by: Jusung Son --- src/parser/loader_info.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser/loader_info.cc b/src/parser/loader_info.cc index 1f6a2f5..f2ffdec 100644 --- a/src/parser/loader_info.cc +++ b/src/parser/loader_info.cc @@ -30,6 +30,11 @@ int LoaderInfo::GetTimeToLive() { } void LoaderInfo::SetTimeToLive(int time) { + if (time < 30) + time = 30; + else if (time > 60) + time = 60; + time_to_live_ = time; } -- 2.7.4 From 3b6c6f584e44ce0bf621d387d4945237b8ccc51f Mon Sep 17 00:00:00 2001 From: Jusung Son Date: Wed, 26 Feb 2020 13:32:26 +0900 Subject: [PATCH 03/16] Release version 0.13.1 Changes: - Modify candidate process creation rule for app-defined loader - Fix resource leak - Apply time-to-live range for app-defined loader Change-Id: I2bd0fae505bee9ed5c64c7ff04fdfcf5fdb90a49 Signed-off-by: Jusung Son --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 42fb613..d129b47 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.13.0 +Version: 0.13.1 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From b5b47fcdbc83499d737b95fbf0e7c9fdb92bf353 Mon Sep 17 00:00:00 2001 From: Jongmin Lee Date: Wed, 8 Apr 2020 09:08:23 +0900 Subject: [PATCH 04/16] Check EFL module version in build time EFL module path depend on its version. This commit makes it possible to read EFL module version and generate EFL module path in build time. Change-Id: I8bcf33dc814878bd0e8900b7c29105a07c2208d9 --- CMakeLists.txt | 5 +++++ packaging/default.loader.in | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7d515c..7fbbd02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,4 +17,9 @@ ADD_DEFINITIONS("-DLAUNCHPAD_LOG") ADD_DEFINITIONS("-DPRELOAD_ACTIVATE") ADD_DEFINITIONS("-DPREEXEC_ACTIVATE") +EXEC_PROGRAM(pkg-config + ARGS --variable=module_arch ecore + OUTPUT_VARIABLE EFL_MODULE_VERSION +) + ADD_SUBDIRECTORY(src) diff --git a/packaging/default.loader.in b/packaging/default.loader.in index a910c96..3e076ce 100644 --- a/packaging/default.loader.in +++ b/packaging/default.loader.in @@ -10,12 +10,12 @@ EXTRA_ARRAY preload EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-efl.so.1 EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-common.so.1 EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcapi-appfw-application.so.0 -EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_imf/modules/wayland/v-1.23/module.so +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_imf/modules/wayland/@EFL_MODULE_VERSION@/module.so EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libdali-toolkit.so EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcairo.so.2 EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcapi-media-player.so.0 EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcapi-media-camera.so.0 -EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_evas/engines/extn/v-1.23/module.so +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_evas/engines/extn/@EFL_MODULE_VERSION@/module.so ALTERNATIVE_LOADER common-loader1 [LOADER] @@ -29,8 +29,8 @@ EXTRA_ARRAY preload EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-efl.so.1 EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-common.so.1 EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcapi-appfw-application.so.0 -EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_imf/modules/wayland/v-1.23/module.so -EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_evas/engines/extn/v-1.23/module.so +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_imf/modules/wayland/@EFL_MODULE_VERSION@/module.so +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_evas/engines/extn/@EFL_MODULE_VERSION@/module.so -- 2.7.4 From e4371145601eb5b15d3065b000ba61157bcc623b Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 7 Apr 2020 15:26:43 +0900 Subject: [PATCH 05/16] Add a new tag for loader If "APP_CHECK" is "OFF", the launchpad doesn't check whether the application is installed or not. Change-Id: I74aa5c02429c945194113a8a29649d71bf068256 Signed-off-by: Hwankyu Jhun --- src/launchpad/inc/loader_info.h | 1 + src/launchpad/src/launchpad.c | 38 ++++++++++++++++++++++++-------------- src/launchpad/src/loader_info.c | 5 +++++ 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/launchpad/inc/loader_info.h b/src/launchpad/inc/loader_info.h index 5111519..e3ae865 100644 --- a/src/launchpad/inc/loader_info.h +++ b/src/launchpad/inc/loader_info.h @@ -53,6 +53,7 @@ typedef struct _loader_info { int deactivation_method; unsigned int ttl; bool is_hydra; + bool app_check; } loader_info_t; typedef void (*loader_info_foreach_cb)(loader_info_t *info, void *data); diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index 79ac8f6..a5931f2 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -116,6 +116,7 @@ typedef struct { guint live_timer; int state; bool is_hydra; + bool app_check; io_channel_h client_channel; io_channel_h channel; io_channel_h hydra_channel; @@ -178,7 +179,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id, int detection_method, int activation_method, int deactivation_method, unsigned int ttl, int timeout_val, int threshold_max, int threshold_min, bool on_boot, - bool app_exists, bool is_hydra); + bool app_exists, bool is_hydra, bool app_check); static int __remove_slot(int type, int loader_id); static int __add_default_slots(void); static gboolean __handle_idle_checker(gpointer data); @@ -211,7 +212,7 @@ static gboolean __handle_queuing_slots(gpointer data) return G_SOURCE_REMOVE;; } - if (!cpc->app_exists) { + if (cpc->app_check && !cpc->app_exists) { _W("The application is not installed. Type(%d)", cpc->type); return G_SOURCE_CONTINUE; } @@ -1601,7 +1602,7 @@ static gboolean __handle_idle_checker(gpointer data) } cpc = (candidate_process_context_t *)data; - if (!cpc->app_exists) { + if (cpc->app_check && !cpc->app_exists) { _W("The application is not installed. Type(%d)", cpc->type); __sequencer.idle_checker = 0; __sequencer.running_cpc = NULL; @@ -1660,7 +1661,7 @@ static int __add_idle_checker(int detection_method, GList *cur) continue; } - if (!cpc->app_exists) { + if (cpc->app_check && !cpc->app_exists) { iter = g_list_next(iter); continue; } @@ -1729,7 +1730,9 @@ static int __dispatch_cmd_add_loader(bundle *kb) DEFAULT_CPU_THRESHOLD_MAX, DEFAULT_CPU_THRESHOLD_MIN, false, - true, 0); + true, + false, + true); __set_timer(cpc); free(loader_name); return lid; @@ -1776,7 +1779,9 @@ static int __dispatch_cmd_add_app_defined_loader(bundle *kb) DEFAULT_CPU_THRESHOLD_MAX, DEFAULT_CPU_THRESHOLD_MIN, false, - true, 0); + true, + false, + true); if (cpc == NULL) { _E("cpc is NULL"); bundle_free_encoded_rawdata(&extra); @@ -1887,7 +1892,7 @@ static void __update_slot(int type, bool app_exists) return; cpc->app_exists = app_exists; - if (!cpc->app_exists) { + if (cpc->app_check && !cpc->app_exists) { if (cpc->pid > 0) __dispose_candidate_process(cpc); __sequencer_remove_slot(cpc); @@ -1971,7 +1976,7 @@ static void __activate_slot(candidate_process_context_t *cpc) if (!cpc->touched && !cpc->on_boot) return; - if (!cpc->app_exists || cpc->pid > CANDIDATE_NONE) + if ((cpc->app_check && !cpc->app_exists) || cpc->pid > CANDIDATE_NONE) return; if (cpc->detection_method & METHOD_TIMEOUT) @@ -2161,7 +2166,7 @@ static bool __handle_launch_event(int fd, io_condition_e cond, void *data) _W("Launch directly %d %p", loader_id, cpc); pid = __launch_directly(menu_info->appid, app_path, clifd, kb, menu_info, NULL); - if (org_cpc && org_cpc->app_exists && + if (org_cpc && (!org_cpc->app_check || org_cpc->app_exists) && org_cpc->pid == CANDIDATE_NONE && !__sequencer_slot_exist(org_cpc)) { if (org_cpc->timer > 0) { @@ -2232,7 +2237,7 @@ static candidate_process_context_t *__create_slot(int type, int loader_id, int activation_method, int deactivation_method, unsigned int ttl, int timeout_val, int threshold_max, int threshold_min, - bool on_boot, bool app_exists, bool is_hydra) + bool on_boot, bool app_exists, bool is_hydra, bool app_check) { candidate_process_context_t *cpc; @@ -2290,6 +2295,7 @@ static candidate_process_context_t *__create_slot(int type, int loader_id, cpc->ttl = ttl; cpc->live_timer = 0; cpc->is_hydra = is_hydra; + cpc->app_check = app_check; cpc->score = WIN_SCORE; cpc->pss = 0; @@ -2308,7 +2314,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id, int activation_method, int deactivation_method, unsigned int ttl, int timeout_val, int threshold_max, int threshold_min, - bool on_boot, bool app_exists, bool is_hydra) + bool on_boot, bool app_exists, bool is_hydra, bool app_check) { candidate_process_context_t *cpc; int fd; @@ -2325,7 +2331,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id, activation_method, deactivation_method, ttl, timeout_val, threshold_max, threshold_min, - on_boot, app_exists, is_hydra); + on_boot, app_exists, is_hydra, app_check); if (cpc == NULL) return NULL; @@ -2614,7 +2620,9 @@ static void __add_slot_from_info(gpointer data, gpointer user_data) info->cpu_threshold_max, info->cpu_threshold_min, false, - info->app_exists, info->is_hydra); + info->app_exists, + info->is_hydra, + info->app_check); if (cpc == NULL) return; @@ -2641,7 +2649,9 @@ static void __add_slot_from_info(gpointer data, gpointer user_data) info->cpu_threshold_max, info->cpu_threshold_min, info->on_boot, - info->app_exists, info->is_hydra); + info->app_exists, + info->is_hydra, + info->app_check); if (cpc == NULL) return; diff --git a/src/launchpad/src/loader_info.c b/src/launchpad/src/loader_info.c index 2c5c5da..3493366 100644 --- a/src/launchpad/src/loader_info.c +++ b/src/launchpad/src/loader_info.c @@ -42,6 +42,7 @@ #define TAG_CPU_THRESHOLD_MIN "CPU_THRESHOLD_MIN" #define TAG_ON_BOOT "ON_BOOT" #define TAG_HYDRA "HYDRA" +#define TAG_APP_CHECK "APP_CHECK" #define VAL_ON "ON" #define VAL_OFF "OFF" @@ -84,6 +85,7 @@ static loader_info_t *__create_loader_info() info->deactivation_method = 0; info->ttl = 600; /* 10 minutes */ info->is_hydra = false; + info->app_check = true; return info; } @@ -305,6 +307,9 @@ static GList *__parse_file(GList *list, const char *path) } else { cur_info->is_hydra = 0; } + } else if (strcasecmp(TAG_APP_CHECK, tok1) == 0) { + if (tok2 && strcasecmp(VAL_OFF, tok2) == 0) + cur_info->app_check = false; } } -- 2.7.4 From 5f1ebde72a91a0fc6a09a2ae1ec5699ac36796f2 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 8 Apr 2020 12:33:46 +0900 Subject: [PATCH 06/16] Release version 0.14.0 Changes: - Check EFL module version in build time - Add a new tag for loader Change-Id: Ia450474d6f518670b603040cc3764616e47fe817 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 d129b47..15b0cc7 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.13.1 +Version: 0.14.0 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 69e7bd5d367c6fa11d9080b6f0ba4dbd032b86fc Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 29 Apr 2020 12:30:30 +0900 Subject: [PATCH 07/16] Fix Logger Handler - Uses LOGE() instead of SECURE_LOGE() for debugging errors Change-Id: Ifa8d3bc631bd94b27ed49a8aa21a7261e5a4b272 Signed-off-by: Hwankyu Jhun --- src/launchpad/src/launchpad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index a5931f2..da7042b 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -2840,7 +2840,7 @@ static bool __handle_logger(int fd, io_condition_e cond, void *data) goto end; } - SECURE_LOGE("[%d] %s", cr.pid, (const char *)pkt->data); + _E("[%d] %s", cr.pid, (const char *)pkt->data); end: if (clifd != -1) close(clifd); -- 2.7.4 From 68abacae2b109fa7b67a909684a4f43d5534ad85 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 7 May 2020 10:20:14 +0900 Subject: [PATCH 08/16] Release version 0.14.1 Changes: - Fix Logger Handler Change-Id: I6cea08feaf187ecac0c7976d7be5e2a2390d0c5f 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 15b0cc7..dc77540 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.14.0 +Version: 0.14.1 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 8a26914f4b41eda2ff02f47cc37ee870c6d22d01 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 12 May 2020 10:17:42 +0900 Subject: [PATCH 09/16] Fix default debugger config file Adds: - gdb Change-Id: Ie2465a4732ecc0aeb1122d0c418c373c5f21a156 Signed-off-by: Hwankyu Jhun --- packaging/default.debugger.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packaging/default.debugger.in b/packaging/default.debugger.in index cce288e..b8e1651 100644 --- a/packaging/default.debugger.in +++ b/packaging/default.debugger.in @@ -28,3 +28,8 @@ NAME UNIT_TEST APP_TYPE capp|c++app LAST_EXTRA_KEY __DLP_UNIT_TEST_ARG__ +[DEBUGGER] +NAME GDB +EXE /usr/bin/gdb +APP_TYPE capp|c++app +EXTRA_KEY __DLP_GDB_ARG__ -- 2.7.4 From b2186f4e836865701b3efe950b82edbde9002d48 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 13 May 2020 08:51:16 +0900 Subject: [PATCH 10/16] Release version 0.14.2 Changes: - Fix default debugger config file Change-Id: Ib0e6bf9f58568a98e606cc2c3c82b01701910375 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 dc77540..ea794d5 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.14.1 +Version: 0.14.2 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 3943e0952e8b0c6846bca32d5926a058640770f6 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 13 May 2020 16:28:49 +0900 Subject: [PATCH 11/16] Print PSS usage after loading preload libraries Change-Id: I48fb1ee0266ed3624302a8e0f4cfcc7e06c37c40 Signed-off-by: Hwankyu Jhun --- src/{launchpad => common}/inc/launchpad_proc.h | 0 src/{launchpad => common}/src/launchpad_proc.c | 2 -- src/loader/src/launchpad_loader.c | 8 +++++++- 3 files changed, 7 insertions(+), 3 deletions(-) rename src/{launchpad => common}/inc/launchpad_proc.h (100%) rename src/{launchpad => common}/src/launchpad_proc.c (97%) diff --git a/src/launchpad/inc/launchpad_proc.h b/src/common/inc/launchpad_proc.h similarity index 100% rename from src/launchpad/inc/launchpad_proc.h rename to src/common/inc/launchpad_proc.h diff --git a/src/launchpad/src/launchpad_proc.c b/src/common/src/launchpad_proc.c similarity index 97% rename from src/launchpad/src/launchpad_proc.c rename to src/common/src/launchpad_proc.c index daad003..e491cff 100644 --- a/src/launchpad/src/launchpad_proc.c +++ b/src/common/src/launchpad_proc.c @@ -107,7 +107,6 @@ int _proc_get_mem_used_ratio(unsigned int *mem_used_ratio) used = mem_total - mem_available; used_ratio = used * 100 / mem_total; - _I("memory used ratio: %u %%", used_ratio); *mem_used_ratio = used_ratio; @@ -141,7 +140,6 @@ int _proc_get_mem_pss(int pid, unsigned int *mem_pss) } *mem_pss = total_pss; - _I("[%d] PSS: %u kB", pid, total_pss); return 0; } diff --git a/src/loader/src/launchpad_loader.c b/src/loader/src/launchpad_loader.c index fee50e6..b67484d 100644 --- a/src/loader/src/launchpad_loader.c +++ b/src/loader/src/launchpad_loader.c @@ -30,6 +30,7 @@ #include "launchpad_common.h" #include "launchpad_types.h" +#include "launchpad_proc.h" #include "launchpad.h" #include "key.h" @@ -150,6 +151,7 @@ static void __preload_lib(bundle *b) int i; int len = 0; const char **so_array; + unsigned int mem_pss = 0; if (!b) return; @@ -159,6 +161,8 @@ static void __preload_lib(bundle *b) if (!so_array) return; + _proc_get_mem_pss(getpid(), &mem_pss); + _W("PSS: %u kB", mem_pss); for (i = 0; i < len; i++) { if (!so_array[i]) { _E("so_array[%d] is nullptr", i); @@ -174,7 +178,9 @@ static void __preload_lib(bundle *b) _E("failed to load: %s, err: %s", so_array[i], dlerror()); } else { - _D("preload %s# - handle : %p", so_array[i], handle); + _proc_get_mem_pss(getpid(), &mem_pss); + _W("preload %s# - handle : %p, PSS: %u kB", + so_array[i], handle, mem_pss); } } } -- 2.7.4 From 2c51231ff4b4a833fb477b2b7eb12760b304e14f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 14 May 2020 11:17:06 +0900 Subject: [PATCH 12/16] Release version 0.14.3 Changes: - Print PSS usage after loading preload libraries Change-Id: I8ce772cc17fd0ccfa9f0dc3c25a1d6379f5fa5ef 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 ea794d5..40746cc 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.14.2 +Version: 0.14.3 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 0d54ed8af68d2f22c1acb057125f3fc3fd4920c0 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 15 May 2020 16:47:46 +0900 Subject: [PATCH 13/16] Check loader id validation Change-Id: I74f713afdd4ba9c367f4b4a7f9c0a9c2871e3c6c Signed-off-by: Hwankyu Jhun --- src/parser/launchpad_parser_plugin.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/parser/launchpad_parser_plugin.cc b/src/parser/launchpad_parser_plugin.cc index 95deccb..9abaeb2 100644 --- a/src/parser/launchpad_parser_plugin.cc +++ b/src/parser/launchpad_parser_plugin.cc @@ -62,6 +62,13 @@ int LaunchpadParser::WriteToFile(string pkgid) { } bool LaunchpadParser::IsValidId(string loader_id, string pkgid) { + std::string needle("../"); + std::size_t found = loader_id.find(needle); + if (found != std::string::npos) { + _E("Invalid loader_id(%s)", loader_id.c_str()); + return false; + } + ifstream in_file(GetFilePath(loader_id).c_str()); if (!in_file.good()) return true; -- 2.7.4 From e0be4a070cf9a6017db92a5bacdab9871bd38a46 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 15 May 2020 18:39:34 +0900 Subject: [PATCH 14/16] Release version 0.14.4 Changes: - Check loader id validation Change-Id: Ibc5a4184c79c42f3148f7f57627b8ab4d0f6c826 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 40746cc..895aa65 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.14.3 +Version: 0.14.4 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From c42584e660723713aa6896582b7dc37891f9c060 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 18 May 2020 12:38:26 +0900 Subject: [PATCH 15/16] Fix ASAN build issue Change-Id: Ife64bd725926ffac0b1cb4581b1b917ca3dd93bc Signed-off-by: Hwankyu Jhun --- src/hydra/src/launchpad_hydra.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/hydra/src/launchpad_hydra.c b/src/hydra/src/launchpad_hydra.c index f2c7779..3b94555 100644 --- a/src/hydra/src/launchpad_hydra.c +++ b/src/hydra/src/launchpad_hydra.c @@ -252,37 +252,35 @@ static int __handle_sigchld_event(sd_event_source *s, return 0; } -static int __create_client_socket(const char *path) +static int __create_client_socket(int type, int id) { struct sockaddr_un addr = { 0, }; int retry = CONNECT_RETRY_COUNT; int fd; - if (sizeof(addr.sun_path) <= strlen(path)) { - _E("lenght of path is too long"); - return -1; - } - fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); if (fd < 0) { - _E("Failed to create socket(%s). errno(%d)", path, errno); + _E("Failed to create socket(%d:%d). errno(%d)", + type, id, errno); return -1; } addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, path, sizeof(addr.sun_path)); - addr.sun_path[sizeof(addr.sun_path) - 1] = '\0'; + snprintf(addr.sun_path, sizeof(addr.sun_path), + "%s/daemons/%d/%s%d-%d", + SOCKET_PATH, getuid(), HYDRA_LOADER_SOCKET_NAME, + type, id); while (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { if (errno != ETIMEDOUT || retry <= 0) { _E("Failed to connect socket(%s). errno(%d)", - path, errno); + addr.sun_path, errno); close(fd); return -1; } usleep(CONNECT_RETRY_TIME); retry--; - _W("Retry(%d) to connect %s", retry, path); + _W("Retry(%d) to connect %s", retry, addr.sun_path); } return fd; @@ -290,7 +288,6 @@ static int __create_client_socket(const char *path) int __connect_to_launchpad_hydra(int type, int id) { - char path[PATH_MAX]; int fd; int send_ret; pid_t client_pid; @@ -298,10 +295,7 @@ int __connect_to_launchpad_hydra(int type, int id) _D("[hydra] enter, type: %d", type); - snprintf(path, sizeof(path), "%s/daemons/%d/%s%d-%d", - SOCKET_PATH, getuid(), HYDRA_LOADER_SOCKET_NAME, - type, id); - fd = __create_client_socket(path); + fd = __create_client_socket(type, id); if (fd < 0) return -1; -- 2.7.4 From 6d04a1ac515e6efd3db6f0fcf91d4cdd56826730 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 18 May 2020 13:45:32 +0900 Subject: [PATCH 16/16] Release version 0.14.5 Changes: - Fix ASAN build issue Change-Id: Id141f6e85ed86de829437f5a83b678ee70589495 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 895aa65..e39fa09 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.14.4 +Version: 0.14.5 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4