From 03ce03422d3d65f8a5ead86e2bb14b364e6a5ce4 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Thu, 24 Aug 2017 16:17:40 +0900 Subject: [PATCH 01/16] Add requires to launchpad Change-Id: I69d11c13bc633e296833160cb52cf946b57778bf --- packaging/dotnet-launcher.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index 7f4d46c..c9b0b7c 100644 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -21,6 +21,7 @@ BuildRequires: aul-devel BuildRequires: dotnet-build-tools Requires: aul +Requires: launchpad Requires(post): /sbin/ldconfig Requires(post): /usr/bin/systemctl -- 2.7.4 From ab0c34497889634785b9c2c7efbbc5067363c18f Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Mon, 28 Aug 2017 19:01:38 +0900 Subject: [PATCH 02/16] Add null check Change-Id: I94bb4d6f6a3b56e71bc25b7f2a9bf5ba6f233b2c --- NativeLauncher/installer-plugin/common.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index 8ba2a09..74b6f18 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -132,6 +132,10 @@ static void crossgen(const char* dllPath, const char* appPath) // get reference API directory ([DEVICE_API_DIR]/ref) int len = strlen(__DEVICE_API_DIR); char* refAPIDir = (char*)calloc(len + 4, 1); + if (!refAPIDir) { + printf("fail to allocate memory for reference API directory\n"); + return; + } snprintf(refAPIDir, len + 4, "%s%s", __DEVICE_API_DIR, "/ref"); tpaDir.push_back(refAPIDir); -- 2.7.4 From 91c9d05a8aa766d359443f478f6b00fbf4359c93 Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Wed, 30 Aug 2017 15:25:45 +0900 Subject: [PATCH 03/16] change cmdline to executable path for standalone mode. after adapting this change, crash dump will be generated with executable name not dotnet-launcher Change-Id: I1052f2d8740f6d51dff978871252e2cbe10a1d63 --- NativeLauncher/launcher/main.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index b5e566c..b532832 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -44,7 +44,8 @@ int main(int argc, char *argv[]) { int i; bool standalone = false; - const char* standalonePath = nullptr; + char* standalonePath = nullptr; + int cmdlineSize = 0; std::vector vargs; @@ -61,10 +62,11 @@ int main(int argc, char *argv[]) return 1; } i++; - standalonePath = argv[i]; + standalonePath = strdup(argv[i]); } else { vargs.push_back(argv[i]); } + cmdlineSize += (strlen(argv[i]) +1); } using tizen::runtime::LauncherInterface; @@ -97,6 +99,10 @@ int main(int argc, char *argv[]) return 1; } + // change cmdline from dotnet-launcher to executable path + memset(argv[0], '\0', cmdlineSize); + snprintf(argv[0], cmdlineSize, "%s", standalonePath); + int argsLen = vargs.size(); char** args = &vargs[0]; if (runtime->launch(appId, appRoot.c_str(), standalonePath, argsLen, args)) { @@ -126,6 +132,10 @@ int main(int argc, char *argv[]) Launchpad.loaderMain(argc, argv); } + if (standalonePath != nullptr) { + free(standalonePath); + } + runtime->dispose(); return 0; } -- 2.7.4 From 8564ec92b5775026190ed190e81b272324fda4de Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Tue, 5 Sep 2017 08:58:51 +0900 Subject: [PATCH 04/16] bug-fix: to pass argument, change exectuable name to appid Change-Id: I1873bec7879c97c449060b98c895d8437a3a45f4 --- NativeLauncher/launcher/main.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index b532832..a3ad62b 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -37,6 +37,8 @@ #define LAUNCHER_VERSION_STR __STR(VERSION) #endif +#define CMD_LINE_SIZE 24 // sizeof("/usr/bin/dotnet-launcher") + static std::string VersionOption("--version"); static std::string StandaloneOption("--standalone"); @@ -45,7 +47,6 @@ int main(int argc, char *argv[]) int i; bool standalone = false; char* standalonePath = nullptr; - int cmdlineSize = 0; std::vector vargs; @@ -62,11 +63,10 @@ int main(int argc, char *argv[]) return 1; } i++; - standalonePath = strdup(argv[i]); + standalonePath = argv[i]; } else { vargs.push_back(argv[i]); } - cmdlineSize += (strlen(argv[i]) +1); } using tizen::runtime::LauncherInterface; @@ -100,8 +100,8 @@ int main(int argc, char *argv[]) } // change cmdline from dotnet-launcher to executable path - memset(argv[0], '\0', cmdlineSize); - snprintf(argv[0], cmdlineSize, "%s", standalonePath); + memset(argv[0], '\0', CMD_LINE_SIZE); + snprintf(argv[0], CMD_LINE_SIZE - 1, "%s", appId); int argsLen = vargs.size(); char** args = &vargs[0]; @@ -132,10 +132,6 @@ int main(int argc, char *argv[]) Launchpad.loaderMain(argc, argv); } - if (standalonePath != nullptr) { - free(standalonePath); - } - runtime->dispose(); return 0; } -- 2.7.4 From 02b56823ba57974509ecdee6f93903f8e3a2a42e Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Tue, 5 Sep 2017 08:58:51 +0900 Subject: [PATCH 05/16] bug-fix: to pass argument, change exectuable name to appid Change-Id: I1873bec7879c97c449060b98c895d8437a3a45f4 (cherry picked from commit 8564ec92b5775026190ed190e81b272324fda4de) --- NativeLauncher/launcher/main.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index b532832..a3ad62b 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -37,6 +37,8 @@ #define LAUNCHER_VERSION_STR __STR(VERSION) #endif +#define CMD_LINE_SIZE 24 // sizeof("/usr/bin/dotnet-launcher") + static std::string VersionOption("--version"); static std::string StandaloneOption("--standalone"); @@ -45,7 +47,6 @@ int main(int argc, char *argv[]) int i; bool standalone = false; char* standalonePath = nullptr; - int cmdlineSize = 0; std::vector vargs; @@ -62,11 +63,10 @@ int main(int argc, char *argv[]) return 1; } i++; - standalonePath = strdup(argv[i]); + standalonePath = argv[i]; } else { vargs.push_back(argv[i]); } - cmdlineSize += (strlen(argv[i]) +1); } using tizen::runtime::LauncherInterface; @@ -100,8 +100,8 @@ int main(int argc, char *argv[]) } // change cmdline from dotnet-launcher to executable path - memset(argv[0], '\0', cmdlineSize); - snprintf(argv[0], cmdlineSize, "%s", standalonePath); + memset(argv[0], '\0', CMD_LINE_SIZE); + snprintf(argv[0], CMD_LINE_SIZE - 1, "%s", appId); int argsLen = vargs.size(); char** args = &vargs[0]; @@ -132,10 +132,6 @@ int main(int argc, char *argv[]) Launchpad.loaderMain(argc, argv); } - if (standalonePath != nullptr) { - free(standalonePath); - } - runtime->dispose(); return 0; } -- 2.7.4 From b72b8f28e67769724ad661e7a3ef1744627559a4 Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Thu, 7 Sep 2017 10:43:51 +0900 Subject: [PATCH 06/16] update launching time measure tool Change-Id: Ie8c1e2ea9cb8d89f8d8ddaf2cf6485f902147a88 --- tools/performance_test.sh | 10 +++++----- tools/timestamp.sh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/performance_test.sh b/tools/performance_test.sh index 43b7962..ed289fb 100755 --- a/tools/performance_test.sh +++ b/tools/performance_test.sh @@ -132,7 +132,7 @@ execute_time_stamp_auto () echo "" #execute dlogstreamer sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done]'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -145,7 +145,7 @@ execute_time_stamp_auto_memory () echo "[>] Start performance test that applciation launching memory" echo "" sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -164,7 +164,7 @@ execute_time_stamp_manual () rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE @@ -181,7 +181,7 @@ execute_time_stamp_manual_trace () rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -202,7 +202,7 @@ execute_time_stamp_manual_memory () rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & diff --git a/tools/timestamp.sh b/tools/timestamp.sh index 8d94aad..5b6ae2b 100755 --- a/tools/timestamp.sh +++ b/tools/timestamp.sh @@ -35,9 +35,9 @@ while inotifywait -qqre modify "$LOG_FILE"; do fi fi - if [[ $GET_LOG == *APP_CORE* ]] && [ "$IS_START" = true ] + if [[ $GET_LOG == *"LAUNCH"* ]] && [ "$IS_START" = true ] then - END_T=$(echo "$GET_LOG" | grep SHOW | awk '{print $2}') + END_T=$(echo "$GET_LOG" | grep Launching | awk '{print $2}') END_T=${END_T%%+0900} END_T=$(echo $END_T | sed "s/:/./g") -- 2.7.4 From 6467e185cd4a1b721ad71ac419697e381eb8115d Mon Sep 17 00:00:00 2001 From: woongsuk cho Date: Wed, 13 Sep 2017 01:43:57 +0000 Subject: [PATCH 07/16] Revert "temporal patch for setting LANG environment value" This reverts commit c9e5d8e142aa02dfeffe1d31ff819fffd899ae5a. Change-Id: I0f09e4cedbbd0c1889d59f1d2a98c45261a7a6b8 --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index b268357..6adff4b 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -21,8 +21,6 @@ #include #include -#include - #include "utils.h" #include "log.h" #include "launcher.h" @@ -290,27 +288,8 @@ void CoreRuntime::dispose() _DBG("Dotnet runtime disposed"); } -static void setLang() -{ - char *lang; - lang = vconf_get_str(VCONFKEY_LANGSET); - if (lang) { - _DBG("setenv for language setting : %s", lang); - setenv("LANG", lang, 1); - setenv("LC_MESSAGES", lang, 1); - } -} - int CoreRuntime::launch(const char* appId, const char* root, const char* path, int argc, char* argv[]) { - // temporal patch to set LANG for coreclr. - // below code will be removed after applying appfw patch. - setLang(); - - vconf_notify_key_changed(VCONFKEY_LANGSET, [](keynode_t* node, void* user_data) { - setLang(); - }, NULL); - if (path == nullptr) { _ERR("executable path is null"); return 1; -- 2.7.4 From 3f04bea75943d9cb11c1bf861ade7993e0ff74d4 Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Mon, 25 Sep 2017 16:15:23 +0900 Subject: [PATCH 08/16] fix build warning Change-Id: I67138414a61ba4594920830b4ad95e3f72b62e23 --- NativeLauncher/installer-plugin/common.cc | 2 ++ Tizen.Runtime/CoreClr/AssemblyManager.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index 74b6f18..4d5feeb 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -64,6 +64,7 @@ static const char* __JIT_PATH = __STR(RUNTIME_DIR)"/libclrjit.so"; #undef __XSTR +#if 0 static std::string replace(std::string &str, const std::string& from, const std::string& to) { size_t startPos = 0; @@ -73,6 +74,7 @@ static std::string replace(std::string &str, const std::string& from, const std: } return str; } +#endif static void smack_(const char* dllPath, const char* label) { diff --git a/Tizen.Runtime/CoreClr/AssemblyManager.cs b/Tizen.Runtime/CoreClr/AssemblyManager.cs index d8b19f5..60b3e54 100644 --- a/Tizen.Runtime/CoreClr/AssemblyManager.cs +++ b/Tizen.Runtime/CoreClr/AssemblyManager.cs @@ -96,8 +96,8 @@ namespace Tizen.Runtime.Coreclr { try { - /// Set UnhandledException handler with reflection - /// we must replace this to no reflection method after AppDomain is comming in used net standard + // Set UnhandledException handler with reflection + // we must replace this to no reflection method after AppDomain is comming in used net standard TypeInfo appdomainType = Type.GetType("System.AppDomain").GetTypeInfo(); PropertyInfo currentDomain = appdomainType.GetProperty("CurrentDomain", BindingFlags.Public | BindingFlags.Static); -- 2.7.4 From 8880e9c986ae1d0037ef812e0b2f59981a96e804 Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Thu, 12 Oct 2017 14:01:10 +0900 Subject: [PATCH 09/16] add plugin api to set coreclr info Change-Id: I83f76c7cfbb939e6b397150db1675c41e264b7fb --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 6 ++++++ NativeLauncher/launcher/dotnet/dotnet_launcher.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 6adff4b..7734df5 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -46,6 +46,7 @@ CoreRuntime::CoreRuntime() : pluginInitialize(nullptr), pluginPreload(nullptr), pluginSetAppInfo(nullptr), + pluginSetCoreclrInfo(nullptr), pluginGetDllPath(nullptr), pluginBeforeExecute(nullptr), pluginFinalize(nullptr) @@ -79,6 +80,7 @@ CoreRuntime::CoreRuntime() : pluginInitialize = (plugin_initialize_ptr)dlsym(__pluginLib, "plugin_initialize"); pluginPreload = (plugin_preload_ptr)dlsym(__pluginLib, "plugin_preload"); pluginSetAppInfo = (plugin_set_app_info_ptr)dlsym(__pluginLib, "plugin_set_app_info"); + pluginSetCoreclrInfo = (plugin_set_coreclr_info_ptr)dlsym(__pluginLib, "plugin_set_coreclr_info"); pluginGetDllPath = (plugin_get_dll_path_ptr)dlsym(__pluginLib, "plugin_get_dll_path"); pluginBeforeExecute = (plugin_before_execute_ptr)dlsym(__pluginLib, "plugin_before_execute"); pluginFinalize = (plugin_finalize_ptr)dlsym(__pluginLib, "plugin_finalize"); @@ -211,6 +213,9 @@ bool CoreRuntime::initializeCoreClr(const char* appId, return false; } + if (pluginSetCoreclrInfo) + pluginSetCoreclrInfo(__hostHandle, __domainId); + _DBG("Initialize core clr success"); return true; } @@ -280,6 +285,7 @@ void CoreRuntime::dispose() pluginInitialize = nullptr; pluginPreload = nullptr; pluginSetAppInfo = nullptr; + pluginSetCoreclrInfo = nullptr; pluginGetDllPath = nullptr; pluginBeforeExecute = nullptr; pluginFinalize = nullptr; diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.h b/NativeLauncher/launcher/dotnet/dotnet_launcher.h index 931846c..aaaa9d8 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.h +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.h @@ -56,7 +56,11 @@ extern "C" typedef void (*plugin_set_app_info_ptr)( const char* appId, - const char* hostHandle); + const char* managedAssemblyPath); + + typedef void (*plugin_set_coreclr_info_ptr)( + void* hostHandle, + unsigned int domainId); typedef char* (*plugin_get_dll_path_ptr)(); @@ -103,6 +107,7 @@ class CoreRuntime : public tizen::runtime::LauncherInterface plugin_initialize_ptr pluginInitialize; plugin_preload_ptr pluginPreload; plugin_set_app_info_ptr pluginSetAppInfo; + plugin_set_coreclr_info_ptr pluginSetCoreclrInfo; plugin_get_dll_path_ptr pluginGetDllPath; plugin_before_execute_ptr pluginBeforeExecute; plugin_finalize_ptr pluginFinalize; -- 2.7.4 From 5df12f517493615cd2aee051add7bb307c500d1c Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Tue, 17 Oct 2017 09:20:23 +0900 Subject: [PATCH 10/16] remove unneccessary log to remove warning message Change-Id: Icc79f0550ce69e266b00f1c95aeb029ea6579807 --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 2 -- NativeLauncher/launcher/launcher.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 6adff4b..682d532 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -166,8 +166,6 @@ int CoreRuntime::initialize(bool standalone) #undef CORELIB_RETURN_IF_NOSYM _DBG("libcoreclr dlopen and dlsym success"); - _DBG("this addr : %x", this); - _DBG("coreclr_initialize : %x", initializeClr); if (!standalone && pluginPreload) pluginPreload(); diff --git a/NativeLauncher/launcher/launcher.cc b/NativeLauncher/launcher/launcher.cc index 91ccb02..aaeefd6 100644 --- a/NativeLauncher/launcher/launcher.cc +++ b/NativeLauncher/launcher/launcher.cc @@ -143,7 +143,7 @@ static void preloadLibsAndWindow(bundle *extra, int type, void *userData) for (i = 0; i < len; i++) { handle = dlopen(soArray[i], RTLD_NOW); - _DBG("preload %s# - handle : %x", soArray[i], handle); + _DBG("preload %s#", soArray[i]); } // Precreate window -- 2.7.4 From 1a2aa15b1a961dcd54c46883356351e8b84bc8fb Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Thu, 2 Nov 2017 19:10:41 +0900 Subject: [PATCH 11/16] big-fix: add reference dll for NI Change-Id: Ia974ecd5469ff152204f6cf7c8adaa693b488088 (cherry picked from commit 195453317830e9b517950a6153e078f91f1e7500) --- NativeLauncher/installer-plugin/common.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index 4d5feeb..f84e79c 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -133,12 +133,12 @@ static void crossgen(const char* dllPath, const char* appPath) // get reference API directory ([DEVICE_API_DIR]/ref) int len = strlen(__DEVICE_API_DIR); - char* refAPIDir = (char*)calloc(len + 4, 1); + char* refAPIDir = (char*)calloc(len + 5, 1); if (!refAPIDir) { printf("fail to allocate memory for reference API directory\n"); return; } - snprintf(refAPIDir, len + 4, "%s%s", __DEVICE_API_DIR, "/ref"); + snprintf(refAPIDir, len + 5, "%s%s", __DEVICE_API_DIR, "/ref"); tpaDir.push_back(refAPIDir); std::string tpa; -- 2.7.4 From 2257c6b542c3bbf76619f60093fb9ee78631735f Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Wed, 23 Aug 2017 11:33:23 +0900 Subject: [PATCH 12/16] comment out unused code and change log Change-Id: I944f7ad3320bd5a15d20332ba1934fc60b162a42 --- NativeLauncher/installer-plugin/common.cc | 1 - NativeLauncher/launcher/main.cc | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index f84e79c..f7fc71b 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -63,7 +63,6 @@ static const char* __JIT_PATH = __STR(RUNTIME_DIR)"/libclrjit.so"; #undef __STR #undef __XSTR - #if 0 static std::string replace(std::string &str, const std::string& from, const std::string& to) { diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index a3ad62b..0922908 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) std::vector vargs; // start index 1 to avoid passing executable name "dotnet-launcher" as a parameter - for (i = 1; i launch(appId, appRoot.c_str(), standalonePath, argsLen, args)) { _ERR("Failed to launch"); - return 0; + return 1; } } else { Launchpad.onCreate = [&runtime]() { @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) }; Launchpad.onTerminate = [&runtime](const AppInfo& appInfo, int argc, char** argv) { - _DBG("terminated with app path : %s", appInfo.path.c_str()); + _DBG("launch request with app path : %s", appInfo.path.c_str()); _DBG("appId : %s", appInfo.id.c_str()); _DBG("pkg : %s", appInfo.pkg.c_str()); _DBG("type : %s", appInfo.type.c_str()); -- 2.7.4 From 14af36a2752af7008cb985f6e60e700e25b8282c Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Wed, 23 Aug 2017 15:24:40 +0900 Subject: [PATCH 13/16] check return value of loaderMain to avoid crash Change-Id: Ib5a740a34c7f8b171fb890dc1f97c51e93ad647d --- NativeLauncher/launcher/launcher.cc | 7 ++++--- NativeLauncher/launcher/launcher.h | 2 +- NativeLauncher/launcher/main.cc | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NativeLauncher/launcher/launcher.cc b/NativeLauncher/launcher/launcher.cc index aaeefd6..91c24a1 100644 --- a/NativeLauncher/launcher/launcher.cc +++ b/NativeLauncher/launcher/launcher.cc @@ -53,7 +53,7 @@ class LaunchpadAdapterImpl : public LaunchpadAdapter launcher(nullptr), __isLaunched(false) { } - void loaderMain(int argc, char* argv[]) override; + int loaderMain(int argc, char* argv[]) override; std::map handlers; @@ -161,7 +161,7 @@ static void preloadLibsAndWindow(bundle *extra, int type, void *userData) elm_win_precreated_object_set(__win); } -void LaunchpadAdapterImpl::loaderMain(int argc, char* argv[]) +int LaunchpadAdapterImpl::loaderMain(int argc, char* argv[]) { __argc = argc; __argv = argv; @@ -189,7 +189,6 @@ void LaunchpadAdapterImpl::loaderMain(int argc, char* argv[]) return 0; }; callbacks.terminate = [](int argc, char **argv, void* userData) -> int { - _DBG("Terminate!!"); WITH_SELF(userData) { if (self->onTerminate != nullptr) self->onTerminate(self->appInfo, argc, argv); @@ -210,6 +209,8 @@ void LaunchpadAdapterImpl::loaderMain(int argc, char* argv[]) _DBG("launchpad_loader_main is start"); int r = launchpad_loader_main(argc, argv, &(this->callbacks), &(this->adapter), this); _DBG("launchpad_loader_main is finished with [%d]", r); + + return r; } #undef WITH_SELF diff --git a/NativeLauncher/launcher/launcher.h b/NativeLauncher/launcher/launcher.h index 41ed2ac..ce91241 100644 --- a/NativeLauncher/launcher/launcher.h +++ b/NativeLauncher/launcher/launcher.h @@ -43,7 +43,7 @@ struct AppInfo { class LaunchpadAdapter { public: - virtual void loaderMain(int argc, char* argv[]) = 0; + virtual int loaderMain(int argc, char* argv[]) = 0; std::function onCreate = nullptr; std::function onLaunch = nullptr; std::function onTerminate = nullptr; diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index 0922908..6fcfb9b 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -129,7 +129,11 @@ int main(int argc, char *argv[]) if (runtime->launch(appInfo.id.c_str(), appInfo.root.c_str(), appInfo.path.c_str(), argc-1, argv+1)) _ERR("Failed to launch"); }; - Launchpad.loaderMain(argc, argv); + int ret = Launchpad.loaderMain(argc, argv); + if (ret < 0) { + _DBG("fail to start loaderMain. candidate process is not created."); + return 1; + } } runtime->dispose(); -- 2.7.4 From 2169c2f2e0c92929f20ba81c4eb0dcd43819a71c Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Fri, 8 Sep 2017 11:24:07 +0900 Subject: [PATCH 14/16] bug-patch:support -am option Change-Id: I3e71bef55eea848e52bf4b417ddcab582b3421f0 --- tools/performance_test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/performance_test.sh b/tools/performance_test.sh index ed289fb..3519cc4 100755 --- a/tools/performance_test.sh +++ b/tools/performance_test.sh @@ -132,7 +132,7 @@ execute_time_stamp_auto () echo "" #execute dlogstreamer sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -145,7 +145,7 @@ execute_time_stamp_auto_memory () echo "[>] Start performance test that applciation launching memory" echo "" sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|Launching:done'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -181,7 +181,7 @@ execute_time_stamp_manual_trace () rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|Launching:done'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -202,7 +202,7 @@ execute_time_stamp_manual_memory () rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|Launching:done'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL LAUNCH|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|Launching:done'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & -- 2.7.4 From b8364639ea341f44381271cc186c4299c317f5a3 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Wed, 19 Jul 2017 14:49:39 +0900 Subject: [PATCH 15/16] Remove caps due to security issue. Apply caps directly in security-config Change-Id: I476d6928065762427d360e22518bf8330266808f --- packaging/dotnet-launcher.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index c9b0b7c..d4045f2 100644 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -99,4 +99,3 @@ ln -sf %{_libdir}/libsqlite3.so.0 %{buildroot}%{_native_lib_dir}/libsqlite3.so %if %{use_managed_launcher} %{_bindir}/Tizen.Runtime.dll %endif -%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/dotnet-launcher -- 2.7.4 From 1f4fe78e4b16ccff778af75592a77f85cca11d5b Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Fri, 3 Nov 2017 13:30:12 +0900 Subject: [PATCH 16/16] add dotnet-launcher to files list to remove build error Change-Id: I88b3dab1dff4a7e30bfe1e6dfaee06b2d8edaf6b --- packaging/dotnet-launcher.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index d4045f2..1bebcca 100644 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -99,3 +99,4 @@ ln -sf %{_libdir}/libsqlite3.so.0 %{buildroot}%{_native_lib_dir}/libsqlite3.so %if %{use_managed_launcher} %{_bindir}/Tizen.Runtime.dll %endif +%{_bindir}/dotnet-launcher \ No newline at end of file -- 2.7.4