1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00
libvirt/daemon
Jiri Denemark f44bfb7fb9 Make error reporting in libvirtd thread safe
Bug https://bugzilla.redhat.com/show_bug.cgi?id=689374 reported libvirtd
crash during error dispatch.

The reason is that libvirtd uses remoteDispatchConnError() with non-NULL
conn parameter which means that virConnGetLastError() is used instead of
its thread safe replacement virGetLastError().

So when several libvirtd threads are reporting errors at the same time,
the errors can get mixed or corrupted or in case of bad luck libvirtd
itself crashes.

Since Daniel B. is going to rewrite this code from scratch on top of his
RPC infrastructure, I tried to come up with a minimal fix. Thus,
remoteDispatchConnError() now just ignores its conn argument and always
calls virGetLastError(). However, several callers had to be touched as
well, since no libvirt API is allowed to be called before dispatching
the error. Doing so would reset the error and we would have nothing to
dispatch. As a result of that, the code is not very nice but that
doesn't really make daemon/remote.c worse than it is now :-) And it will
all die soon, which is good.

The bug report also contains a reproducer in C which detects both mixed
up error messages and libvirtd crash. Before this patch, I was able to
crash libvirtd in about 20 seconds up to 3 minutes depending on number
of CPU cores (more is better) and luck.
2011-03-24 09:39:50 +01:00
..
.gitignore build: don't require pod2man for tarball builds 2011-02-21 09:27:05 -07:00
dispatch.c Make error reporting in libvirtd thread safe 2011-03-24 09:39:50 +01:00
dispatch.h Remote driver & daemon impl of new event API 2010-03-26 13:52:29 +00:00
libvirtd.aug Basic framework for auditing integration 2010-10-19 17:31:31 +01:00
libvirtd.c Add libxenlight driver 2011-03-18 08:57:48 -06:00
libvirtd.conf Allow to dynamically set the size of the debug buffer 2011-03-15 15:13:21 +08:00
libvirtd.h maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
libvirtd.init.in daemon: Export SDL audio environment variables 2010-05-21 12:48:34 -04:00
libvirtd.logrotate.in Add logrotate support for libvirtd.log 2011-03-04 22:43:55 +08:00
libvirtd.lxc.logrotate.in Change logrotate to be per-hypervisor logs 2010-03-10 11:27:02 +01:00
libvirtd.pod.in docs: removed outdated reference to virt-mem 2010-11-23 01:11:10 +11:00
libvirtd.policy-0 Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.policy-1 Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.qemu.logrotate.in Change logrotate to be per-hypervisor logs 2010-03-10 11:27:02 +01:00
libvirtd.sasl Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.stp Include socket address in client probe data 2010-10-22 12:00:45 +01:00
libvirtd.sysconf daemon: sysconf: Update comment about VNC audio 2010-05-26 10:51:36 -04:00
libvirtd.uml.logrotate.in Change logrotate to be per-hypervisor logs 2010-03-10 11:27:02 +01:00
Makefile.am Add libxenlight driver 2011-03-18 08:57:48 -06:00
mdns.c Move event code out of the daemon/ into src/util/ 2011-03-07 14:16:13 +00:00
mdns.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
probes.d Include socket address in client probe data 2010-10-22 12:00:45 +01:00
qemu_dispatch_args.h Qemu remote protocol. 2010-07-23 17:30:33 -04:00
qemu_dispatch_prototypes.h Qemu remote protocol. 2010-07-23 17:30:33 -04:00
qemu_dispatch_ret.h Qemu remote protocol. 2010-07-23 17:30:33 -04:00
qemu_dispatch_table.h Qemu remote protocol. 2010-07-23 17:30:33 -04:00
remote_dispatch_args.h Wire up virDomainMigrateSetSpeed for the remote RPC driver 2011-03-22 15:53:08 +00:00
remote_dispatch_prototypes.h Wire up virDomainMigrateSetSpeed for the remote RPC driver 2011-03-22 15:53:08 +00:00
remote_dispatch_ret.h remote-protocol: implement new BlkioParameters API 2011-03-10 17:54:12 -07:00
remote_dispatch_table.h Wire up virDomainMigrateSetSpeed for the remote RPC driver 2011-03-22 15:53:08 +00:00
remote_generate_stubs.pl Qemu remote protocol. 2010-07-23 17:30:33 -04:00
remote.c Make error reporting in libvirtd thread safe 2011-03-24 09:39:50 +01:00
remote.h Ensure remote daemon unions are always non-zero length 2010-09-10 11:14:51 +01:00
stream.c maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
stream.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
test_libvirtd.aug qemu: fix augeas support for vnc_auto_unix_socket 2011-01-28 15:28:30 -07:00
THREADING.txt Move libvirtd event loop into background thread 2009-11-03 14:45:43 -05:00