]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
[Tools] Fix crash issue when stopping vmtoolsd(vmuser)
authorOliver Kurth <okurth@vmware.com>
Wed, 15 Nov 2017 21:32:55 +0000 (13:32 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 15 Nov 2017 21:32:55 +0000 (13:32 -0800)
When stopping vmtoolsd, the code tries to unload all plugins.  The
signal TOOLS_CORE_SIG_CAPABILITIES is emitted before really starting
to unload plugins.  If the plugin should try to call RpcChannel_Send
while processing the signal and the RPC channel has been shutdown, an
ASSERT is triggered.  The fix is to check whether rpc exists and if
unavailable, avoid sending the TOOLS_CORE_SIG_CAPABILITIES signal.

open-vm-tools/services/vmtoolsd/pluginMgr.c

index 51feecdcf83175b25850b2f377155b5669cecc61..8cd92e9fa0ccd3c0bb4b26a44fb3a5b2ec00c33d 100644 (file)
@@ -877,7 +877,11 @@ ToolsCore_UnloadPlugins(ToolsServiceState *state)
       return;
    }
 
-   if (state->capsRegistered) {
+   /* 
+    * Signal handlers in some plugins may require RPC Channel. Therefore, we don't
+    * emit the signal if RPC channel is not available. See PR 1798412 for details.
+    */
+   if (state->capsRegistered && state->ctx.rpc) {
       GArray *pcaps = NULL;
       g_signal_emit_by_name(state->ctx.serviceObj,
                             TOOLS_CORE_SIG_CAPABILITIES,
@@ -886,9 +890,7 @@ ToolsCore_UnloadPlugins(ToolsServiceState *state)
                             &pcaps);
 
       if (pcaps != NULL) {
-         if (state->ctx.rpc) {
-            ToolsCore_SetCapabilities(state->ctx.rpc, pcaps, FALSE);
-         }
+         ToolsCore_SetCapabilities(state->ctx.rpc, pcaps, FALSE);
          g_array_free(pcaps, TRUE);
       }
    }