]> xenbits.xensource.com Git - libvirt.git/commit
Don't crash if a connection closes early
authorJiri Denemark <jdenemar@redhat.com>
Thu, 9 Jan 2014 21:26:40 +0000 (22:26 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 13 Jan 2014 10:09:59 +0000 (11:09 +0100)
commit173c2914734eb5c32df6d35a82bf503e12261bcf
tree9814e4d0ad8cce3a32f92cfaebe4e20de94e8caa
parent53a699a07b118af2cd1c4625588737095c125b2f
Don't crash if a connection closes early

https://bugzilla.redhat.com/show_bug.cgi?id=1047577

When a client closes its connection to libvirtd early during
virConnectOpen, more specifically just after making
REMOTE_PROC_CONNECT_SUPPORTS_FEATURE call to check if
VIR_DRV_FEATURE_PROGRAM_KEEPALIVE is supported without even waiting for
the result, libvirtd may crash due to a race in keep-alive
initialization. Once receiving the REMOTE_PROC_CONNECT_SUPPORTS_FEATURE
call, the daemon's event loop delegates it to a worker thread. In case
the event loop detects EOF on the connection and calls
virNetServerClientClose before the worker thread starts to handle
REMOTE_PROC_CONNECT_SUPPORTS_FEATURE call, client->keepalive will be
disposed by the time virNetServerClientStartKeepAlive gets called from
remoteDispatchConnectSupportsFeature. Because the flow is common for
both authenticated and read-only connections, even unprivileged clients
may cause the daemon to crash.

To avoid the crash, virNetServerClientStartKeepAlive needs to check if
the connection is still open before starting keep-alive protocol.

Every libvirt release since 0.9.8 is affected by this bug.
src/rpc/virnetserverclient.c