]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoqemu: Free all driver data in qemuStateCleanup
Jiri Denemark [Fri, 27 Sep 2013 13:34:43 +0000 (15:34 +0200)]
qemu: Free all driver data in qemuStateCleanup

https://bugzilla.redhat.com/show_bug.cgi?id=1011330 (case A)

While activeScsiHostdevs and webSocketPorts were allocated in
qemuStateInitialize, they were not freed in qemuStateCleanup.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoqemu: Don't leak reference to virQEMUDriverConfigPtr
Jiri Denemark [Fri, 27 Sep 2013 13:07:38 +0000 (15:07 +0200)]
qemu: Don't leak reference to virQEMUDriverConfigPtr

https://bugzilla.redhat.com/show_bug.cgi?id=1011330 (case D)

qemuProcessStart created two references to virQEMUDriverConfigPtr before
calling fork():

    cfg = virQEMUDriverGetConfig(driver);
    ...
    hookData.cfg = virObjectRef(cfg);

However, the child only unreferenced hookData.cfg and the parent only
removed the cfg reference. That said, we don't need to increment the
reference counter when assigning cfg to hookData. Both the child and the
parent will correctly remove the reference on cfg (the child will do
that through hookData).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agobuild: fix testsuite building under cygwin
Eric Blake [Fri, 27 Sep 2013 11:01:47 +0000 (05:01 -0600)]
build: fix testsuite building under cygwin

Similar to commit 8f34f19.

* tests/Makefile.am (virnetserverclienttest_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: Fix VPATH build error for locking daemon
Viktor Mihajlovski [Fri, 27 Sep 2013 12:46:59 +0000 (14:46 +0200)]
build: Fix VPATH build error for locking daemon

Removed superfluous/wrong srcdir prefix.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agorpc: Increase bound limit for virDomainGetJobStats
Jiri Denemark [Fri, 27 Sep 2013 08:48:02 +0000 (10:48 +0200)]
rpc: Increase bound limit for virDomainGetJobStats

https://bugzilla.redhat.com/show_bug.cgi?id=1012818

Commit 6d7d0b1869ed293e3208d11f375cecea0129dfc5 (in 1.1.2) added bounds
checking to virDomainGetJobStats. But even at that time the API was able
to return 20 parameters while the limit was set to 16.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agolxc: fix a warning typo in virLXCControllerEventSend
Chen Hanxiao [Fri, 27 Sep 2013 05:43:24 +0000 (13:43 +0800)]
lxc: fix a warning typo in virLXCControllerEventSend

s/becuase/because/

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agomaint: fix comment typos
Eric Blake [Thu, 26 Sep 2013 21:40:34 +0000 (15:40 -0600)]
maint: fix comment typos

* src/lxc/lxc_controller.c (virLXCControllerSetupDisk): Fix typo.
* src/lxc/lxc_driver.c (lxcDomainAttachDeviceDiskLive): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix use of rpc.h on cygwin
Eric Blake [Thu, 26 Sep 2013 21:14:38 +0000 (15:14 -0600)]
build: fix use of rpc.h on cygwin

Caused by commit 012c25e8 splitting out a convenience library.

  CC       libvirtd_conf_la-libvirtd-config.lo
In file included from ../src/rpc/virnetmessage.h:24:0,
                 from ../src/rpc/virnetserverprogram.h:27,
                 from ../src/rpc/virnetserver.h:32,
                 from libvirtd-config.c:31:
../src/rpc/virnetprotocol.h:9:21: fatal error: rpc/rpc.h: No such file
or directory

* daemon/Makefile.am (libvirtd_conf_la_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoLXC: free dst before lxcDomainAttachDeviceDiskLive returns
Chen Hanxiao [Thu, 26 Sep 2013 06:01:52 +0000 (14:01 +0800)]
LXC: free dst before lxcDomainAttachDeviceDiskLive returns

Free dst before lxcDomainAttachDeviceDiskLive returns

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoqemu: virDomainControllerFind may return 0 if controller found
Chen Hanxiao [Tue, 24 Sep 2013 08:03:15 +0000 (16:03 +0800)]
qemu: virDomainControllerFind may return 0 if controller found

The return value of virDomainControllerFind >=0 means that
the specific controller was found.
But some functions invoke it and treat 0 as not found.
This patch fix these incorrect invocation.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoDistribute check-aclperms.pl
Guido Günther [Thu, 26 Sep 2013 11:27:18 +0000 (13:27 +0200)]
Distribute check-aclperms.pl

so "make check" can work for the distributed tarballs too.

11 years agoconf: clean up virDomainChrSourceDefParseXML
Peter Krempa [Thu, 26 Sep 2013 07:24:09 +0000 (09:24 +0200)]
conf: clean up virDomainChrSourceDefParseXML

Tweak some conditions and use correct typecasts in enums.

11 years agoconf: Don't crash on invalid chardev source definition of RNGs and other
Peter Krempa [Thu, 26 Sep 2013 06:12:39 +0000 (08:12 +0200)]
conf: Don't crash on invalid chardev source definition of RNGs and other

Since commit 297c99a5 an invalid source definition XML of a character
device that is used as backend for RNG devices, smartcards and redirdevs
causes crash of the daemon when parsing such a definition.

The device types mentioned above are not a part of a regular character
device but are backends for other types. Thus when parsing such device
NULL is passed as the argument @chr_def. Later when checking the
validity of the definition @chr_def was dereferenced when parsing a UNIX
socket backend with missing path of the socket and crashed the daemon.

Sample offending configuration:
  <devices>
  ...
    <rng model='virtio'>
      <backend model='egd' type='unix'>
        <source mode='bind' service='1024'/>
      </backend>
    </rng>
  </devices>

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1012196

11 years agospec: Clean up distribution of ChangeLog (and others)
Cole Robinson [Wed, 25 Sep 2013 17:20:40 +0000 (13:20 -0400)]
spec: Clean up distribution of ChangeLog (and others)

- Move COPYING* to libvirt-client, so every package pulls them in
- Move AUTHORS ChangeLog.gz NEWS README TODO from -daemon to -docs
- Drop duplicate distribution of docs in -python

https://bugzilla.redhat.com/show_bug.cgi?id=977099

11 years agotest: Allow specifying object runstate in driver XML
Cole Robinson [Tue, 6 Aug 2013 21:42:16 +0000 (17:42 -0400)]
test: Allow specifying object runstate in driver XML

When passing in custom driver XML, allow a block like

<domain xmlns:test='http://libvirt.org/schemas/domain/test/1.0'>
  ...
  <test:runstate>5</test:runstate>
</domain>

This is only read at initial driver start time, and sets the initial
run state of the object. This is handy for UI testing.

It's only wired up for domains, since that's the only conf/
infrastructure that supports namespaces at the moment.

11 years agoAvoid use of uninitialized data in virnetmessagetest
Daniel P. Berrange [Wed, 25 Sep 2013 14:37:10 +0000 (15:37 +0100)]
Avoid use of uninitialized data in virnetmessagetest

If an error occurs in virnetmessagetest it was possible it
would free uninitialized data.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid crash on OOM in virnetmessagetest
Daniel P. Berrange [Wed, 25 Sep 2013 14:36:39 +0000 (15:36 +0100)]
Avoid crash on OOM in virnetmessagetest

The virnetmessagetest code did not check for failure to
allocate the message object. This lead to a crash on OOM
in the test suite.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid crash on OOM in virportallocatortest
Daniel P. Berrange [Wed, 25 Sep 2013 14:35:44 +0000 (15:35 +0100)]
Avoid crash on OOM in virportallocatortest

The virportallocatortest did not check if the object
allocation failed in all cases. This lead to a crash
on OOM in the testsuite

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid crash on OOM in virlockspacetest
Daniel P. Berrange [Wed, 25 Sep 2013 14:31:48 +0000 (15:31 +0100)]
Avoid crash on OOM in virlockspacetest

The virlockspacetest.c did not check for failure to create
a lockspace, causing a crash on OOM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid crash on OOM in virbuftest
Daniel P. Berrange [Wed, 25 Sep 2013 14:31:18 +0000 (15:31 +0100)]
Avoid crash on OOM in virbuftest

The virbuftest code did not check virBufferError before
accessing the buffer contents, resulting in a crash on
OOM conditions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid uninitialized data in qemuMonitorTestNew
Daniel P. Berrange [Wed, 25 Sep 2013 14:30:27 +0000 (15:30 +0100)]
Avoid uninitialized data in qemuMonitorTestNew

The virDomainChrSourceDef variable should be memset to
0, so that the cleanup block does not free uninitialized
data on OOM.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid double free in qemuMonitorCommonTestInit on OOM
Daniel P. Berrange [Wed, 25 Sep 2013 14:29:45 +0000 (15:29 +0100)]
Avoid double free in qemuMonitorCommonTestInit on OOM

The qemuMonitorCommonTestInit method did not allocate the
test object, so it should not free it upon failure. Doing
so causes a double free with the caller.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak on OOM in qemuMonitorCommonTestNew
Daniel P. Berrange [Wed, 25 Sep 2013 14:28:55 +0000 (15:28 +0100)]
Fix leak on OOM in qemuMonitorCommonTestNew

Don't leak the path string in qemuMonitorCommonTestNew if
an OOM occurs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't ignore errors parsing nwfilter rules
Daniel P. Berrange [Wed, 25 Sep 2013 14:26:58 +0000 (15:26 +0100)]
Don't ignore errors parsing nwfilter rules

For inexplicable reasons, the nwfilter XML parser is intentionally
ignoring errors that arise during parsing. As well as meaning that
users don't get any feedback on their XML mistakes, this will lead
it to silently drop data in OOM conditions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in virLockSpaceResourceFree
Daniel P. Berrange [Wed, 25 Sep 2013 14:17:51 +0000 (15:17 +0100)]
Fix leak in virLockSpaceResourceFree

Normally a lockspace resource is not freed while there are
active owners. During initial resource creation though, an
OOM error will trigger this scenario. virLockSpaceResourceFree
was not freeing the 'owners' field in this case.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of parser state in virJSONValueFromString
Daniel P. Berrange [Wed, 25 Sep 2013 14:17:04 +0000 (15:17 +0100)]
Fix leak of parser state in virJSONValueFromString

If OOM or another error occurs in virJSONValueFromString the
parser state object will be leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix double-free in virJSONParserHandleStartMap on OOM
Daniel P. Berrange [Wed, 25 Sep 2013 14:16:24 +0000 (15:16 +0100)]
Fix double-free in virJSONParserHandleStartMap on OOM

If OOM occurs in virJSONParserHandleStartMap it will free
a variable that is owned by another object. This leads to
a later double-free.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of iterators in virDBusMessageIterEncode
Daniel P. Berrange [Wed, 25 Sep 2013 14:15:45 +0000 (15:15 +0100)]
Fix leak of iterators in virDBusMessageIterEncode

If virDBusMessageIterEncode hits an OOM condition it often
leaks the memory associated with the dbus iterator object

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't print all test suite errors to stderr in vmx2xmltest
Daniel P. Berrange [Wed, 25 Sep 2013 10:34:00 +0000 (11:34 +0100)]
Don't print all test suite errors to stderr in vmx2xmltest

The vmx2xmltest test would print all errors to stderr, which
is not helpful when running OOM tests, and differs from the
behaviour of other tests.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of comment string if virConfAddEntry fails on OOM
Daniel P. Berrange [Wed, 25 Sep 2013 10:32:07 +0000 (11:32 +0100)]
Fix leak of comment string if virConfAddEntry fails on OOM

The code parsing comments in config files called virConfAddEntry
but did not check for failure. This caused the comment string to
leak on OOM.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd missing check for OOM with virVMXEscapeHexPipe
Daniel P. Berrange [Wed, 25 Sep 2013 10:31:26 +0000 (11:31 +0100)]
Add missing check for OOM with virVMXEscapeHexPipe

The virVMXFormatConfig called virVMXEscapeHexPipe but
forgot to check for OOM. This caused data to silently
be lost.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM parsing storage pool XML
Daniel P. Berrange [Wed, 25 Sep 2013 09:22:42 +0000 (10:22 +0100)]
Fix crash on OOM parsing storage pool XML

The virStoragePoolDefParseSource method would set def->nhosts
before allocating def->hosts. If the allocation failed due to
OOM, the cleanup code would crash accessing out of bounds.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix double free of hostdev on OOM in xenParseSxprPCI
Daniel P. Berrange [Wed, 25 Sep 2013 09:20:45 +0000 (10:20 +0100)]
Fix double free of hostdev on OOM in xenParseSxprPCI

If xenParseSxprPCI failed to expand the def->hostdevs array
due to OOM, it would free the hostdev instance twice.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't clobber 'ret' in LXC XML test case
Daniel P. Berrange [Wed, 25 Sep 2013 08:35:29 +0000 (09:35 +0100)]
Don't clobber 'ret' in LXC XML test case

The testCompareXMLToXMLHelper method clobbered the 'ret' variable
in several places leading to a failure to report OOM errors from
the test suite.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM in virDomainSnapshotDefParse
Daniel P. Berrange [Wed, 25 Sep 2013 08:34:25 +0000 (09:34 +0100)]
Fix crash on OOM in virDomainSnapshotDefParse

The virDomainSnapshotDefParse method assigned to def->ndisks
before allocating def->disks. Thus if an OOM occurred, the
cleanup code would access out of bounds.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't clobber return value in virInterfaceDefParseProtoIPv6
Daniel P. Berrange [Wed, 25 Sep 2013 08:33:12 +0000 (09:33 +0100)]
Don't clobber return value in virInterfaceDefParseProtoIPv6

Several places in virInterfaceDefParseProtoIPv6 clobber the
default 'ret' return value. So when jumping to cleanup on
error, 'ret' may mistakenly be set to 0 instead of -1. This
caused failure to report OOM errors, meaning data was silently
lost during parsing.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix handling of OOM when getting Xen dom ID
Daniel P. Berrange [Wed, 25 Sep 2013 08:31:30 +0000 (09:31 +0100)]
Fix handling of OOM when getting Xen dom ID

The methods for obtaining the Xen dom ID cannot distinguish
between returning -1 due to an error and returning -1 due to
the domain being shutoff. Change them to return the dom ID
via an output parameter.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM in xenParseSxpr
Daniel P. Berrange [Wed, 25 Sep 2013 08:30:20 +0000 (09:30 +0100)]
Fix crash on OOM in xenParseSxpr

The xenParseSxpr method sets def->nconsoles to 1 before allocating
the def->consoles array. If the allocation fails due to OOM the
cleanup code will thus crash accessing out of bounds.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agovirsh-domain: Add a missing check and fix leak in cmdScreenshot
Hongwei Bi [Wed, 25 Sep 2013 14:54:24 +0000 (22:54 +0800)]
virsh-domain: Add a missing check and fix leak in cmdScreenshot

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoFix leak of serial value in xenFormatXM on OOM
Daniel P. Berrange [Tue, 24 Sep 2013 15:46:44 +0000 (16:46 +0100)]
Fix leak of serial value in xenFormatXM on OOM

If an OOM occurs in xenFormatXM when formatting to the
serial device value, the value is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix broken formatting on OOM in xenFormatXM
Daniel P. Berrange [Tue, 24 Sep 2013 15:45:58 +0000 (16:45 +0100)]
Fix broken formatting on OOM in xenFormatXM

If an OOM occurs when xenFormatXM is setting the 'hpet'
variable it is silently ignored. Fix it to propagate
to the callers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM in xenParseXM handling consoles
Daniel P. Berrange [Tue, 24 Sep 2013 15:45:09 +0000 (16:45 +0100)]
Fix crash on OOM in xenParseXM handling consoles

The xenParseXM sets def->nconsoles to 1 before claling
VIR_REALLOC_N on def->consoles. So if the alloc fails
due to OOM, the cleanup code will crash accessing a
console that does not exist.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of char device in xenParseXM
Daniel P. Berrange [Tue, 24 Sep 2013 15:44:26 +0000 (16:44 +0100)]
Fix leak of char device in xenParseXM

If an OOM occurs in xenParseXM, a virDomainChrDef may be
leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of command line args in qemuParseCommandLine
Daniel P. Berrange [Tue, 24 Sep 2013 15:38:26 +0000 (16:38 +0100)]
Fix leak of command line args in qemuParseCommandLine

If qemuParseCommandLine finds an arg it does not understand
it adds it to the QEMU passthrough custom arg list. If the
qemuParseCommandLine method hits an error for any reason
though, it just does 'VIR_FREE(cmd)' on the custom arg list.
This means all actual args / env vars are leaked. Introduce
a qemuDomainCmdlineDefFree method to be used for cleanup.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in qemuParseCommandLine on OOM
Daniel P. Berrange [Tue, 24 Sep 2013 15:37:24 +0000 (16:37 +0100)]
Fix leak in qemuParseCommandLine on OOM

If the call to virDomainControllerInsert fails in
qemuParseCommandLine, the controller struct is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in qemuStringToArgvEnv upon OOM
Daniel P. Berrange [Tue, 24 Sep 2013 15:34:06 +0000 (16:34 +0100)]
Fix leak in qemuStringToArgvEnv upon OOM

The 'qemuStringToArgvEnv' method splits up a string of command
line env/args to an 'arglist' array. It then copies env vars
to a 'progenv' array and args to a 'progargv' array. When
copyin the env vars, it NULL-ifies the element in 'arglist'
that is copied.

Upon OOM the 'virStringListFree' is called on progenv and
arglist. Unfortunately, because the elements in 'arglist'
related to env vars have been set to NULL, the call to
virStringListFree(arglist) doesn't free anything, even
though some non-NULL args vars still exist later in the
array.

To fix this leak, stop NULL-ifying the 'arglist' elements,
and change the cleanup code to only free elements in the
'arglist' array, not 'progenv'.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix missing jump to error cleanup in qemuParseCommandLineDisk
Daniel P. Berrange [Tue, 24 Sep 2013 15:28:22 +0000 (16:28 +0100)]
Fix missing jump to error cleanup in qemuParseCommandLineDisk

In a number of places in qemuParseCommandLineDisk, an error
is reported, but no 'goto error' jump is used. This causes
failure to report OOM conditions to the caller.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in qemuParseCommandLineDisk on OOM
Daniel P. Berrange [Tue, 24 Sep 2013 15:27:32 +0000 (16:27 +0100)]
Fix leak in qemuParseCommandLineDisk on OOM

If OOM occurs in qemuParseCommandLineDisk some intermediate
variables will be leaked when parsing Sheepdog or RBD disks.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak on OOM in qemuBuildCommandLine dealing with sound card
Daniel P. Berrange [Tue, 24 Sep 2013 15:26:18 +0000 (16:26 +0100)]
Fix leak on OOM in qemuBuildCommandLine dealing with sound card

The qemuBuildCommandLine code for parsing sound cards will leak
an intermediate variable if an OOM occurs. Move the free'ing of
the variable earlier to avoid the leak.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix failure to honour OOM status in qemuParseNBDString
Daniel P. Berrange [Tue, 24 Sep 2013 15:25:16 +0000 (16:25 +0100)]
Fix failure to honour OOM status in qemuParseNBDString

In qemuParseNBDString, if the virURIParse fails, the
error is not reported to the caller. Instead execution
falls through to the non-URI codepath causing memory
leaks later on.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid leak in qemuParseRBDString on failure of qemuAddRBDHost
Daniel P. Berrange [Tue, 24 Sep 2013 15:24:06 +0000 (16:24 +0100)]
Avoid leak in qemuParseRBDString on failure of qemuAddRBDHost

If qemuAddRBDHost fails due to parsing problems or OOM, then
qemuParseRBDString cleanup is skipped causing a memory leak.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of address string in qemuDomainPCIAddressGetNextSlot
Daniel P. Berrange [Tue, 24 Sep 2013 15:13:44 +0000 (16:13 +0100)]
Fix leak of address string in qemuDomainPCIAddressGetNextSlot

qemuDomainPCIAddressGetNextSlot has a loop for finding
compatible PCI buses. In the loop body it creates a
PCI address string, but never frees this. This causes
a leak if the loop executes more than one iteration,
or if a call in the loop body fails.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in virDomainDefParseXML parsing vcpupin
Daniel P. Berrange [Tue, 24 Sep 2013 15:12:47 +0000 (16:12 +0100)]
Fix leak in virDomainDefParseXML parsing vcpupin

If virBitmapNew fails due to OOM, the 'vcpupin' variable
is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in virDomainVcpuPinDefParseXML parsing cpumask
Daniel P. Berrange [Tue, 24 Sep 2013 15:11:39 +0000 (16:11 +0100)]
Fix leak in virDomainVcpuPinDefParseXML parsing cpumask

If the virBitmapParse method fails due to OOM, we leak
the 'tmp' variable string.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid leak if virDomainSoundCodecDefParseXML return error
Daniel P. Berrange [Tue, 24 Sep 2013 15:10:49 +0000 (16:10 +0100)]
Avoid leak if virDomainSoundCodecDefParseXML return error

If virDomainSoundCodecDefParseXML returns an error (eg due
to OOM), then the xml nodeset codecNodes is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak in virDomainVcpuPinDefArrayFree
Daniel P. Berrange [Tue, 24 Sep 2013 15:09:36 +0000 (16:09 +0100)]
Fix leak in virDomainVcpuPinDefArrayFree

If virDomainVcpuPinDefArrayFree is called with def != NULL,
but nvcpupin == 0, then it leaks memory for 'def'. This is
an unusual scenario, but it hits when cleaning up after an
OOM during parsing of XML.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemu: prefer to put a Q35 machine's dmi-to-pci-bridge at 00:1E.0
Laine Stump [Wed, 25 Sep 2013 12:02:19 +0000 (08:02 -0400)]
qemu: prefer to put a Q35 machine's dmi-to-pci-bridge at 00:1E.0

This resolves one of the issues listed in:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

00:1E.0 is the location of this controller on at least some actual Q35
hardware, so we try to replicate the placement. The bridge should work
just as well in any other location though, so if 00:1E.0 isn't
available, just allow it to be auto-assigned anywhere appropriate.

11 years agoqemu: turn if into switch in qemuDomainValidateDevicePCISlotsQ35
Laine Stump [Wed, 25 Sep 2013 10:59:46 +0000 (06:59 -0400)]
qemu: turn if into switch in qemuDomainValidateDevicePCISlotsQ35

This will make it simpler to add checks for other types of
controllers.

This is a prerequisite for patches to resolve:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

11 years agoqemu: support ich9-intel-hda audio device
Laine Stump [Tue, 24 Sep 2013 14:17:38 +0000 (10:17 -0400)]
qemu: support ich9-intel-hda audio device

This resolves one of the issues in:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

This device is identical to qemu's "intel-hda" device (known as "ich6"
in libvirt), but has a different PCI device ID (which matches the ID
of the hda audio built into the ich9 chipset, of course). It's not
supported in earlier versions of qemu, so it requires a capability
bit.

11 years agoqemu: replace multiple strcmps with a switch on an enum
Laine Stump [Tue, 24 Sep 2013 13:38:32 +0000 (09:38 -0400)]
qemu: replace multiple strcmps with a switch on an enum

I'm not sure why this code was written to compare the strings that it
had just retrieved from an enum->string conversion, rather than just
look at the original enum values, but this yields the same results,
and is much more efficient (especially as you add more devices).

This is a prerequisite for patches to resolve:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

11 years agoqemu: allow some PCI devices to be attached to PCIe slots
Laine Stump [Tue, 24 Sep 2013 13:16:25 +0000 (09:16 -0400)]
qemu: allow some PCI devices to be attached to PCIe slots

Part of the resolution to:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

Although most devices available in qemu area defined as PCI devices,
and strictly speaking should only be attached via a PCI slot, in
practice qemu allows them to be attached to a PCIe slot and sometimes
this makes sense.

For example, The UHCI and EHCI USB controllers are usually attached
directly to the PCIe "root complex" (i.e. PCIe slots) on real
hardware, so that should be possible for a Q35-based qemu virtual
machine as well.

We still want to prefer a standard PCI slot when auto-assigning
addresses, though, and in general to disallow attaching PCI devices
via PCIe slots.

This patch makes that possible by adding a new
QEMU_PCI_CONNECT_TYPE_EITHER_IF_CONFIG flag. Three things are done
with this flag:

1) It is set for the "pcie-root" controller

2) qemuCollectPCIAddress() now has a set of nested switches that set
this "EITHER" flag for devices that we want to allow connecting to
pcie-root when specifically requested in the config.

3) qemuDomainPCIAddressFlagsCompatible() adds this new flag to the
"flagsMatchMask" if the address being checked came from config rather
than being newly auto-allocated by libvirt (this knowledge is
conveniently already available in the "fromConfig" arg).

Now any device having the EITHER flag set can be connected to
pcie-root if explicitly requested, but auto-allocated addresses for
those devices will still be standard PCI slots instead.

This patch only loosens the restrictions on devices that have been
specifically requested, but the setup is such that it should be fairly
easy to add new devices.

11 years agoqemu: eliminate redundant if clauses in qemuCollectPCIAddress
Laine Stump [Tue, 24 Sep 2013 10:49:26 +0000 (06:49 -0400)]
qemu: eliminate redundant if clauses in qemuCollectPCIAddress

Replace them with switch cases. This will make it more efficient when
we add exceptions for more controller types, and other device types.

This is a prerequisite for patches to resolve:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

11 years agobridge driver: don't masquerade local subnet broadcast/multicast packets
Laszlo Ersek [Wed, 25 Sep 2013 10:45:26 +0000 (12:45 +0200)]
bridge driver: don't masquerade local subnet broadcast/multicast packets

Packets sent by guests on virbrN, *or* by dnsmasq on the same, to
- 255.255.255.255/32 (netmask-independent local network broadcast
  address), or to
- 224.0.0.0/24 (local subnetwork multicast range)
are never forwarded, hence it is not necessary to masquerade them.

In fact we must not masquerade them: translating their source addresses or
source ports (where applicable) may confuse receivers on virbrN.

One example is the DHCP client in OVMF (= UEFI firmware for virtual
machines):

  http://thread.gmane.org/gmane.comp.bios.tianocore.devel/1506/focus=2640

It expects DHCP replies to arrive from remote source port 67. Even though
dnsmasq conforms to that, the destination address (255.255.255.255) and
the source address (eg. 192.168.122.1) in the reply allow the UDP
masquerading rule to match, which rewrites the source port to or above
1024. This prevents the DHCP client in OVMF from accepting the packet.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=709418

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
11 years agoutil/viriptables: add/remove rules that short-circuit masquerading
Laszlo Ersek [Wed, 25 Sep 2013 10:45:25 +0000 (12:45 +0200)]
util/viriptables: add/remove rules that short-circuit masquerading

The functions
- iptablesAddForwardDontMasquerade(),
- iptablesRemoveForwardDontMasquerade
handle exceptions in the masquerading implemented in the POSTROUTING chain
of the "nat" table. Such exceptions should be added as chronologically
latest, logically top-most rules.

The bridge driver will call these functions beginning with the next patch:
some special destination IP addresses always refer to the local
subnetwork, even though they don't match any practical subnetwork's
netmask. Packets from virbrN targeting such IP addresses are never routed
outwards, but the current rules treat them as non-virbrN-destined packets
and masquerade them. This causes problems for some receivers on virbrN.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
11 years agoqemu: Wire up better early error reporting
Peter Krempa [Wed, 18 Sep 2013 14:23:14 +0000 (16:23 +0200)]
qemu: Wire up better early error reporting

The previous patches added infrastructure to report better errors from
monitor in some cases. This patch finalizes this "feature" by enabling
this enhanced error reporting on early phases of VM startup. In these
phases the possibility of qemu producing a useful error message is
really high compared to running it during the whole life cycle. After
the start up is complete, the feature is disabled to provide the usual
error messages so that users are not confused by possibly irrelevant
messages that may be in the domain log.

The original motivation to do this enhancement is to capture errors when
using VFIO device passthrough, where qemu reports errors after the
monitor is initialized and the existing error catching code couldn't
catch this producing a unhelpful message:

 # virsh start test
 error: Failed to start domain test
 error: Unable to read from monitor: Connection reset by peer

With this change, the message is changed to:

 # virsh start test
 error: Failed to start domain test
 error: internal error: early end of file from monitor: possible problem:
 qemu-system-x86_64: -device vfio-pci,host=00:1a.0,id=hostdev0,bus=pci.0,addr=0x5: vfio: error, group 8 is not viable, please ensure all devices within the iommu_group are bound to their vfio bus driver.
 qemu-system-x86_64: -device vfio-pci,host=00:1a.0,id=hostdev0,bus=pci.0,addr=0x5: vfio: failed to get group 8
 qemu-system-x86_64: -device vfio-pci,host=00:1a.0,id=hostdev0,bus=pci.0,addr=0x5: Device 'vfio-pci' could not be initialized

11 years agoqemu: monitor: Produce better errors on monitor hangup
Peter Krempa [Wed, 18 Sep 2013 14:17:39 +0000 (16:17 +0200)]
qemu: monitor: Produce better errors on monitor hangup

Change the monitor error code to add the ability to access the qemu log
file using a file descriptor so that we can dig in it for a more useful
error message. The error is now logged on monitor hangups and overwrites
a possible lesser error. A hangup on the monitor usualy means that qemu
has crashed and there's a significant chance it produced a useful error
message.

The functionality will be latent until the next patch.

11 years agoqemu: monitor: Add infrastructure to access VM logs for better err msgs
Peter Krempa [Wed, 18 Sep 2013 14:12:17 +0000 (16:12 +0200)]
qemu: monitor: Add infrastructure to access VM logs for better err msgs

Early VM startup errors usually produce a better error message in the
machine log file. Currently we were accessing it only when the process
exited during certain phases of startup. This will help adding a more
comprehensive error extraction for early qemu startup phases.

This patch adds infrastructure to keep a file descriptor for the machine
log file that will be used in case an error happens.

11 years agoqemu_process: Make qemuProcessReadLog() more versatile and reusable
Peter Krempa [Wed, 18 Sep 2013 12:43:52 +0000 (14:43 +0200)]
qemu_process: Make qemuProcessReadLog() more versatile and reusable

Teach the function to skip character device definitions printed by qemu
at startup in addition to libvirt log messages and make it usable from
outside of qemu_process.c. Also add documentation about the func.

11 years agoCheck return value of virDomainControllerInsert when parsing QEMU args
Daniel P. Berrange [Mon, 23 Sep 2013 16:44:49 +0000 (17:44 +0100)]
Check return value of virDomainControllerInsert when parsing QEMU args

The parsing of '-usb' did not check for failure of the
virDomainControllerInsert method. As a result on OOM, the
parser mistakenly attached USB disks to the IDE controller.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoHonour error returned by virBitmapFormat
Daniel P. Berrange [Mon, 23 Sep 2013 16:43:47 +0000 (17:43 +0100)]
Honour error returned by virBitmapFormat

The code formatting NUMA args was ignoring the return value
of virBitmapFormat, so on OOM, it would silently drop the
NUMA cpumask arg.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd missing check for OOM when building boot menu args
Daniel P. Berrange [Mon, 23 Sep 2013 14:11:19 +0000 (15:11 +0100)]
Add missing check for OOM when building boot menu args

When building boot menu args, if OOM occurred the CLI args
would end up containing  'order=(null)' due to a missing
call to 'virBufferError'.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix format specifier for OOM test fprintfs
Daniel P. Berrange [Tue, 24 Sep 2013 15:56:53 +0000 (16:56 +0100)]
Fix format specifier for OOM test fprintfs

The testutils.c file had some fprintfs which had not been
converted from %d to %zu, when 'testCounter' change to be
a size_t. This was a build breaker if --enable-test-oom
was enabled

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agomaint: update to latest gnulib
Eric Blake [Tue, 24 Sep 2013 12:49:10 +0000 (06:49 -0600)]
maint: update to latest gnulib

Since we're about to freeze, it's time to pick up the latest
upstream gnulib.  Among other changes, gnulib now guarantees the
use of some -f flags that we were previously manually adding.

* .gnulib: Update to latest, in part for warning improvements.
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Drop
flags that are now guaranteed by gnulib.
* bootstrap: Resync to gnulib.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoAlways open files in binary mode in virFDStreamOpenFileInternal
Claudio Bley [Tue, 24 Sep 2013 09:57:38 +0000 (11:57 +0200)]
Always open files in binary mode in virFDStreamOpenFileInternal

On win32, using text mode for binary files might result in short
reads since ASCII character 0x1A is interpreted as EOF. Also, it
could lead to problems using the seek functions because of the \r
handling.

Signed-off-by: Claudio Bley <cbley@av-test.de>
11 years agotest: fix call to virFDStreamOpenFile in testDomainScreenshot
Claudio Bley [Tue, 24 Sep 2013 09:57:37 +0000 (11:57 +0200)]
test: fix call to virFDStreamOpenFile in testDomainScreenshot

N.B.  This had no ill effects as long as O_RDONLY is defined to
      to be 0, such that the expression (O_RDONLY < 0) yielded 0
      again.

Signed-off-by: Claudio Bley <cbley@av-test.de>
11 years agoDon't ignore allocation failure in virCommandAddEnvPassCommon
Daniel P. Berrange [Mon, 23 Sep 2013 13:20:37 +0000 (14:20 +0100)]
Don't ignore allocation failure in virCommandAddEnvPassCommon

The virCommandAddEnvPassCommon method ignored the failure to
pre-allocate the env variable array with VIR_RESIZE_N. While
this is harmless, it confuses the test harness which is trying
to validate OOM handling of every individual allocation call.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix reporting of errors in OOM injection code
Daniel P. Berrange [Mon, 23 Sep 2013 13:19:25 +0000 (14:19 +0100)]
Fix reporting of errors in OOM injection code

When the various viralloc.c functions were changed to use the
normal error reporting code, the OOM injection code paths
were not updated to report errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix missing OOM check in qemuParseCommandLine when splitting strings
Daniel P. Berrange [Mon, 23 Sep 2013 13:18:04 +0000 (14:18 +0100)]
Fix missing OOM check in qemuParseCommandLine when splitting strings

The qemuParseCommandLine method did not check the return value of
virStringSplit to see if OOM had occurred. This lead to dereference
of a NULL pointer on OOM.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix error checking of qemuParseKeywords return status
Daniel P. Berrange [Mon, 23 Sep 2013 13:16:09 +0000 (14:16 +0100)]
Fix error checking of qemuParseKeywords return status

Most callers of qemuParseKeywords were assigning its return
value to a 'size_t' variable. Then then also checked '< 0'
for error condition, but this will never be true with the
unsigned size_t variable. Rather than using 'ssize_t', change
qemuParseKeywords so that the element count is returned via
an output parameter, leaving the return value solely as an
error indicator.

This avoids a crash accessing beyond the end of an error
upon OOM.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix allocation of arglist in qemuStringToArgvEnv
Daniel P. Berrange [Mon, 23 Sep 2013 13:14:04 +0000 (14:14 +0100)]
Fix allocation of arglist in qemuStringToArgvEnv

In

  commit 41b550567918790cb304378f39c3ba369bcca28e
  Author: Eric Blake <eblake@redhat.com>
  Date:   Wed Aug 28 15:01:23 2013 -0600

    qemu: simplify list cleanup

The qemuStringToArgvEnv method was changed to use virStringFreeList
to free the 'arglist' array. This method assumes the string list
array is NULL terminated, however, qemuStringToArgvEnv was not
ensuring this when populating 'arglist'. This caused an out of
bounds access by virStringFreeList when OOM occured in the initial
loop of qemuStringToArgvEnv

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM in qemuAddRBDHost
Daniel P. Berrange [Mon, 23 Sep 2013 13:11:34 +0000 (14:11 +0100)]
Fix crash on OOM in qemuAddRBDHost

When parsing the RBD hosts, it increments the 'nhosts' counter
before increasing the 'hosts' array allocation. If an OOM then
occurs when increasing the array allocation, the cleanup block
will attempt to access beyond the end of the array. Switch
to using VIR_EXPAND_N instead of VIR_REALLOC_N to protect against
this mistake

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM in qemuDomainCCWAddressSetCreate()
Daniel P. Berrange [Mon, 23 Sep 2013 13:10:35 +0000 (14:10 +0100)]
Fix crash on OOM in qemuDomainCCWAddressSetCreate()

If OOM occurs in qemuDomainCCWAddressSetCreate, it jumps to
a cleanup block and frees the partially initialized object.
It then mistakenly returns the address of the just free'd
pointer instead of NULL.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash if OOM occurs when creating virConnectPtr
Daniel P. Berrange [Mon, 23 Sep 2013 13:09:19 +0000 (14:09 +0100)]
Fix crash if OOM occurs when creating virConnectPtr

If a OOM error occurs in virGetConnect, this may cause the
virConnectDispose method to de-reference a NULL pointer,
since the close callback will not have been initialized.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM in parsing CPU mask in domain XML
Daniel P. Berrange [Mon, 23 Sep 2013 13:08:35 +0000 (14:08 +0100)]
Fix crash on OOM in parsing CPU mask in domain XML

The virDomainDefParseXML method did not check the return value
of the virBitmapNew API call for NULL. This lead to a crash on
OOM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix crash on OOM when parsing disk security label
Daniel P. Berrange [Mon, 23 Sep 2013 13:07:51 +0000 (14:07 +0100)]
Fix crash on OOM when parsing disk security label

If an OOM error occurs in virSecurityDeviceLabelDefParseXML the
cleanup code may free an uninitialized pointer, causing a crash

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoconf: Fix virNetworkAssignDef's comment.
lawrancejing [Tue, 24 Sep 2013 02:05:37 +0000 (10:05 +0800)]
conf: Fix virNetworkAssignDef's comment.

11 years agoAdd test case for virNetServerClient object identity code
Daniel P. Berrange [Mon, 23 Sep 2013 11:39:19 +0000 (12:39 +0100)]
Add test case for virNetServerClient object identity code

Start a test case for the virNetServerClient object, which
initially checks the creation of a virIdentityPtr object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd a virNetSocketNewConnectSockFD method
Daniel P. Berrange [Mon, 23 Sep 2013 10:58:26 +0000 (11:58 +0100)]
Add a virNetSocketNewConnectSockFD method

To allow creation of a virNetSocketPtr instance from a pre-opened
socketpair FD, add a virNetSocketNewConnectSockFD method.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agopython: add bindings for virConnectGetCPUModelNames
Giuseppe Scrivano [Mon, 23 Sep 2013 09:46:04 +0000 (11:46 +0200)]
python: add bindings for virConnectGetCPUModelNames

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirsh: add function to get the CPU models for an arch
Giuseppe Scrivano [Mon, 23 Sep 2013 09:46:03 +0000 (11:46 +0200)]
virsh: add function to get the CPU models for an arch

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirConnectGetCPUModelNames: add the support for the test protocol
Giuseppe Scrivano [Mon, 23 Sep 2013 09:46:02 +0000 (11:46 +0200)]
virConnectGetCPUModelNames: add the support for the test protocol

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirConnectGetCPUModelNames: add the support for qemu
Giuseppe Scrivano [Mon, 23 Sep 2013 09:46:01 +0000 (11:46 +0200)]
virConnectGetCPUModelNames: add the support for qemu

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirConnectGetCPUModelNames: implement the remote protocol
Giuseppe Scrivano [Mon, 23 Sep 2013 09:46:00 +0000 (11:46 +0200)]
virConnectGetCPUModelNames: implement the remote protocol

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agocpu: add function to get the models for an arch
Giuseppe Scrivano [Mon, 23 Sep 2013 09:45:59 +0000 (11:45 +0200)]
cpu: add function to get the models for an arch

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agolibvirt: add new public API virConnectGetCPUModelNames
Giuseppe Scrivano [Mon, 23 Sep 2013 09:45:58 +0000 (11:45 +0200)]
libvirt: add new public API virConnectGetCPUModelNames

The new function virConnectGetCPUModelNames allows to retrieve the list
of CPU models known by the hypervisor for a specific architecture.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: ensure 'make check' sees up-to-date config.h
Eric Blake [Wed, 18 Sep 2013 22:11:25 +0000 (16:11 -0600)]
build: ensure 'make check' sees up-to-date config.h

Nehal J. Wani reported on IRC a rather interesting build failure:

In file included from util/virnetdevbridge.c:53:0:
/usr/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr'
 struct in6_addr {
        ^

I traced it to the fact that he ran 'git pull; make check' across
commit e62e0094.  What happened is that the configure changes
result in a new variable that was set to be defined on his system,
but config.h was not regenerated to contain the value of that
variable.  Running 'make' instead of 'make check' cleaned up the
problem.  A bit more investigation, and I see that in Makefile.am,
automake sticks rules that rebuild config.h as part of 'make all',
and that we also had a dependency 'check-local: all'; BUT the
rule for check-local is run only at the point when the top-level
directory is visited.  Automake documents that SUBDIRS should
contain an explicit '.' at the point the top-level should be
visited (defaulting to last, if it doesn't appear).  Sure enough,
with this patch, 'make check' now does the top-level 'all' rules,
which regenerates 'config.h' BEFORE compiling any code that might
depend on changed content of that file.

* Makefile.am (SUBDIRS): Put '.' first, not last.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoFix typo in identity code which is pre-requisite for CVE-2013-4311
Daniel P. Berrange [Mon, 23 Sep 2013 11:46:25 +0000 (12:46 +0100)]
Fix typo in identity code which is pre-requisite for CVE-2013-4311

The fix for CVE-2013-4311 had a pre-requisite enhancement
to the identity code

  commit db7a5688c05f3fd60d9d2b74c72427eb9ee9c176
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Aug 22 16:00:01 2013 +0100

    Also store user & group ID values in virIdentity

This had a typo which caused the group ID to overwrite the
user ID string. This meant any checks using this would have
the wrong ID value. This only affected the ACL code, not the
initial polkit auth. It also leaked memory.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agodocs: Load libvirt_access*.xml from build dir
Jiri Denemark [Fri, 20 Sep 2013 09:47:39 +0000 (11:47 +0200)]
docs: Load libvirt_access*.xml from build dir

The xml files are generated in build directory and thus docs/newapi.xsl
was not able to find them in a VPATH build.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoLXC: Check the existence of dir before resolving symlinks
Chen Hanxiao [Mon, 23 Sep 2013 10:22:17 +0000 (11:22 +0100)]
LXC: Check the existence of dir before resolving symlinks

If a dir does not exist, raise an immediate error in logs
rather than letting virFileResolveAllLinks fail, since this
gives better error reporting to the user.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoLXC: follow the unit style of /proc/meminfo
Chen Hanxiao [Mon, 23 Sep 2013 10:01:07 +0000 (11:01 +0100)]
LXC: follow the unit style of /proc/meminfo

When FUSE is enabled, the LXC container is setup with
a custom /proc/meminfo file. This file uses "KB" as a
suffix, rather than "kB" which is the kernel's style.
Fix this inconsistency to avoid confusing apps.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>