From 5b734248ec9f92af3158489ea2b729bed620d44a Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Tue, 17 Jul 2018 16:13:28 +0900 Subject: [PATCH] call plugin_initialize before mainloop start Change-Id: Id493273c8e5c9cee92c77d2e8779eae9ed6030b2 --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 14 ++++++++------ NativeLauncher/launcher/dotnet/dotnet_launcher.h | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 0fb373a..676029c 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -92,10 +92,17 @@ CoreRuntime::CoreRuntime(const char* mode) : __hostHandle(nullptr), __domainId(-1), fd(0), - __mode(mode), __initialized(false) { _DBG("Constructor called!!"); + + // plugin initialize should be called before start loader mainloop. + // In case of VD plugins, attaching secure zone is done in the plugin_initialize(). + // When attaching to a secure zone, if there is a created thread, it will failed. + // So, plugin initialize should be called before mainloop start. + if (initializePluginManager(mode) < 0) { + _ERR("Failed to initialize PluginManager"); + } } CoreRuntime::~CoreRuntime() @@ -129,11 +136,6 @@ int CoreRuntime::initialize(bool standalone) putenv(const_cast("UNW_ARM_UNWIND_METHOD=6")); #endif // __arm__ - if (initializePluginManager(__mode) < 0) { - _ERR("Failed to initialize PluginManager"); - return -1; - } - if (initializePathManager(std::string(), std::string(), std::string()) < 0) { _ERR("Failed to initialize PathManager"); return -1; diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.h b/NativeLauncher/launcher/dotnet/dotnet_launcher.h index 647640a..6d32a77 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.h +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.h @@ -45,7 +45,6 @@ class CoreRuntime void* __hostHandle; unsigned int __domainId; int fd; - const char* __mode; bool __initialized; }; -- 2.7.4