1. 30 6月, 2016 1 次提交
  2. 16 12月, 2015 2 次提交
    • E
      CVE-2015-5313: storage: don't allow '/' in filesystem volume names · dcce6659
      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)
      
      Conflicts:
      	src/storage/storage_backend_fs.c - trivial copyright date collision
      dcce6659
    • M
      util: Prepare URI formatting for libxml2 >= 2.9.2 · 729d0533
      Martin Kletzander 提交于
      Since commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5 libxml2 removes
      two slashes from the URI when there is no server part.  This is fixed
      with beb7281055dbf0ed4d041022a67c6c5cfd126f25, but only if the calling
      application calls xmlSaveUri() on URI that xmlURIParse() parsed.  And
      that is not the case in virURIFormat().  virURIFormat() accepts
      virURIPtr that can be created without parsing it and we do that when we
      format network storage paths for gluster for example.  Even though
      virStorageSourceParseBackingURI() uses virURIParse(), it throws that data
      structure right away.
      
      Since we want to format URIs as URIs and not absolute URIs or opaque
      URIs (see RFC 3986), we can specify that with a special hack thanks to
      commit beb7281055dbf0ed4d041022a67c6c5cfd126f25, by setting port to -1.
      
      This fixes qemuxml2argvtest test where the disk-drive-network-gluster
      case was failing.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 8f17d0ea)
      729d0533
  3. 28 4月, 2015 4 次提交
    • J
      Properly check the return value of CCWAddressAsString · 14bc1e94
      Ján Tomko 提交于
      It returns NULL on failure. Checking if the negation of it
      is less than zero makes no sense. (Found by coverity after moving
      the code)
      
      In another case, the return value wasn't checked at all.
      
      (cherry picked from commit 3fe9d75a)
      14bc1e94
    • D
      avoid using deprecated udev logging functions · 0cddbe00
      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)
      0cddbe00
    • D
      libxl: don't break the build on Xen>=4.5 because of libxl_vcpu_setaffinity() · 57bd153f
      Dario Faggioli 提交于
      libxl interface for vcpu pinning is changing in Xen 4.5. Basically,
      libxl_set_vcpuaffinity() now wants one more parameter. That is
      representative of 'VCPU soft affinity', which libvirt does not use.
      
      To mark such change, the macro LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY is
      defined. Use it as a gate and, if present, re-#define the calls from
      the old to the new interface, to avoid breaking the build.
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Campbell <Ian.Campbell@citrix.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      (cherry picked from commit bfc72e99)
      57bd153f
    • C
      qemu: Always refresh capabilities if no <guests> found · 62c042f4
      Cole Robinson 提交于
      - Remove all qemu emulators
      - Restart libvirtd
      - Install qemu emulators
      - Call 'virsh version' -> errors
      
      The only thing that will force the qemu driver to refresh it's cached
      capablities info is an explict API call to GetCapabilities.
      
      However in the case when the initial caps lookup at driver connect didn't
      find a single qemu emulator to poll, the driver is effectively useless
      and really can't do anything until it's populated some qemu capabilities
      info.
      
      With the above steps, the user would have to either know about the
      magic refresh capabilities call, or restart libvirtd to pick up the
      changes.
      
      Instead, this patch changes things so that every time a part of th
      driver requests access to capabilities info, check to see if
      we've previously seen any emulators. If not, force a refresh.
      
      In the case of 'still no emulators found', this is still very quick, so
      I can't think of a downside.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1000116
      (cherry picked from commit 95546c43)
      62c042f4
  4. 26 4月, 2015 1 次提交
    • M
      virSecuritySELinuxSetFileconHelper: Don't fail on read-only NFS · b6da3526
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=996543
      
      When starting up a domain, the SELinux labeling is done depending on
      current configuration. If the labeling fails we check for possible
      causes, as not all labeling failures are fatal. For example, if the
      labeled file is on NFS which lacks SELinux support, the file can still
      be readable to qemu process. These cases are distinguished by the errno
      code: NFS without SELinux support returns EOPNOTSUPP. However, we were
      missing one scenario. In case there's a read-only disk on a read-only
      NFS (and possibly any FS) and the labeling is just optional (not
      explicitly requested in the XML) there's no need to make the labeling
      error fatal. In other words, read-only file on read-only NFS can fail to
      be labeled, but be readable at the same time.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit d1fdecb6)
      b6da3526
  5. 26 2月, 2015 2 次提交
  6. 08 2月, 2015 1 次提交
  7. 23 1月, 2015 2 次提交
  8. 24 12月, 2014 1 次提交
  9. 16 11月, 2014 3 次提交
  10. 08 11月, 2014 1 次提交
    • E
      CVE-2014-7823: dumpxml: security hole with migratable flag · bdbcf66a
      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)
      
      Conflicts:
      	src/libvirt-domain.c - file split from older src/libvirt.c; context with older virLibConnError
      Signed-off-by: NEric Blake <eblake@redhat.com>
      bdbcf66a
  11. 30 10月, 2014 3 次提交
  12. 02 10月, 2014 1 次提交
  13. 18 9月, 2014 1 次提交
  14. 09 9月, 2014 10 次提交
  15. 08 9月, 2014 3 次提交
  16. 02 9月, 2014 1 次提交
  17. 27 8月, 2014 1 次提交
    • D
      Don't include @libs@ in libvirt.pc.in file · 76ad3133
      Daniel P. Berrange 提交于
      The libvirt.pc file we install is ending up polluted with a
      load of compiler flags that should be private to the libvirt
      build. eg
      
      Libs: -L${libdir} -lvirt -ldl -O2 -g -pipe -Wall \
            -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
            -fstack-protector-strong --param=ssp-buffer-size=4 \
            -grecord-gcc-switches  -m64 -mtune=generic
      
      this is caused by including @libs@ in the Libs: line of the
      pkgconfig.pc.in file.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 1167751f)
      76ad3133
  18. 03 7月, 2014 2 次提交
    • P
      qemu: copy: Accept 'format' parameter when copying to a non-existing img · e7ee7542
      Peter Krempa 提交于
      We have the following matrix of possible arguments handled by the logic
      statement touched by this patch:
             | flags & _REUSE_EXT | !(flags & _REUSE_EXT)
      -------+--------------------+----------------------
       format| (1)                | (2)
      -------+--------------------+----------------------
      !format| (3)                | (4)
      -------+--------------------+----------------------
      
      In cases 1 and 2 the user provided a format, in cases 3 and 4 not. The
      user requests to use a pre-existing image in 1 and 3 and libvirt will
      create a new image in 2 and 4.
      
      The difference between cases 3 and 4 is that for 3 the format is probed
      from the user-provided image, whereas in 4 we just use the existing disk
      format.
      
      The current code would treat cases 1,3 and 4 correctly but in case 2 the
      format provided by the user would be ignored.
      
      The particular piece of code was broken in commit 35c7701c
      but since it was introduced a few commits before that it was never
      released as working.
      
      (cherry picked from commit 42619ed0)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      
      Conflicts:
      	src/qemu/qemu_driver.c - no refactoring of commits 7b7bf001, 4f202266
      e7ee7542
    • E
      build: fix 'make check' with newer git · 1fae811a
      Eric Blake 提交于
      Newer git doesn't like the maint.mk rule 'public-submodule-commit'
      run during 'make check', as inherited from our checkout of gnulib.
      I tracked down that libvirt commit 8531301d picked up a gnulib fix
      that makes git happy.  Rather than try and do a full .gnulib
      submodule update to gnulib.git d18d1b802 (as used in that libvirt
      commit), it was easier to just backport the fixed maint.mk from
      gnulib on top of our existing submodule level.  I did it as follows,
      where these steps will have to be repeated when cherry-picking this
      commit to any other maintenance branch:
      
      mkdir -p gnulib/local/top
      cd .gnulib
      git checkout d18d1b802 top/maint.mk
      git diff HEAD > ../gnulib/local/top/maint.mk.diff
      git reset --hard
      cd ..
      git add gnulib/local/top
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1fae811a