mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
f44bfb7fb9
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. |
||
---|---|---|
.. | ||
.gitignore | ||
dispatch.c | ||
dispatch.h | ||
libvirtd.aug | ||
libvirtd.c | ||
libvirtd.conf | ||
libvirtd.h | ||
libvirtd.init.in | ||
libvirtd.logrotate.in | ||
libvirtd.lxc.logrotate.in | ||
libvirtd.pod.in | ||
libvirtd.policy-0 | ||
libvirtd.policy-1 | ||
libvirtd.qemu.logrotate.in | ||
libvirtd.sasl | ||
libvirtd.stp | ||
libvirtd.sysconf | ||
libvirtd.uml.logrotate.in | ||
Makefile.am | ||
mdns.c | ||
mdns.h | ||
probes.d | ||
qemu_dispatch_args.h | ||
qemu_dispatch_prototypes.h | ||
qemu_dispatch_ret.h | ||
qemu_dispatch_table.h | ||
remote_dispatch_args.h | ||
remote_dispatch_prototypes.h | ||
remote_dispatch_ret.h | ||
remote_dispatch_table.h | ||
remote_generate_stubs.pl | ||
remote.c | ||
remote.h | ||
stream.c | ||
stream.h | ||
test_libvirtd.aug | ||
THREADING.txt |