From: Oliver Kurth Date: Tue, 24 Oct 2017 21:07:35 +0000 (-0700) Subject: [Tools] Fix crash issue when stopping vmtoolsd(vmuser) X-Git-Tag: stable-10.3.0~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b0af4d8b889eccd0fbc18d63698c95f83be1ca3;p=thirdparty%2Fopen-vm-tools.git [Tools] Fix crash issue when stopping vmtoolsd(vmuser) 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. --- diff --git a/open-vm-tools/services/vmtoolsd/pluginMgr.c b/open-vm-tools/services/vmtoolsd/pluginMgr.c index 51feecdcf..8cd92e9fa 100644 --- a/open-vm-tools/services/vmtoolsd/pluginMgr.c +++ b/open-vm-tools/services/vmtoolsd/pluginMgr.c @@ -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); } }