- 16 4月, 2015 4 次提交
-
-
由 Ján Tomko 提交于
These cannot be represented in XML. We have been stripping them, but only if the string had characters that needed escaping: <>"'& Extend the strcspn check to include control codes, and strip them even if we don't do any escaping. https://bugzilla.redhat.com/show_bug.cgi?id=1184131 https://bugzilla.redhat.com/show_bug.cgi?id=1066564 (cherry picked from commit aeb5262e) Signed-off-by: NJán Tomko <jtomko@redhat.com> Conflict: missing struct testBufAddStrData
-
由 Ján Tomko 提交于
To prevent generating invalid XML. https://bugzilla.redhat.com/show_bug.cgi?id=1066564 (cherry picked from commit 60db2bc8) Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
由 Ján Tomko 提交于
Including them in the XML makes them unparsable. https://bugzilla.redhat.com/show_bug.cgi?id=1184131 (cherry picked from commit 55710750) Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
由 Ján Tomko 提交于
Add virStringHasControlChars that checks if the string has any control characters other than \t\r\n, and virStringStripControlChars that removes them in-place. (cherry picked from commit 2a530a3e) Signed-off-by: NJán Tomko <jtomko@redhat.com> Conflicts: src/libvirt_private.syms src/util/virstring.c src/util/virstring.h tests/virstringtest.c virStringStripIPv6Brackets is not backported
-
- 10 4月, 2015 1 次提交
-
-
由 Michal Privoznik 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1182486 When updating a network and adding new ip-dhcp-host entry, the deamon may crash. The problem is, we iterate over existing <host/> entries trying to compare MAC addresses to see if there's already an existing rule. However, not all entries are required to have MAC address. For instance, the following is perfectly valid entry: <host id='00:04:58:fd:e4:15:1b:09:4c:0e:09:af:e4:d3:8c:b8:ca:1e' name='redhatipv6.redhat.com' ip='2001:db8:ca2:2::119'/> When the checking loop iterates over this, the entry's MAC address is accessed directly. Well, the fix is obvious - check if the address is defined before trying to compare it. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (cherry picked from commit 7d3ae359)
-
- 17 3月, 2015 1 次提交
-
-
由 Eric Blake 提交于
Commit 4f25146b (v1.2.8) managed to silence Coverity, but at the cost of a memory leak detected by valgrind: ==24129== 40 bytes in 5 blocks are definitely lost in loss record 355 of 637 ==24129== at 0x4A08B1C: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==24129== by 0x5084B8E: virReallocN (viralloc.c:245) ==24129== by 0x514D5AA: virDomainObjListExport (domain_conf.c:22200) ==24129== by 0x201227DB: qemuConnectListAllDomains (qemu_driver.c:18042) ==24129== by 0x51CC1B6: virConnectListAllDomains (libvirt-domain.c:6797) ==24129== by 0x14173D: remoteDispatchConnectListAllDomains (remote.c:1580) ==24129== by 0x121BE1: remoteDispatchConnectListAllDomainsHelper (remote_dispatch.h:1072) In short, every time a client calls a ListAll variant and asks for the resulting list, but there are 0 elements to return, we end up leaking the 1-entry array that holds the NULL terminator. What's worse, a read-only client can access these functions in a tight loop to cause libvirtd to eventually run out of memory; and this can be considered a denial of service attack against more privileged clients. Thankfully, the leak is so small (8 bytes per call) that you would already have some other denial of service with any guest calling the API that frequently, so an out-of-memory crash is unlikely enough that this did not warrant a CVE. * daemon/remote.c (remoteDispatchConnectListAllDomains) (remoteDispatchDomainListAllSnapshots) (remoteDispatchDomainSnapshotListAllChildren) (remoteDispatchConnectListAllStoragePools) (remoteDispatchStoragePoolListAllVolumes) (remoteDispatchConnectListAllNetworks) (remoteDispatchConnectListAllInterfaces) (remoteDispatchConnectListAllNodeDevices) (remoteDispatchConnectListAllNWFilters) (remoteDispatchConnectListAllSecrets) (remoteDispatchNetworkGetDHCPLeases): Plug leak. Signed-off-by: NEric Blake <eblake@redhat.com> (cherry picked from commit 3c2ff502) Signed-off-by: NEric Blake <eblake@redhat.com> Conflicts: daemon/remote.c - context with older cleanup styles
-
- 26 2月, 2015 2 次提交
-
-
由 Luyao Huang 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1196503 We already check whether the host id is valid or not, add a jump to forbid invalid host id. Signed-off-by: NLuyao Huang <lhuang@redhat.com> Signed-off-by: NJán Tomko <jtomko@redhat.com> (cherry picked from commit 719cd218)
- 14 2月, 2015 1 次提交
-
-
由 Luyao Huang 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1177194 When migrate a vm, we will generate a xml via qemuDomainDefFormatLive and pass this xml to target libvirtd. Libvirt will use the current network state in def->data.network.actual to generate the xml, this will make migrate failed when we set a network type guest interface use a macvtap network as a source in a vm then migrate vm to another host(which has the different macvtap network settings: different interface name, bridge name...) Add a flag check in virDomainNetDefFormat, if we set a VIR_DOMAIN_XML_MIGRATABLE flag when call virDomainNetDefFormat, we won't get the current vm interface state. Signed-off-by: NLuyao Huang <lhuang@redhat.com> Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 11 2月, 2015 1 次提交
-
-
由 Zhang Bo 提交于
The function virDomainVcpuPinDel() used vcpupin_list to stand for def->cputune.vcpupin, which made the codes more readable. However, in this function, it will realloc vcpupin_list later. As the definition of realloc(), it may free vcpupin_list and then points it to a new-realloced address, but def->cputune.vcpupin doesn't point to the new address(it's freed however). Thus, 1) When we refer to the def->cputune.vcpupin afterwards, which was freed by realloc(), an INVALID READ occurs, and libvirtd may crash. 2) As no one will use vcpupin_list any more, and no one frees it(it's just alloced by realloc()), memory leak occurs. Part of the valgrind logs are shown as below: ==1837== Thread 15: ==1837== Invalid read of size 8 ==1837== at 0x5367337: virDomainDefFormatInternal (domain_conf.c:18392) which is : virBufferAsprintf(buf, "<vcpupin vcpu='%u' ", def->cputune.vcpupin[i]->vcpuid); ==1837== by 0x536966C: virDomainObjFormat (domain_conf.c:18970) ==1837== by 0x5369743: virDomainSaveStatus (domain_conf.c:19166) ==1837== by 0x117B26DC: qemuDomainPinVcpuFlags (qemu_driver.c:4586) ==1837== by 0x53EA313: virDomainPinVcpuFlags (libvirt.c:9803) ==1837== by 0x14CB7D: remoteDispatchDomainPinVcpuFlags (remote_dispatch.h:6762) ==1837== by 0x14CC81: remoteDispatchDomainPinVcpuFlagsHelper (remote_dispatch.h:6740) ==1837== by 0x5464C30: virNetServerProgramDispatchCall (virnetserverprogram.c:437) ==1837== by 0x546507A: virNetServerProgramDispatch (virnetserverprogram.c:307) ==1837== by 0x171B83: virNetServerProcessMsg (virnetserver.c:172) ==1837== by 0x171E6E: virNetServerHandleJob (virnetserver.c:193) ==1837== by 0x5318E78: virThreadPoolWorker (virthreadpool.c:145) ==1837== Address 0x12ea2870 is 0 bytes inside a block of size 16 free'd ==1837== at 0x4C291AC: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==1837== by 0x52A3D14: virReallocN (viralloc.c:245) ==1837== by 0x52A3DFB: virShrinkN (viralloc.c:372) ==1837== by 0x52A3F57: virDeleteElementsN (viralloc.c:503) ==1837== by 0x533939E: virDomainVcpuPinDel (domain_conf.c:15405) //doReset为true时才会进到。 ==1837== by 0x117B2642: qemuDomainPinVcpuFlags (qemu_driver.c:4573) ==1837== by 0x53EA313: virDomainPinVcpuFlags (libvirt.c:9803) ==1837== by 0x14CB7D: remoteDispatchDomainPinVcpuFlags (remote_dispatch.h:6762) ==1837== by 0x14CC81: remoteDispatchDomainPinVcpuFlagsHelper (remote_dispatch.h:6740) ==1837== by 0x5464C30: virNetServerProgramDispatchCall (virnetserverprogram.c:437) ==1837== by 0x546507A: virNetServerProgramDispatch (virnetserverprogram.c:307) ==1837== by 0x171B83: virNetServerProcessMsg (virnetserver.c:172) Steps to reproduce the problem: 1) use virDomainPinVcpuFlags() to pin a guest's vcpu to all the pcpus of the host. This patch uses def->cputune.vcpupin instead of vcpupin_list to do the realloc() job, to avoid invalid read or memory leaking. Signed-off-by: NZhang Bo <oscar.zhangbo@huawei.com> Signed-off-by: Yue Wenyuan <yuewenyuan@huawei.com@huawei.com> (cherry picked from commit 2d27dcb0) Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
- 08 2月, 2015 3 次提交
-
-
由 Cole Robinson 提交于
-
由 Peter Krempa 提交于
If a storage file would be backed with a NBD device without path (nbd://localhost) libvirt would crash when parsing the backing path for the disk as the URI structure's path element is NULL in such case but the NBD parser would access it shamelessly. (cherry picked from commit fdb80ed4)
-
由 Wang Rui 提交于
If the memory mode is specified as 'strict' and with one node, we get the following error when starting domain. error: Unable to write to '$cgroup_path/cpuset.mems': Device or resource busy XML is configured with numatune as follows: <numatune> <memory mode='strict' nodeset='0'/> </numatune> It's broken by Commit 411cea63 which moved qemuSetupCgroupForEmulator() before setting cpuset.mems in qemuSetupCgroupPostInit. Directory '$cgroup_path/emulator/' is created in qemuSetupCgroupForEmulator. But '$cgroup_path/emulator/cpuset.mems' it not set and has a default value (all nodes, such as 0-1). Then we setup '$cgroup_path/cpuset.mems' to the nodemask (in this case it's '0') in qemuSetupCgroupPostInit. It must fail. This patch makes '$cgroup_path/emulator/cpuset.mems' is set before '$cgroup_path/cpuset.mems'. The action is similar with that in qemuDomainSetNumaParamsLive. Signed-off-by: NWang Rui <moon.wangrui@huawei.com> (cherry picked from commit c6e90248)
-
- 02 2月, 2015 1 次提交
-
-
由 John Ferlan 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1176510 When storageDriverAutostart is called path virStateReload via a 'service libvirtd reload', then because the volume list in the pool wasn't cleared prior to the call, each volume would be listed multiple times (as many times as we reload). I believe the issue would be introduced by commit id '9e093f0b' at least for the libvirtd reload path, although I suppose the introduction of virStateReload (commit id '70da0494') could be a different cause. Thus like other places prior to calling refreshPool, we need to call virStoragePoolObjClearVols (cherry picked from commit 1d2e4d8c)
-
- 30 1月, 2015 1 次提交
-
-
由 Michal Privoznik 提交于
The function is called from all {Attach,Update,Detach}Device APIs to create config strings that are later passed to the xend to perform the desired action. The function is intended to handle all supported devices. However, as of 5b05358a we are trying to get disk driver of the device without checking if the device really is a disk. This leads to an segmentation fault: #0 0x00007ffff7571815 in virDomainDiskGetDriver () from /usr/lib/libvirt.so.0 #1 0x00007fffeb9ad471 in ?? () from /usr/lib/libvirt/connection-driver/libvirt_driver_xen.so #2 0x00007fffeb9b1062 in xenDaemonAttachDeviceFlags () from /usr/lib/libvirt/connection-driver/libvirt_driver_xen.so #3 0x00007fffeb9a8a86 in ?? () from /usr/lib/libvirt/connection-driver/libvirt_driver_xen.so #4 0x00007ffff7609266 in virDomainAttachDevice () from /usr/lib/libvirt.so.0 #5 0x0000555555593c9d in ?? () #6 0x00007ffff76743c9 in virNetServerProgramDispatch () from /usr/lib/libvirt.so.0 #7 0x00005555555a678d in ?? () #8 0x00007ffff755460e in ?? () from /usr/lib/libvirt.so.0 #9 0x00007ffff7553b06 in ?? () from /usr/lib/libvirt.so.0 #10 0x00007ffff4998b50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #11 0x00007ffff46e30ed in clone () from /lib/x86_64-linux-gnu/libc.so.6 #12 0x0000000000000000 in ?? () Reported-by: NXiaolin Su <linxxnil@126.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (cherry picked from commit cd7702d4)
-
- 23 1月, 2015 2 次提交
-
-
由 Peter Krempa 提交于
The ACL check didn't check the VIR_DOMAIN_XML_SECURE flag and the appropriate permission for it. Found via code inspection while fixing permissions for save images. (cherry picked from commit b347c0c2)
-
由 Peter Krempa 提交于
The ACL check didn't check the VIR_DOMAIN_XML_SECURE flag and the appropriate permission for it. (cherry picked from commit 03c3c0c8)
-
- 22 1月, 2015 3 次提交
-
-
由 Luyao Huang 提交于
Output error when we try to set a too large max_sectors. Just like queues and cmd_per_lun here. Signed-off-by: NLuyao Huang <lhuang@redhat.com> (cherry picked from commit ce1d2f63) Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
由 Ján Tomko 提交于
Commit ca91ba78 moved qemuSetupDiskCgroup into the qemuDomainPrepareDisk helper, but failed to call it for usb disks. https://bugzilla.redhat.com/show_bug.cgi?id=1175668` (cherry picked from commit 1cddf000) Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
由 Luyao Huang 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1181408 When we try to hotplug a channel chr device with no target, we will get success (which should fail) in virDomainChrDefParseXML, because we use goto cleanup this place and return an incomplete definition (with no target). In qemuDomainAttachChrDevice, we add it to the domain definition, but fail to remove it from there when chardev-add fails, because virDomainChrRemove matches chardevices according to the target name. The device definition is then freed in qemuDomainAttachDeviceFlags, leaving a stale pointer in the domain definition. Signed-off-by: NLuyao Huang <lhuang@redhat.com> Signed-off-by: NJán Tomko <jtomko@redhat.com> (cherry picked from commit fba7173f) Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
- 23 12月, 2014 2 次提交
-
-
由 Peter Krempa 提交于
Avoid leaving the domain locked on a failed ACL check in qemuDomainMigratePerform() and qemuDomainMigrateFinish2(). Introduced in commit abf75aea (Add ACL checks into the QEMU driver). (cherry picked from commit 2bdcd29c)
-
由 Luyao Huang 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1087104#c5 When trying to use an invalid offset to virStorageVolUpload(), libvirt fails in virFDStreamOpenFileInternal(), although it seems libvirt does not check the return in storageVolUpload(), and calls virFDStreamSetInternalCloseCb() right after. But stream doesn't have a privateData (is NULL) yet, and the daemon crashes then. 0 0x00007f09429a9c10 in pthread_mutex_lock () from /lib64/libpthread.so.0 1 0x00007f094514dbf5 in virMutexLock (m=<optimized out>) at util/virthread.c:88 2 0x00007f09451cb211 in virFDStreamSetInternalCloseCb at fdstream.c:795 3 0x00007f092ff2c9eb in storageVolUpload at storage/storage_driver.c:2098 4 0x00007f09451f46e0 in virStorageVolUpload at libvirt.c:14000 5 0x00007f0945c78fa1 in remoteDispatchStorageVolUpload at remote_dispatch.h:14339 6 remoteDispatchStorageVolUploadHelper at remote_dispatch.h:14309 7 0x00007f094524a192 in virNetServerProgramDispatchCall at rpc/virnetserverprogram.c:437 Signed-off-by: NLuyao Huang <lhuang@redhat.com> (cherry picked from commit 87b9437f)
-
- 11 12月, 2014 1 次提交
-
-
由 Francesco Romani 提交于
A logic bug in qemuConnectGetAllDomainStats makes the code mark the monitor as available when qemuDomainObjBeginJob fails, instead of when it succeeds, as the correct flow requires. This patch fixes the check and updates the code documentation accordingly. Broken by commit 57023c0a. Signed-off-by: NFrancesco Romani <fromani@redhat.com> (cherry picked from commit cb104ef7) Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 10 12月, 2014 1 次提交
-
-
由 Martin Kletzander 提交于
When user doesn't have read access on one of the domains he requested, the for loop could exit abruptly or continue and override pointer which pointed to locked object. This patch fixed two issues at once. One is that domflags might have had QEMU_DOMAIN_STATS_HAVE_JOB even when there was no job started (this is fixed by doing domflags |= QEMU_DOMAIN_STATS_HAVE_JOB only when the job was acquired and cleaning domflags on every start of the loop. Second one is that the domain is kept locked when virConnectGetAllDomainStatsCheckACL() fails and continues the loop when it didn't end. Adding a simple virObjectUnlock() and clearing the pointer ought to do. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com> (cherry picked from commit 57023c0a) Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 03 12月, 2014 2 次提交
-
-
由 Michal Privoznik 提交于
As discussed on the upstream list, it's better not to make this kind of predictions in libvirt. It may happen that qemu learns how to enable OVMF on other architectures too and we shouldn't try to chase that. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (cherry picked from commit 36148120)
-
由 Michal Privoznik 提交于
Currently, we are whitelisting architectures, that we know how to run OVMF on. So far, only x86_64 was enabled. However, looking at qemu code, the same commandline can be used to enable OVMF for armv7l and aarch64. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (cherry picked from commit 6d8054b6)
-
- 16 11月, 2014 14 次提交
-
-
由 Cole Robinson 提交于
-
由 Jiri Denemark 提交于
Since QEMU 1.2.0, we switched to QMP probing instead of parsing -help (and other commands, such as -cpu ?) output. However, if QMP probing failed, we still tried starting QEMU with various options and parsing the output, which was guaranteed to fail because the output changed. Let's just refuse parsing -help for QEMU >= 1.2.0. https://bugzilla.redhat.com/show_bug.cgi?id=1160318Signed-off-by: NJiri Denemark <jdenemar@redhat.com> (cherry picked from commit ae3e29e6) Conflicts: tests/qemuhelptest.c
-
由 Jiri Denemark 提交于
We used to set migration capabilities only when a user asked for them in flags. This is fine when migration succeeds since the QEMU process is killed in the end but in case migration fails or if it's cancelled, some capabilities may remain turned on with no way to turn them off. To fix that, migration capabilities have to be turned on if requested but explicitly turned off in case they were not requested but QEMU supports them. https://bugzilla.redhat.com/show_bug.cgi?id=1163953Signed-off-by: NJiri Denemark <jdenemar@redhat.com> (cherry picked from commit ab393383)
-
由 Pavel Hrdina 提交于
Commit 6e5c79a1 tried to fix deadlock between nwfilter{Define,Undefine} and starting of guest, but this same deadlock exists for updating/attaching network device to domain. The deadlock was introduced by removing global QEMU driver lock because nwfilter was counting on this lock and ensure that all driver locks are locked inside of nwfilter{Define,Undefine}. This patch extends usage of virNWFilterReadLockFilterUpdates to prevent the deadlock for all possible paths in QEMU driver. LXC and UML drivers still have global lock. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143780Signed-off-by: NPavel Hrdina <phrdina@redhat.com> (cherry picked from commit 41127244)
-
由 Michal Privoznik 提交于
In one of my previous patches (3a3c3780) I've tried to fix the problem of nvram path disappearing on a domain that's been started and shut down again. I fixed this by explicitly saving domain's config file. However, I did a bit of clumsy without realizing we have a transient domains for which we don't save the config file. Hence, any domain using UEFI became persistent. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (cherry picked from commit 54ddc08d)
-
由 Ján Tomko 提交于
virStorageFileBackendGlusterInit did not check nhosts. https://bugzilla.redhat.com/show_bug.cgi?id=1162974 (cherry picked from commit b66288fa)
-
由 Ján Tomko 提交于
virDomainChrSourceDefIsEqual should return 'true' for identical SPICEVMC chardevs, and those that have no source specification. After this change, a failed hotplug no longer leaves a stale pointer in the domain definition. https://bugzilla.redhat.com/show_bug.cgi?id=1162097 (cherry picked from commit b987684f)
-
由 Michal Privoznik 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1160084 As of b6d4dad1 (1.2.5) libvirt keeps track if domain disks have been frozen. However, this falls into that set of information which don't survive domain restart. Therefore, we need to clear the flag upon some state transitions. Moreover, once we clear the flag we must update the status file too. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (cherry picked from commit 6ea54769)
-
由 Luyao Huang 提交于
When start a network fail, libvirt still call virNetworkEventLifecycleNew to send a event. Signed-off-by: NLuyao Huang <lhuang@redhat.com> (cherry picked from commit 45d9ea5c)
-
由 Ján Tomko 提交于
A domain without a console quietly dies soon after start, because we try to set /dev/null as a controlling TTY 2014-10-30 15:10:59.705+0000: 1: error : lxcContainerSetupFDs:283 : ioctl(TIOCSCTTY) failed: Inappropriate ioctl for device Report an error early instead of trying to start it. https://bugzilla.redhat.com/show_bug.cgi?id=1155410 (cherry picked from commit 44686f65)
-
由 Ján Tomko 提交于
It fails after 30 seconds with this error: error : virDBusCall:1429 : error from service: CanSuspend: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. Only probe for the power mgmt capabilities when driver is non-NULL. This speeds up domain startup by 30 seconds. https://bugzilla.redhat.com/show_bug.cgi?id=1159227 (cherry picked from commit 7ead1a5d)
-
由 Martin Kletzander 提交于
Coverity found out the very obvious problem in the code. That is that virPidFileReleasePath() was called only if virPidFileAcquirePath() returned 0. But virPidFileAcquirePath() doesn't return only 0 on success, but the FD that needs to be closed. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com> (cherry picked from commit 3f43bb83)
-
由 Weiwei Li 提交于
In qemuMigrationFinish mig->nbd can not be initialized by qemuMigrationEatCookie without the QEMU_MIGRATION_COOKIE_NBD flag. That causes qemuMigrationStopNBDServer to return early without stopping the NBD server properly. Signed-off-by: NWeiwei Li <nuonuoli@tencent.com> Signed-off-by: NJán Tomko <jtomko@redhat.com> (cherry picked from commit c3012a02)
-