1. 30 6月, 2016 1 次提交
  2. 16 12月, 2015 2 次提交
    • E
      CVE-2015-5313: storage: don't allow '/' in filesystem volume names · 0060c4ee
      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)
      0060c4ee
    • D
      avoid using deprecated udev logging functions · 5f2b4337
      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)
      5f2b4337
  3. 03 9月, 2015 1 次提交
    • M
      remoteClientCloseFunc: Don't mangle connection object refcount · 0c4b7b6b
      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>
      0c4b7b6b
  4. 29 8月, 2015 1 次提交
  5. 17 6月, 2015 1 次提交
  6. 22 5月, 2015 1 次提交
    • T
      conf: fix issue on virCPUDefCopy · f0be92b4
      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>
      f0be92b4
  7. 17 3月, 2015 1 次提交
    • E
      daemon: avoid memleak when ListAll returns nothing · b175298b
      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)
      b175298b
  8. 23 1月, 2015 2 次提交
  9. 13 12月, 2014 2 次提交
  10. 12 12月, 2014 1 次提交
  11. 11 12月, 2014 6 次提交
  12. 10 12月, 2014 21 次提交