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
Eric Blake 83e4c77547 cgroup: be robust against cgroup movement races
https://bugzilla.redhat.com/show_bug.cgi?id=965169 documents a
problem starting domains when cgroups are enabled; I was able
to reliably reproduce the race about 5% of the time when I added
hooks to domain startup by 3 seconds (as that seemed to be about
the length of time that qemu created and then closed a temporary
thread, probably related to aio handling of initially opening
a disk image).  The problem has existed since we introduced
virCgroupMoveTask in commit 9102829 (v0.10.0).

There are some inherent TOCTTOU races when moving tasks between
kernel cgroups, precisely because threads can be created or
completed in the window between when we read a thread id from the
source and when we write to the destination.  As the goal of
virCgroupMoveTask is merely to move ALL tasks into the new
cgroup, it is sufficient to iterate until no more threads are
being created in the old group, and ignoring any threads that
die before we can move them.

It would be nicer to start the threads in the right cgroup to
begin with, but by default, all child threads are created in
the same cgroup as their parent, and we don't want vcpu child
threads in the emulator cgroup, so I don't see any good way
of avoiding the move.  It would also be nice if the kernel were
to implement something like rename() as a way to atomically move
a group of threads from one cgroup to another, instead of forcing
a window where we have to read and parse the source, then format
and write back into the destination.

* src/util/vircgroup.c (virCgroupAddTaskStrController): Ignore
ESRCH, because a thread ended between read and write attempts.
(virCgroupMoveTask): Loop until all threads have moved.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-21 11:33:56 -06:00
.gnulib@a363f4ed4a build: update to latest gnulib, for syntax-check 2013-05-10 20:52:57 -06:00
build-aux Document bracket whitespace rules & add syntax-check rule 2012-11-02 14:00:32 +00:00
daemon daemon: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
docs docs: formatdomain: fix links in the table of contents 2013-05-21 10:55:42 +02:00
examples examples: Remove the whitespace before ';' 2013-05-21 23:41:45 +08:00
gnulib maint: use LGPL correctly 2013-05-20 14:03:48 -06:00
include maint: use LGPL correctly 2013-05-20 14:03:48 -06:00
m4 FreeBSD: disable buggy -fstack-protector-all 2013-05-15 15:20:52 -06:00
po utils: util functions for scsi hostdev 2013-05-13 18:40:50 +08:00
python python: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
src cgroup: be robust against cgroup movement races 2013-05-21 11:33:56 -06:00
tests tests/: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
tools tools: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
.dir-locals.el build: avoid tabs that failed syntax-check 2012-09-06 09:43:46 -06:00
.gitignore maint: follow recommended practice for using LGPL 2013-05-20 14:15:21 -06:00
.gitmodules make .gnulib a submodule 2009-07-08 16:17:51 +02:00
.mailmap Autogenerate AUTHORS 2012-10-19 12:44:56 -04:00
AUTHORS.in Add John Ferlan to the committers list 2013-02-05 10:59:32 -05:00
autobuild.sh Set PKG_CONFIG_LIBDIR in autobuild.sh 2013-05-17 17:09:29 +01:00
autogen.sh build: fix incremental autogen.sh when no AUTHORS is present 2012-12-03 14:59:09 -07:00
bootstrap maint: update to latest gnulib 2013-05-08 14:54:04 -06:00
bootstrap.conf Include GNULIB mkdtemp module 2013-05-17 17:09:29 +01:00
cfg.mk maint: enforce correct copyright usage 2013-05-20 14:50:12 -06:00
ChangeLog-old virterror.c: Fix several spelling mistakes 2012-02-03 11:32:51 -07:00
configure.ac maint: follow recommended practice for using LGPL 2013-05-20 14:15:21 -06:00
COPYING maint: follow recommended practice for using LGPL 2013-05-20 14:15:21 -06:00
COPYING.LESSER maint: follow recommended practice for using LGPL 2013-05-20 14:15:21 -06:00
HACKING string: make VIR_STRDUP easier to use 2013-05-07 13:21:31 -06:00
libvirt.pc.in build: silence warning from autoconf 2012-05-30 09:22:02 -06:00
libvirt.spec.in maint: follow recommended practice for using LGPL 2013-05-20 14:15:21 -06:00
Makefile.am maint: use LGPL correctly 2013-05-20 14:03:48 -06:00
Makefile.nonreentrant maint: use LGPL correctly 2013-05-20 14:03:48 -06:00
mingw-libvirt.spec.in test: Return Libvirt logo as domain screenshot 2013-04-02 14:38:56 +02: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
run.in run: license as LGPL 2013-02-23 14:03:19 -07: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>