libvirt/src/rpc
Jiri Denemark d8d4aa01d8 rpc: Fix client crash when server drops connection
Despite the comment stating virNetClientIncomingEvent handler should
never be called with either client->haveTheBuck or client->wantClose
set, there is a sequence of events that may lead to both booleans being
true when virNetClientIncomingEvent is called. However, when that
happens, we must not immediately close the socket as there are other
threads waiting for the buck and they would cause SIGSEGV once they are
woken up after the socket was closed. Another thing is we should clear
all remaining calls in the queue after closing the socket.

The situation that can lead to the crash involves three threads, one of
them running event loop and the other two calling libvirt APIs. The
event loop thread detects an event on client->sock and calls
virNetClientIncomingEvent handler. But before the handler gets a chance
to lock client, the other two threads (T1 and T2) start calling some
APIs. T1 gets the buck and detects EOF on client->sock while processing
its RPC call. Since T2 is waiting for its own call, T1 passes the buck
on to it and unlocks client. But before T2 gets the signal, the event
loop thread wakes up, does its job and closes client->sock. The crash
happens when T2 actually wakes up and tries to do its job using a closed
client->sock.
2013-03-27 09:00:38 +01:00
..
gendispatch.pl remote: Auto-allocate params in remoteDeserializeTypedParameters 2013-02-22 17:35:58 +01:00
genprotocol.pl Remove tabs from all perl files & enforce this 2012-07-30 13:09:57 +01:00
gensystemtap.pl Fix generation of systemtap probes for RPC protocols 2013-03-14 12:42:22 +00:00
virkeepalive.c Re-add DTrace probes on 'dispose' functions 2013-03-14 12:42:21 +00:00
virkeepalive.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virkeepaliveprotocol.x Define keepalive protocol 2011-11-24 11:44:08 +01:00
virnetclient.c rpc: Fix client crash when server drops connection 2013-03-27 09:00:38 +01:00
virnetclient.h Rename 'daemon' param to 'binary' in virNetClientNewUNIX 2013-03-07 18:06:59 +00:00
virnetclientprogram.c Allow for multi-level inheritance of virObject classes 2013-01-15 19:21:31 +00:00
virnetclientprogram.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetclientstream.c Convert all rpc classes over to virObjectLockable 2013-01-16 11:02:58 +00:00
virnetclientstream.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetmessage.c Fix receiving of file descriptors from server 2013-01-08 08:56:49 +00:00
virnetmessage.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetprotocol.x maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetsaslcontext.c Convert all rpc classes over to virObjectLockable 2013-01-16 11:02:58 +00:00
virnetsaslcontext.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetserver.c rpc: Avoid deadlock when closing client connection 2013-02-19 10:52:37 +01:00
virnetserver.h Rename HAVE_GNUTLS to WITH_GNUTLS 2013-01-14 13:26:47 +00:00
virnetserverclient.c fix TLS error with virNetServerClientCreateIdentity 2013-03-19 20:57:08 -06:00
virnetserverclient.h Add ability to get a virIdentity from a virNetServerClientPtr 2013-03-19 13:52:02 +00:00
virnetservermdns.c Convert HAVE_AVAHI to WITH_AVAHI 2013-01-14 13:26:34 +00:00
virnetservermdns.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetserverprogram.c Set the current client identity during API call dispatch 2013-03-19 13:52:06 +00:00
virnetserverprogram.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetserverservice.c Allow for multi-level inheritance of virObject classes 2013-01-15 19:21:31 +00:00
virnetserverservice.h Rename HAVE_GNUTLS to WITH_GNUTLS 2013-01-14 13:26:47 +00:00
virnetsocket.c Don't fail if SELinux is diabled 2013-03-20 21:04:57 +01:00
virnetsocket.h Add APIs to get at more client security data 2013-03-19 13:11:46 +00:00
virnetsshsession.c Convert all rpc classes over to virObjectLockable 2013-01-16 11:02:58 +00:00
virnetsshsession.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnettlscontext.c Add APIs to get at more client security data 2013-03-19 13:11:46 +00:00
virnettlscontext.h Add APIs to get at more client security data 2013-03-19 13:11:46 +00:00