[libvirt] [PATCH] qemu: Fix double free in qemuDomainSecretAESClear
by John Ferlan
Commit id 02b031a4 added a secondary path from which the
incoming @secinfo would not be free'd until the private
data was freed in qemuDomainStorageSourcePrivateDispose.
However, by doing this the original intention to free
@*secinfo afterwards is lost and thus the pass by value
of the secinfo->s.aes (or secinfo->s.plain for its method)
results in not keeping the NULL setting in the various
secret.{username|iv|ciphertext} fields upon return to
qemuDomainSecretInfoClear and eventually will result in
a double free at domain destroy:
raise ()
abort ()
__libc_message ()
malloc_printerr ()
_int_free ()
virFree
qemuDomainSecretAESClear
qemuDomainSecretInfoClear
qemuDomainSecretInfoFree
qemuDomainStorageSourcePrivateDispose
virObjectUnref
virStorageSourceClear
virStorageSourceFree
virDomainDiskDefFree
virDomainDefFree
virDomainObjRemoveTransientDef
qemuProcessStop
qemuDomainDestroyFlags
virDomainDestroy
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_domain.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Domains w/ secrets weren't very happy when I went to destroy them
today during testing...
Fortunately issue is not in 4.4.0...
I modified both Plain and AES just because it's probably best to
avoid something like this in the future.
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f135117a95..1fb1ef1deb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -945,23 +945,23 @@ qemuDomainMasterKeyCreate(virDomainObjPtr vm)
static void
-qemuDomainSecretPlainClear(qemuDomainSecretPlain secret)
+qemuDomainSecretPlainClear(qemuDomainSecretPlainPtr secret)
{
- VIR_FREE(secret.username);
- VIR_DISPOSE_N(secret.secret, secret.secretlen);
+ VIR_FREE(secret->username);
+ VIR_DISPOSE_N(secret->secret, secret->secretlen);
}
static void
-qemuDomainSecretAESClear(qemuDomainSecretAES secret,
+qemuDomainSecretAESClear(qemuDomainSecretAESPtr secret,
bool keepAlias)
{
if (!keepAlias)
- VIR_FREE(secret.alias);
+ VIR_FREE(secret->alias);
- VIR_FREE(secret.username);
- VIR_FREE(secret.iv);
- VIR_FREE(secret.ciphertext);
+ VIR_FREE(secret->username);
+ VIR_FREE(secret->iv);
+ VIR_FREE(secret->ciphertext);
}
@@ -974,11 +974,11 @@ qemuDomainSecretInfoClear(qemuDomainSecretInfoPtr secinfo,
switch ((qemuDomainSecretInfoType) secinfo->type) {
case VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN:
- qemuDomainSecretPlainClear(secinfo->s.plain);
+ qemuDomainSecretPlainClear(&secinfo->s.plain);
break;
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
- qemuDomainSecretAESClear(secinfo->s.aes, keepAlias);
+ qemuDomainSecretAESClear(&secinfo->s.aes, keepAlias);
break;
case VIR_DOMAIN_SECRET_INFO_TYPE_LAST:
--
2.14.4
6 years, 6 months
[libvirt] [PATCH v2 0/2] nwfilter: fix IP address learning
by Daniel P. Berrangé
Changed in v2:
- Use if() instead of switch()
Daniel P. Berrangé (2):
nwfilter: fix IP address learning
nwfilter: directly use poll to wait for packets instead of pcap_next
src/nwfilter/nwfilter_learnipaddr.c | 55 ++++++++++++++++++++++-------
src/nwfilter/nwfilter_learnipaddr.h | 2 +-
2 files changed, 43 insertions(+), 14 deletions(-)
--
2.17.0
6 years, 6 months
[libvirt] [perl PATCH 0/6] Update RPM spec to match latest Fedora
by Daniel P. Berrangé
Syncing changes back from Fedora to follow best practice
Daniel P. Berrangé (6):
Remove obsolete RPM group tag
Replace search.cpan.org with metacpan.org
Remove commented out cruft leftover from Module::Build conversion
Remove obsolete %defattr statement
Use %license for LICENSE file instead of %doc
Modernize list of build deps to match actual required packages
perl-Sys-Virt.spec.PL | 45 ++++++++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 15 deletions(-)
--
2.17.0
6 years, 6 months
[libvirt] [PATCH v2 0/3] adding virGetLastErrorCode/Domain to paritally replace virGetLastError
by ramyelkest
Changes from v1[1]:
* removed virHasLastError() and s/virHasLastError/virGetLastErrorCode/g
* replaced in missed files: virmodule.c and virnetlibsshsession.c
* better split of patches
[1] https://www.redhat.com/archives/libvir-list/2018-May/msg00259.html
ramyelkest (3):
util: cleanup: using virGetLastErrorMessage instead of err->message
util: added virGetLastErrorCode/Domain
all: replacing virGetLastError with virGetLastErrorCode where we can
include/libvirt/virterror.h | 2 ++
src/libvirt_public.syms | 6 ++++++
src/locking/lock_driver_lockd.c | 3 +--
src/lxc/lxc_controller.c | 4 +---
src/qemu/qemu_agent.c | 3 +--
src/qemu/qemu_conf.c | 3 +--
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 12 ++++++------
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_migration.c | 4 ++--
src/qemu/qemu_monitor.c | 5 ++---
src/qemu/qemu_monitor_json.c | 2 +-
src/qemu/qemu_process.c | 4 ++--
src/remote/remote_driver.c | 3 +--
src/rpc/virnetclient.c | 2 +-
src/rpc/virnetlibsshsession.c | 4 +---
src/util/virerror.c | 42 +++++++++++++++++++++++++++++++++++++++++
src/util/virfilecache.c | 3 +--
src/util/virmodule.c | 3 +--
src/util/virxml.c | 4 ++--
tests/commandtest.c | 2 +-
tests/testutils.c | 6 ++----
tests/virhostcputest.c | 2 +-
tests/virstoragetest.c | 8 ++++----
tools/virsh-domain-monitor.c | 7 +++----
tools/virsh-domain.c | 4 +---
tools/virsh-util.c | 3 +--
tools/vsh.c | 2 +-
28 files changed, 90 insertions(+), 57 deletions(-)
--
2.7.4
6 years, 6 months
[libvirt] [PATCH] tests: use a fixed NBD TLS certificate path
by Daniel P. Berrangé
The default NBD TLS certificate path varies based on prefix given to
configure, causing tests to fail depending on build options.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as a build fix for CI
tests/qemuxml2argvdata/disk-drive-network-tlsx509.args | 4 ++--
tests/qemuxml2argvtest.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/qemuxml2argvdata/disk-drive-network-tlsx509.args b/tests/qemuxml2argvdata/disk-drive-network-tlsx509.args
index 970b8a32a6..e25f45742c 100644
--- a/tests/qemuxml2argvdata/disk-drive-network-tlsx509.args
+++ b/tests/qemuxml2argvdata/disk-drive-network-tlsx509.args
@@ -44,8 +44,8 @@ file.server.host=192.168.0.3,file.server.port=9999,format=raw,if=none,\
id=drive-virtio-disk2,serial=eb90327c-8302-4725-9e1b-4e85ed4dc252,cache=none \
-device virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk2,\
id=virtio-disk2 \
--object tls-creds-x509,id=objvirtio-disk3_tls0,dir=/etc/pki/qemu,\
-endpoint=client,verify-peer=yes \
+-object tls-creds-x509,id=objvirtio-disk3_tls0,dir=/etc/pki/libvirt-nbd/dummy,,\
+path,endpoint=client,verify-peer=yes \
-drive file.driver=nbd,file.server.type=inet,file.server.host=example.com,\
file.server.port=1234,file.tls-creds=objvirtio-disk3_tls0,format=raw,if=none,\
id=drive-virtio-disk3,cache=none \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 36bff26d33..8e5504f845 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -655,6 +655,9 @@ mymain(void)
VIR_FREE(driver.config->vxhsTLSx509certdir);
if (VIR_STRDUP_QUIET(driver.config->vxhsTLSx509certdir, "/etc/pki/libvirt-vxhs/dummy,path") < 0)
return EXIT_FAILURE;
+ VIR_FREE(driver.config->nbdTLSx509certdir);
+ if (VIR_STRDUP_QUIET(driver.config->nbdTLSx509certdir, "/etc/pki/libvirt-nbd/dummy,path") < 0)
+ return EXIT_FAILURE;
VIR_FREE(driver.config->hugetlbfs);
if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
@@ -2860,6 +2863,7 @@ mymain(void)
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
+ VIR_FREE(driver.config->nbdTLSx509certdir);
qemuTestDriverFree(&driver);
VIR_FREE(fakerootdir);
VIR_FREE(capslatest_x86_64);
--
2.17.0
6 years, 6 months
[libvirt] libvirt default machine-type guarantees? (was Re: [Qemu-devel] [PATCH RFC] hw/pc: set q35 as the default x86 machine)
by Eduardo Habkost
(CCing libvir-list)
On Tue, Jun 05, 2018 at 09:43:00AM +0100, Daniel P. Berrangé wrote:
> On Tue, Jun 05, 2018 at 09:27:46AM +0200, Gerd Hoffmann wrote:
> > Hi,
> >
> > > > Add to that shortcuts like -cdrom
> > > > stop working,
> > >
> > > Maybe is fixable.
> >
> > Already fixed for ages.
> >
> > > I see marking Q35 as the default machine a first step.
> >
> > Maybe the better option is to go the arm route: Just don't define a
> > default, so users have to specify pc or q35. That will make them notice
> > there is a world beside 'pc', and we also avoid breaking things
> > silently.
>
> If QEMU removes the default, then libvirt will have to hardcode
> 'pc' as the default to maintain back compatibility, so I don't
> think that ends up as a net win
Is there an actual promise to never change the default
machine-type documented in the libvirt API, or is this just fear
of breaking existing code?
--
Eduardo
6 years, 6 months
[libvirt] [PATCH v3 0/4] qemu: use FD passing for chardev UNIX sockets
by Daniel P. Berrangé
This series makes use of the chardev fd passing arriving in QEMU 2.12
to get rid of the startup race wrt opening the QEMU monitor. It is
actually enabled in all chardev UNIX sockets for sake of having the
same codepath everywhere, but is only important for the monitor socket.
Changed in v3:
- Refactor UNIX socket opening code to allow it to be mocked
in the unit tests to avoid creating real UNIX sockets
Daniel P. Berrangé (4):
qemu: probe for -chardev 'fd' parameter for FD passing
qemu: support passing pre-opened UNIX socket listen FD
qemu: don't retry connect() if doing FD passing
qemu: remove pointless connect retry logic in agent
src/qemu/qemu_agent.c | 84 ++-----------------
src/qemu/qemu_capabilities.c | 4 +-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 64 +++++++++++++-
src/qemu/qemu_command.h | 4 +
src/qemu/qemu_monitor.c | 54 +++++++-----
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_process.c | 27 ++++--
.../caps_2.12.0.aarch64.xml | 1 +
.../caps_2.12.0.ppc64.xml | 1 +
.../caps_2.12.0.s390x.xml | 1 +
.../caps_2.12.0.x86_64.xml | 1 +
tests/qemumonitortestutils.c | 1 +
.../disk-drive-write-cache.x86_64-latest.args | 3 +-
...irtio-scsi-reservations.x86_64-latest.args | 3 +-
tests/qemuxml2argvmock.c | 16 ++++
16 files changed, 153 insertions(+), 113 deletions(-)
--
2.17.0
6 years, 6 months
[libvirt] [PATCH 0/3] travis: Stop performing Ubuntu builds
by Andrea Bolognani
They're all failing at the moment anyway.
We'll get the Ubuntu coverage back as soon as we add Ubuntu
builders to the CentOS CI environment.
Andrea Bolognani (3):
travis: Stop performing Ubuntu builds
travis: Remove matrix
travis: Minor style tweaks
.travis.yml | 118 ++++++++--------------------------------------------
1 file changed, 17 insertions(+), 101 deletions(-)
--
2.17.1
6 years, 6 months
[libvirt] [PATCH] qemu: Fix detaching from persistent def in qemuDomainDetachDeviceAliasLiveAndConfig
by Peter Krempa
The code that detaches the device from persistent definition copies the
persistent definition first so that it can easily be rolled back. The
actual detaching is then made in the copy which is assigned back on
success (if the live operation succeeded as well).
This is not the case in qemuDomainDetachDeviceAliasLiveAndConfig where
the definition was copied and put back, but the detaching happened from
the other object which was overwritten.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c200c5a63d..b7b318896f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8822,14 +8822,13 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver,
if (persistentDef) {
virDomainDeviceDef dev;
- vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
- if (!vmdef)
+ if (!(vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt)))
goto cleanup;
- if (virDomainDefFindDevice(persistentDef, alias, &dev, true) < 0)
+ if (virDomainDefFindDevice(vmdef, alias, &dev, true) < 0)
goto cleanup;
- if (qemuDomainDetachDeviceConfig(persistentDef, &dev, caps,
+ if (qemuDomainDetachDeviceConfig(vmdef, &dev, caps,
parse_flags, driver->xmlopt) < 0)
goto cleanup;
}
--
2.16.2
6 years, 6 months
[libvirt] [PATCH] qemu: add entry for balloon stat stat-disk-caches
by Tomáš Golembiovský
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
include/libvirt/libvirt-domain.h | 9 ++++++++-
src/qemu/qemu_monitor_json.c | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index da773b76cb..b96c018a90 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -628,11 +628,18 @@ typedef enum {
/* Timestamp of the last update of statistics, in seconds. */
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE = 9,
+ /*
+ * The amount of memory, in bytes, that can be quickly reclaimed without
+ * additional I/O. Typically these pages are used for caching files from
+ * disk.
+ */
+ VIR_DOMAIN_MEMORY_STAT_DISK_CACHES = 10,
+
/*
* The number of statistics supported by this version of the interface.
* To add new statistics, add them to the enum and increase this value.
*/
- VIR_DOMAIN_MEMORY_STAT_NR = 10,
+ VIR_DOMAIN_MEMORY_STAT_NR = 11,
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 42d7b9c5e9..b0a65d8af9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2069,6 +2069,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
VIR_DOMAIN_MEMORY_STAT_AVAILABLE, 1024);
GET_BALLOON_STATS(statsdata, "stat-available-memory",
VIR_DOMAIN_MEMORY_STAT_USABLE, 1024);
+ GET_BALLOON_STATS(statsdata, "stat-disk-caches",
+ VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 1024);
GET_BALLOON_STATS(data, "last-update",
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 1);
ret = got;
--
2.17.0
6 years, 6 months