mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
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.
9ed534f081
The 'def->target.addr' hasn't been initialized in virDomainChrDefNew() and its value is always '0xffffffff', in addition, the following test scenario hasn't also include 'address' element in channel XML block, so the branch 'if (addrStr == NULL)' is hit in virDomainChrDefParseTargetXML(), the programming jumps to 'error' label to release relevant resources, and the statement 'if (VIR_ALLOC(def->target.addr) < 0)' hasn't been executed then the virDomainChrDefFree() will free 'def->target.addr'(0xffffffff) via VIR_FREE(), which results in libvirt crash, to use valgrind can also find a 'Invalid free() / delete / delete[]' error. This patch just adjusts codes order to initialize 'def->target.addr' firstly. With this patch, libvirt hasn't crash and can get a expected error message " XML error: guestfwd channel does not define a target address". How to reproduce? 1. define a guest with the following channel XML configuration $ cat foo.xml <snip> <channel type='pty'> <target type='guestfwd'/> </channel> </snip> $ virsh define foo.xml 2. actual result error: Failed to define domain from /tmp/foo.xml error: End of file while reading data: Input/output error error: Failed to reconnect to the hypervisor GDB debugger information: <snip> Breakpoint 1, virDomainChrDefFree (def=0x7f8ab000ec70) at conf/domain_conf.c:1264 ...ignore 1264 { (gdb) p def->target $2 = {port = -1, addr = 0xffffffff, name = 0xffffffff <Address 0xffffffff out of bounds>} </snip> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=856489 Signed-off-by: Alex Jia <ajia@redhat.com> |
||
---|---|---|
.gnulib@440a1dbe52 | ||
build-aux | ||
daemon | ||
docs | ||
examples | ||
gnulib | ||
include | ||
m4 | ||
po | ||
python | ||
src | ||
tests | ||
tools | ||
.dir-locals.el | ||
.gitignore | ||
.gitmodules | ||
.mailmap | ||
AUTHORS | ||
autobuild.sh | ||
autogen.sh | ||
bootstrap | ||
bootstrap.conf | ||
cfg.mk | ||
ChangeLog-old | ||
configure.ac | ||
COPYING.LIB | ||
HACKING | ||
libvirt.pc.in | ||
libvirt.spec.in | ||
Makefile.am | ||
Makefile.nonreentrant | ||
mingw-libvirt.spec.in | ||
README | ||
README-hacking | ||
TODO |
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>