From b12b9fa91e3be0d4d157f144f4b20202cdb72917 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Thu, 23 Aug 2012 19:51:55 +0400 Subject: [PATCH] Suspend DF around loading and unloading plugins. This is necessary to improve safety of vtable interposing. --- library/Core.cpp | 1 + library/PluginManager.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/library/Core.cpp b/library/Core.cpp index 71c92afea..a61fef4e9 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1225,6 +1225,7 @@ int Core::Shutdown ( void ) if(errorstate) return true; errorstate = 1; + CoreSuspendClaimer suspend; if(plug_mgr) { delete plug_mgr; diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index 3c015b2a7..d8b9ff27d 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -195,6 +195,9 @@ bool Plugin::load(color_ostream &con) { return true; } + // enter suspend + CoreSuspender suspend; + // open the library, etc DFLibrary * plug = OpenPlugin(filename.c_str()); if(!plug) { @@ -270,6 +273,8 @@ bool Plugin::unload(color_ostream &con) } // wait for all calls to finish access->wait(); + // enter suspend + CoreSuspender suspend; // notify plugin about shutdown, if it has a shutdown function command_result cr = CR_OK; if(plugin_shutdown)