1. 30 6月, 2016 1 次提交
  2. 16 12月, 2015 2 次提交
    • E
      CVE-2015-5313: storage: don't allow '/' in filesystem volume names · 53ae31bf
      Eric Blake 提交于
      The libvirt file system storage driver determines what file to
      act on by concatenating the pool location with the volume name.
      If a user is able to pick names like "../../../etc/passwd", then
      they can escape the bounds of the pool.  For that matter,
      virStoragePoolListVolumes() doesn't descend into subdirectories,
      so a user really shouldn't use a name with a slash.
      
      Normally, only privileged users can coerce libvirt into creating
      or opening existing files using the virStorageVol APIs; and such
      users already have full privilege to create any domain XML (so it
      is not an escalation of privilege).  But in the case of
      fine-grained ACLs, it is feasible that a user can be granted
      storage_vol:create but not domain:write, and it violates
      assumptions if such a user can abuse libvirt to access files
      outside of the storage pool.
      
      Therefore, prevent all use of volume names that contain "/",
      whether or not such a name is actually attempting to escape the
      pool.
      
      This changes things from:
      
      $ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
      Vol ../../../../../../etc/haha created
      $ rm /etc/haha
      
      to:
      
      $ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
      error: Failed to create vol ../../../../../../etc/haha
      error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 034e47c3)
      53ae31bf
    • D
      avoid using deprecated udev logging functions · bedc89b2
      Daniel P. Berrange 提交于
      In systemd >= 218, the udev_set_log_fn method has been marked
      deprecated and turned into a no-op. Nothing in the udev client
      library will print to stderr by default anymore, so we can
      just stop installing a logging hook for new enough udev.
      
      (cherry picked from commit a93a3b97)
      bedc89b2
  3. 03 9月, 2015 1 次提交
    • M
      remoteClientCloseFunc: Don't mangle connection object refcount · 7abaa29f
      Michal Privoznik 提交于
      Well, in 8ad126e6 we tried to fix a memory corruption problem.
      However, the fix was not as good as it could be. I mean, the
      commit has one line more than it should. I've noticed this output
      just recently:
      
        # ./run valgrind --leak-check=full --show-reachable=yes ./tools/virsh domblklist gentoo
        ==17019== Memcheck, a memory error detector
        ==17019== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
        ==17019== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
        ==17019== Command: /home/zippy/work/libvirt/libvirt.git/tools/.libs/virsh domblklist gentoo
        ==17019==
        Target     Source
        ------------------------------------------------
        fda        /var/lib/libvirt/images/fd.img
        vda        /var/lib/libvirt/images/gentoo.qcow2
        hdc        /home/zippy/tmp/install-amd64-minimal-20150402.iso
      
        ==17019== Thread 2:
        ==17019== Invalid read of size 4
        ==17019==    at 0x4EFF5B4: virObjectUnref (virobject.c:258)
        ==17019==    by 0x5038CFF: remoteClientCloseFunc (remote_driver.c:552)
        ==17019==    by 0x5069D57: virNetClientCloseLocked (virnetclient.c:685)
        ==17019==    by 0x506C848: virNetClientIncomingEvent (virnetclient.c:1852)
        ==17019==    by 0x5082136: virNetSocketEventHandle (virnetsocket.c:1913)
        ==17019==    by 0x4ECD64E: virEventPollDispatchHandles (vireventpoll.c:509)
        ==17019==    by 0x4ECDE02: virEventPollRunOnce (vireventpoll.c:658)
        ==17019==    by 0x4ECBF00: virEventRunDefaultImpl (virevent.c:308)
        ==17019==    by 0x130386: vshEventLoop (vsh.c:1864)
        ==17019==    by 0x4F1EB07: virThreadHelper (virthread.c:206)
        ==17019==    by 0xA8462D3: start_thread (in /lib64/libpthread-2.20.so)
        ==17019==    by 0xAB441FC: clone (in /lib64/libc-2.20.so)
        ==17019==  Address 0x139023f4 is 4 bytes inside a block of size 240 free'd
        ==17019==    at 0x4C2B1F0: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==17019==    by 0x4EA8949: virFree (viralloc.c:582)
        ==17019==    by 0x4EFF6D0: virObjectUnref (virobject.c:273)
        ==17019==    by 0x4FE74D6: virConnectClose (libvirt.c:1390)
        ==17019==    by 0x13342A: virshDeinit (virsh.c:406)
        ==17019==    by 0x134A37: main (virsh.c:950)
      
      The problem is, when registering remoteClientCloseFunc(), it's
      conn->closeCallback which is ref'd. But in the function itself
      it's conn->closeCallback->conn what is unref'd. This is causing
      imbalance in reference counting. Moreover, there's no need for
      the remote driver to increase/decrease conn refcount since it's
      not used anywhere. It's just merely passed to client registered
      callback. And for that purpose it's correctly ref'd in
      virConnectRegisterCloseCallback() and then unref'd in
      virConnectUnregisterCloseCallback().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit e6893007)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      7abaa29f
  4. 29 8月, 2015 1 次提交
  5. 17 6月, 2015 1 次提交
    • E
      lxc: set nosuid+nodev+noexec flags on /proc/sys mount · a354750e
      Eric W. Biederman 提交于
      Future kernels will mandate the use of nosuid+nodev+noexec
      flags when mounting the /proc/sys filesystem. Unconditionally
      add them now since they don't harm things regardless and could
      mitigate future security attacks.
      
      (cherry picked from commit 24710414)
      
      Conflicts:
          src/lxc/lxc_container.c
      a354750e
  6. 22 5月, 2015 1 次提交
    • T
      conf: fix issue on virCPUDefCopy · bacc762b
      Thibaut Collet 提交于
      The cpu xml copy is incorrect: the memAccess field is not copied.
      The lack of copy of this memAccess field can cause unexpected behaviour for live
      migration when vhost user is used.
      
      For example if guest has the following configuration:
      ....
      <cpu>
      <model>Westmere</model>
      <topology sockets="1" cores="4" threads="1"/>
      <numa>
      <cell id='0' cpus='0-3' memory='2097152' memAccess='shared'/>
      </numa>
      </cpu>
      ....
      
      The used configuration on the remote host in case of live migration is:
      ....
        <cpu mode='custom' match='exact'>
          <model fallback='allow'>Westmere</model>
          <topology sockets='1' cores='4' threads='1'/>
          <numa>
            <cell id='0' cpus='0-3' memory='2097152' unit='KiB'/>
          </numa>
        </cpu>
      ....
      
      On the remote host the lack of memAccess info can cause unexpected error on the
      qemu backend vhost user driver.
      
      Fixes: def6b359 ("docs, conf, schema: add support for shared memory mapping")
      
      This issue is present only for libvirt1.2.9 to libvirt1.2.12
      With patch 181742d4 ("conf: Move all NUMA configuration to virDomainNuma")
      present since libvirt1.2.13 the problem does not exist anymore as NUMA
      information are no more in the CPU configuration.
      Signed-off-by: NThibaut Collet <thibaut.collet@6wind.com>
      bacc762b
  7. 17 3月, 2015 1 次提交
    • E
      daemon: avoid memleak when ListAll returns nothing · 70461a11
      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
      70461a11
  8. 23 1月, 2015 2 次提交
  9. 23 12月, 2014 2 次提交
    • P
      qemu: migration: Unlock vm on failed ACL check in protocol v2 APIs · 2a121c63
      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)
      2a121c63
    • L
      storage: fix crash caused by no check return before set close · c89df369
      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)
      c89df369
  10. 11 12月, 2014 1 次提交
  11. 10 12月, 2014 1 次提交
    • M
      CVE-2014-8131: Fix possible deadlock and segfault in qemuConnectGetAllDomainStats() · a20e818c
      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>
      a20e818c
  12. 28 11月, 2014 1 次提交
    • W
      qemu: fix domain startup failing with 'strict' mode in numatune · 0d005dd1
      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)
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      0d005dd1
  13. 06 11月, 2014 1 次提交
    • E
      CVE-2014-7823: dumpxml: security hole with migratable flag · 11219f40
      Eric Blake 提交于
      Commit 28f8dfdc (v1.0.0) introduced a security hole: in at least
      the qemu implementation of virDomainGetXMLDesc, the use of the
      flag VIR_DOMAIN_XML_MIGRATABLE (which is usable from a read-only
      connection) triggers the implicit use of VIR_DOMAIN_XML_SECURE
      prior to calling qemuDomainFormatXML.  However, the use of
      VIR_DOMAIN_XML_SECURE is supposed to be restricted to read-write
      clients only.  This patch treats the migratable flag as requiring
      the same permissions, rather than analyzing what might break if
      migratable xml no longer includes secret information.
      
      Fortunately, the information leak is low-risk: all that is gated
      by the VIR_DOMAIN_XML_SECURE flag is the VNC connection password;
      but VNC passwords are already weak (FIPS forbids their use, and
      on a non-FIPS machine, anyone stupid enough to trust a max-8-byte
      password sent in plaintext over the network deserves what they
      get).  SPICE offers better security than VNC, and all other
      secrets are properly protected by use of virSecret associations
      rather than direct output in domain XML.
      
      * src/remote/remote_protocol.x (REMOTE_PROC_DOMAIN_GET_XML_DESC):
      Tighten rules on use of migratable flag.
      * src/libvirt-domain.c (virDomainGetXMLDesc): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit b1674ad5)
      11219f40
  14. 03 11月, 2014 1 次提交
  15. 01 11月, 2014 6 次提交
    • P
      hotplug: fix char device detach · e7e05801
      Pavel Hrdina 提交于
      Hotplugging and hotunplugging char devices is only supported through
      '-device' and the check for device capability should be independently.
      
      Coverity also complains about 'tmpChr->info.alias' could be NULL and we
      are dereferencing it but it somehow only in this case don't recognize
      that the value is set by 'qemuAssignDeviceChrAlias' so it's clearly
      false positive. Add sa_assert to make coverity happy.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      e7e05801
    • P
      vbox_storage: fix coverity issue with overwriting value · bddf8561
      Pavel Hrdina 提交于
      Coverity is complaining about overwriting value in 'rc' variable
      without using the old value because it somehow doesn't recognize that
      the value is used by MACRO. The 'rc' variable is there only for checking
      return code so it's save to remove it and make coverity happy.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      bddf8561
    • J
      Relax duplicate SCSI host pool checking · 59389231
      Ján Tomko 提交于
      Since commit 3f99d64d no new scsi_host pools can be defined
      if one of the already defined scsi_host pools does not refer
      to an accessible scsi_host adapter.
      
      Relax the check by skipping over these inaccessible pools
      when checking for duplicates.
      59389231
    • J
      Match scsi_host pools by parent address first · 77911d30
      Ján Tomko 提交于
      If both source adapters are specified by a parent address,
      just comparing the address is faster and catches even addresses
      that do not refer to valid adapters.
      77911d30
    • P
      mingw: fix build failure · d91c8e64
      Pavel Hrdina 提交于
      This macro seems to be defined only on linux/unix and it fails during
      mingw build. Its value is '16' (taken from net/if.h) so define it if
      it's not defined.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      d91c8e64
    • E
      domain: fix parsing of memory tunables on 32-bit machines · 9998a657
      Eric Blake 提交于
      Commit 6c9a8a49 (Oct 2014) exposed a long-standing issue on 32-bit
      machines: code related to virDomainSetMemoryParameters has always
      been documented as using a 64-bit limit, but it was implemented by
      calling virDomainParseMemory which enforced an 'unsigned long'
      limit.  Since VIR_DOMAIN_MEMORY_PARAM_UNLIMITED capped to a
      long is -1, but virDomainParseScaledValue no longer accepts
      negative values, an attempt to use 2^53-1 as a hard memory limit
      started failing the testsuite.  However, the problem with capping
      things artificially low has existed for much longer - ever since
      commits 4888f0fb and 2e22f23b (Mar 2012) switched internal tracking
      from 'unsigned long' to 'unsigned long long' (prior to that time,
      the cap was a side-effect of the choice of types).  We _have_ to
      cap the balloon memory values, (no thanks to baked in 'unsigned long'
      of API such as virDomainSetMaxMemory or virDomainGetInfo with no
      counterpart API that guarantees 64-bit access to those numbers)
      but memory parameters have never needed the artificial limit.
      
      At any rate, the solution is to make the parser function gain a
      parameter, and only do the reduced 32-bit cap for the values that
      are constrained due to API.
      
      * src/conf/domain_conf.h (_virDomainMemtune): Add comments.
      * src/conf/domain_conf.c (virDomainParseMemory): Add parameter.
      (virDomainDefParseXML): Adjust callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9998a657
  16. 31 10月, 2014 4 次提交
    • W
      qemu: Release nbd port from migrationPorts instead of remotePorts · be598c5f
      weiwei li 提交于
      commit 3e1e16aa (Use a port from the
      migration range for NBD as well) changed ndb port allocation from
      remotePorts to migrationPorts, but did not change the port releasing
      process, which makes an error when migrating several times (above 64):
      error: internal error: Unable to find an unused port in range
      'migration' (49152-49215)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1159245Signed-off-by: NWeiwei Li <nuonuoli@tencent.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      be598c5f
    • J
      libxl: fix double-free of libxl_domain_build_info · 720be2eb
      Jim Fehlig 提交于
      On error, libxlMakeDomBuildInfo() frees the caller-provided
      libxl_domain_build_info struct embedded in libxl_domain_config,
      causing a segfault
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x7f9c13020700 (LWP 40988)]
      (gdb) bt
      0  0x00007f9c162f95b4 in free () from /lib64/libc.so.6
      1  0x00007f9c0d0965ad in libxl_bitmap_dispose () from
         /usr/lib64/libxenlight.so.4.4
      2  0x00007f9c0d0a73bf in libxl_domain_build_info_dispose ()
         from /usr/lib64/libxenlight.so.4.4
      3  0x00007f9c0d0a7974 in libxl_domain_config_dispose () from
         /usr/lib64/libxenlight.so.4.4
      4  0x00007f9c0d2e00c5 in libxlDomainStart (driver=0x7f9c0400e4e0,
         vm=0x7f9c0412b0d0, start_paused=false, restore_fd=-1) at
         libxl/libxl_domain.c:1323
      5  0x00007f9c0d2e1d4b in libxlDomainCreateXML (conn=0x7f9c000009a0,...)
         at libxl/libxl_driver.c:660
      
      Remove the call to libxl_domain_build_info_dispose() from
      libxlMakeDomBuildInfo().  On error, callers will dispose the
      libxl_domain_config object, which in turn disposes the build info.
      720be2eb
    • J
      libxl: Support user-specified <emulator> · 1c0bf509
      Jim Fehlig 提交于
      With the introduction of the libxlDomainGetEmulatorType function,
      it is trivial to support a user-specfied <emulator> in the libxl
      driver.  This patch is based loosely on David Scott's old patch
      to do the same
      
      https://www.redhat.com/archives/libvir-list/2013-April/msg02119.htmlSigned-off-by: NJim Fehlig <jfehlig@suse.com>
      1c0bf509
    • J
      Spell TIOCSCTTY right in the error message · b43e6662
      Ján Tomko 提交于
      b43e6662
  17. 30 10月, 2014 12 次提交
    • J
    • M
      conf: forbid negative values in virDomainParseScaledValue · 6c9a8a49
      Martin Kletzander 提交于
      It makes sense for none of the callers to have negative value as an
      output and, fortunately, if anyone tried defining domain with negative
      memory or any other value parsed by virDomainParseScaledValue(), the
      resulting value was 0.  That means we can error out during parsing as
      it won't break anything.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1155843Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      6c9a8a49
    • L
      virsh: Fix memory leak in cmdNetworkDHCPLeases · 089663ae
      Luyao Huang 提交于
      After cidr_format is allocated by virAsprintf and used by vshPrintExtra
      it needs to be freed.
      
      Fix the following memory leak from valgrind:
       18 bytes in 1 blocks are definitely lost in loss record 41 of 192
          at 0x4C29BBD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
          by 0x85CE36F: __vasprintf_chk (vasprintf_chk.c:80)
          by 0x4EE52D5: UnknownInlinedFun (stdio2.h:210)
          by 0x4EE52D5: virVasprintfInternal (virstring.c:459)
          by 0x4EE53CA: virAsprintfInternal (virstring.c:480)
          by 0x14FE96: cmdNetworkDHCPLeases (virsh-network.c:1378)
          by 0x13006B: vshCommandRun (virsh.c:1915)
          by 0x12A9E1: main (virsh.c:3699)
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      089663ae
    • R
      virutil: fix virGetSCSIHostNumber stub return type · 44178b8e
      Roman Bogorodskiy 提交于
      The virGetSCSIHostNumber function return type is int, however
      its stubbed version returns NULL. That results in a build fail
      on systems that use the stubbed version. Fix by using a proper
      return type.
      44178b8e
    • R
      virnetdev: stub virNetDev{Add,Del}Multi on FreeBSD · 00fa136d
      Roman Bogorodskiy 提交于
      Currently, build fails on FreeBSD because its struct ifreq does not
      have ifr_hwaddr member. In order to fix that, check if this member
      is present, otherwise fall back to the stub version of the
      virNetDev{Add,Del}Multi functions.
      00fa136d
    • J
      virnetdev: Resolve Coverity RESOURCE_LEAK · 9babbaa5
      John Ferlan 提交于
      virFileReadAll returns a chunk of memory that needs to be free'd when
      done
      9babbaa5
    • J
      virnetdev: Resolve Coverity FORWARD_NULL · f099726c
      John Ferlan 提交于
      The complaint is that if cleanup is called when virFileReadAll fails,
      then mcast->entries is NULL and could be dereferenced in the clear
      function. After following the code some - I saw that the caller to
      the function (virNetDevGetMulticastTable) will also call
      virNetDevMcastListClear if this function returns -1, so this
      isn't necessary, so I removed the call.
      f099726c
    • J
      virnetdev: Resolve Coverity DEADCODE · 764deecb
      John Ferlan 提交于
      Coverity complains that because the for loop is from 0 to 5 (max tokens)
      and the impending switch/case statements used each of the #define values
      that the 'default' wouldn't reachable. This patch will convert the #define's
      into enum's and add the obligatory dead_error_begin marker for these type
      situations.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      764deecb
    • C
    • E
      qemu: better error message when block job can't succeed · 00331bfb
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1140981 reports that
      the qemu-kvm shipped as part of RHEL 7.0 intentionally[1] cripples
      block jobs by removing the 'block-stream' QMP command, while still
      leaving 'block-job-cancel' as an unusable no-op.  Meanwhile, we
      already had existing code that checked whether block jobs were
      completely missing (such as qemu 0.15), old style (cancel is
      synchronous, and all commands spelled with '_'), or new style
      (cancel is asynchronous, and all commands spelled with '-'), and
      used that three-way probe to give decent error messages.  At the
      time that code was added, all existing qemu versions fell in one
      of three buckets, and the code was using the presence of
      'block-job-cancel' as the witness of which of the three buckets.
      But now that RHEL qemu has shipped with intentionally crippled
      'block-stream', we have a fourth bucket, which results in ugly
      error messages when trying 'virsh blockpull':
      
       error: Requested operation is not valid: Command 'block-stream' is not found
      
      In reality, the fourth bucket should be treated the same as the
      first bucket (no block job support); we can do that by realizing
      that no existing build of qemu has working block-stream while
      lacking block-job-cancel, so it is easiest to change our witness
      to the command that starts a job rather than ends one.  We still
      act correctly regarding command spelling and whether cancel is
      asynchronous.  And on crippled RHEL builds, we now get the desired:
      
       error: unsupported configuration: block jobs not supported with this qemu binary
      
      [1] The intentional cripple is limited to qemu-kvm of RHEL; when using
      qemu-kvm-rhev of RHEV, block job functionality is supported.  Don't ask
      me to explain the "why" behind it all - I'm just dealing with fallout
      from someone else's decision.
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_BLOCKJOB_SYNC): Tweak comment.
      * src/qemu/qemu_capabilities.c (virQEMUCapsCommands): Look for stream
      rather than cancel when determining the flavor of block jobs supported.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      00331bfb
    • P
      test: Add test to verify helpers used for backing file name parsing · 95a56835
      Peter Krempa 提交于
      Add two test cases to verify that the helpers split and parse the
      backing store components properly.
      95a56835
    • P
      storage: Fix crash when parsing backing store URI with schema · 98784369
      Peter Krempa 提交于
      The code that parses the schema from the URI touches the "hosts[0]"
      member of the storage file source structure in case the URI contains a
      schema. The hosts array was not yet allocated at the point in the code
      where the transport protocol was parsed and set. This lead to a crash of
      libvirtd.
      
      Fix the code by allocating the "hosts" array upfront and add a test case
      to verify this scenario. (Unfortunately this requires shuffling the test
      case numbers too).
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1156288
      98784369
  18. 29 10月, 2014 1 次提交