Libvirt provides a portable, long term stable C API for managing the virtualization technologies provided by many operating systems. It includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.
Go to file
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
.gnulib@422ab2e0d7 build: nuke all .x-sc* files, and fix VPATH syntax-check 2011-03-23 15:51:32 -06:00
daemon Make error reporting in libvirtd thread safe 2011-03-24 09:39:50 +01:00
docs docs: Document first release with spice and qxl 2011-03-21 11:05:53 -04:00
examples maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
include Add public API for setting migration speed on the fly 2011-03-22 15:53:08 +00:00
m4 maint: update to latest gnulib 2010-11-17 10:13:12 -07:00
po build: translate changes in previous patch 2011-03-18 11:05:34 -06:00
python python: Use hardcoded python path in libvirt.py 2011-03-14 12:37:19 +01:00
src update domain status forcibly even if attach a device failed 2011-03-24 15:26:28 +08:00
tests Move event code out of the daemon/ into src/util/ 2011-03-07 14:16:13 +00:00
tools virsh: allow empty string arguments 2011-03-15 14:33:54 -06:00
.dir-locals.el maint: make spacing in .sh files easier 2011-03-14 21:57:42 -06:00
.gitignore Add vim configuration that makes vim auto-indent code 2011-03-17 17:08:51 -06:00
.gitmodules make .gnulib a submodule 2009-07-08 16:17:51 +02:00
.mailmap maint: update an email address preference 2010-08-10 08:13:22 -06:00
acinclude.m4 maint: turn on gcc logical-op checking 2010-07-28 15:25:36 +02:00
AUTHORS maint: update authors 2011-03-22 08:33:22 -06:00
autobuild.sh autobuild.sh: use VPATH build 2011-02-21 09:27:05 -07:00
autogen.sh build: avoid problems with autogen.sh runs from tarball 2011-02-12 06:28:28 -07:00
bootstrap build: nuke all .x-sc* files, and fix VPATH syntax-check 2011-03-23 15:51:32 -06:00
bootstrap.conf build: nuke all .x-sc* files, and fix VPATH syntax-check 2011-03-23 15:51:32 -06:00
cfg.mk build: nuke all .x-sc* files, and fix VPATH syntax-check 2011-03-23 15:51:32 -06:00
ChangeLog-old generate ChangeLog from git logs into distribution tarball 2009-07-08 16:17:51 +02:00
configure.ac Don't build libxenlight driver for Xen 4.0 2011-03-18 15:35:47 -06:00
COPYING.LIB remove all trailing blank lines 2009-07-16 15:06:42 +02:00
HACKING Add vim configuration that makes vim auto-indent code 2011-03-17 17:08:51 -06:00
libvirt.pc.in * libvirt.pc.in: applied patch from Daniel Berrange to fix --cflags 2006-03-24 13:18:12 +00:00
libvirt.spec.in rpm: add missing dependencies 2011-03-23 11:16:49 -06:00
Makefile.am build: nuke all .x-sc* files, and fix VPATH syntax-check 2011-03-23 15:51:32 -06:00
Makefile.nonreentrant Ban use of all inet_* functions 2010-10-22 11:59:23 +01:00
mingw32-libvirt.spec.in Add dtrace static probes in libvirtd 2010-10-22 12:00:39 +01:00
README Correct typos in the documentation (Atsushi SAKAI) 2008-01-24 10:15:13 +00:00
README-hacking maint: relax git minimum version 2010-02-24 14:29:27 -05:00
TODO Update todo list file to point at bugzilla/website 2010-10-13 16:45:26 +01:00

         LibVirt : simple API for virtualization

  Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). It is free software
available under the GNU Lesser General Public License. Virtualization of
the Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the basic
resources are driven by a Linux instance. The library aim at providing
long term stable C API initially for the Xen paravirtualization but
should be able to integrate other virtualization mechanisms if needed.

Daniel Veillard <veillard@redhat.com>