1. 24 7月, 2013 8 次提交
  2. 23 7月, 2013 1 次提交
    • R
      Add virDBusMessage(Encode,Decode) stubs · ac26b2b0
      Roman Bogorodskiy 提交于
      Commit 834c9c94 introduced virDBusMessageEncode and
      virDBusMessageDecode functions, however corresponding stubs
      were not added to !WITH_DBUS section, therefore 'make check'
      started to fail when compiled w/out dbus support like that:
      
      Expected symbol virDBusMessageDecode is not in ELF library
      ac26b2b0
  3. 22 7月, 2013 6 次提交
  4. 19 7月, 2013 1 次提交
  5. 18 7月, 2013 4 次提交
  6. 17 7月, 2013 1 次提交
    • J
      cgroup: reuse buffer for getline · cc732931
      Ján Tomko 提交于
      Reuse the buffer for getline and track buffer allocation
      separately from the string length to prevent unlikely
      out-of-bounds memory access.
      
      This fixes the following leak that happened when zero bytes were read:
      
      ==404== 120 bytes in 1 blocks are definitely lost in loss record 1,344 of 1,671
      ==404==    at 0x4C2C71B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==404==    by 0x906F862: getdelim (iogetdelim.c:68)
      ==404==    by 0x52A48FB: virCgroupPartitionNeedsEscaping (vircgroup.c:1136)
      ==404==    by 0x52A0FB4: virCgroupPartitionEscape (vircgroup.c:1171)
      ==404==    by 0x52A0EA4: virCgroupNewDomainPartition (vircgroup.c:1450)
      cc732931
  7. 15 7月, 2013 2 次提交
    • L
      pci: make virPCIDeviceReset more autonomous · 9e37f57f
      Laine Stump 提交于
      I recently patches the callers to virPCIDeviceReset() to not call it
      if the current driver for a device was vfio-pci (since that driver
      will always reset the device itself when appropriate. At the time, Dan
      Berrange suggested that I could instead modify virPCIDeviceReset
      to check the currently bound driver for the device, and decide
      for itself whether or not to go ahead with the reset.
      
      This patch removes the previously added checks, and replaces them with
      a check down in virPCIDeviceReset(), as suggested.
      
      The functional difference here is that previously we were deciding
      based on either the hostdev configuration or the value of
      stubDriverName in the virPCIDevice object, but now we are actually
      comparing to the "driver" link in the device's sysfs entry
      directly. In practice, both should be the same.
      9e37f57f
    • L
      pci: reorder static functions · 333a2a72
      Laine Stump 提交于
      virPCIDeviceGetDriverPathAndName is a static function that will need
      to be called by another function that occurs above it in the
      file. This patch reorders the static functions so that a forward
      declaration isn't needed.
      333a2a72
  8. 12 7月, 2013 5 次提交
    • P
      virAuth: Don't require virConnectPtr to retrieve authentication creds · c7dba5d6
      Peter Krempa 提交于
      Previously a connection object was required to retrieve the auth
      credentials. This patch adds the option to call the retrieval functions
      only using the connection URI or path to the configuration file. This
      will allow to use this toolkit to request passwords for ssh
      authentication in the libssh2 connection driver.
      
      Changes:
      *virAuthGetConfigFilePathURI(): use URI to retrieve the config file path
      *virAuthGetCredential(): Remove the need to propagate conn object
      
      virAuthGetPasswordPath():
      *virAuthGetUsernamePath(): New functions, that use config file path
                                 instead of conn object
      c7dba5d6
    • E
      util: make virSetUIDGID async-signal-safe · ee777e99
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964358
      
      POSIX states that multi-threaded apps should not use functions
      that are not async-signal-safe between fork and exec, yet we
      were using getpwuid_r and initgroups.  Although rare, it is
      possible to hit deadlock in the child, when it tries to grab
      a mutex that was already held by another thread in the parent.
      I actually hit this deadlock when testing multiple domains
      being started in parallel with a command hook, with the following
      backtrace in the child:
      
       Thread 1 (Thread 0x7fd56bbf2700 (LWP 3212)):
       #0  __lll_lock_wait ()
           at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
       #1  0x00007fd5761e7388 in _L_lock_854 () from /lib64/libpthread.so.0
       #2  0x00007fd5761e7257 in __pthread_mutex_lock (mutex=0x7fd56be00360)
           at pthread_mutex_lock.c:61
       #3  0x00007fd56bbf9fc5 in _nss_files_getpwuid_r (uid=0, result=0x7fd56bbf0c70,
           buffer=0x7fd55c2a65f0 "", buflen=1024, errnop=0x7fd56bbf25b8)
           at nss_files/files-pwd.c:40
       #4  0x00007fd575aeff1d in __getpwuid_r (uid=0, resbuf=0x7fd56bbf0c70,
           buffer=0x7fd55c2a65f0 "", buflen=1024, result=0x7fd56bbf0cb0)
           at ../nss/getXXbyYY_r.c:253
       #5  0x00007fd578aebafc in virSetUIDGID (uid=0, gid=0) at util/virutil.c:1031
       #6  0x00007fd578aebf43 in virSetUIDGIDWithCaps (uid=0, gid=0, capBits=0,
           clearExistingCaps=true) at util/virutil.c:1388
       #7  0x00007fd578a9a20b in virExec (cmd=0x7fd55c231f10) at util/vircommand.c:654
       #8  0x00007fd578a9dfa2 in virCommandRunAsync (cmd=0x7fd55c231f10, pid=0x0)
           at util/vircommand.c:2247
       #9  0x00007fd578a9d74e in virCommandRun (cmd=0x7fd55c231f10, exitstatus=0x0)
           at util/vircommand.c:2100
       #10 0x00007fd56326fde5 in qemuProcessStart (conn=0x7fd53c000df0,
           driver=0x7fd55c0dc4f0, vm=0x7fd54800b100, migrateFrom=0x0, stdin_fd=-1,
           stdin_path=0x0, snapshot=0x0, vmop=VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
           flags=1) at qemu/qemu_process.c:3694
       ...
      
      The solution is to split the work of getpwuid_r/initgroups into the
      unsafe portions (getgrouplist, called pre-fork) and safe portions
      (setgroups, called post-fork).
      
      * src/util/virutil.h (virSetUIDGID, virSetUIDGIDWithCaps): Adjust
      signature.
      * src/util/virutil.c (virSetUIDGID): Add parameters.
      (virSetUIDGIDWithCaps): Adjust clients.
      * src/util/vircommand.c (virExec): Likewise.
      * src/util/virfile.c (virFileAccessibleAs, virFileOpenForked)
      (virDirCreate): Likewise.
      * src/security/security_dac.c (virSecurityDACSetProcessLabel):
      Likewise.
      * src/lxc/lxc_container.c (lxcContainerSetID): Likewise.
      * configure.ac (AC_CHECK_FUNCS_ONCE): Check for setgroups, not
      initgroups.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ee777e99
    • E
      util: add virGetGroupList · 75c12564
      Eric Blake 提交于
      Since neither getpwuid_r() nor initgroups() are safe to call in
      between fork and exec (they obtain a mutex, but if some other
      thread in the parent also held the mutex at the time of the fork,
      the child will deadlock), we have to split out the functionality
      that is unsafe.  At least glibc's initgroups() uses getgrouplist
      under the hood, so the ideal split is to expose getgrouplist for
      use before a fork.  Gnulib already gives us a nice wrapper via
      mgetgroups; we wrap it once more to look up by uid instead of name.
      
      * bootstrap.conf (gnulib_modules): Add mgetgroups.
      * src/util/virutil.h (virGetGroupList): New declaration.
      * src/util/virutil.c (virGetGroupList): New function.
      * src/libvirt_private.syms (virutil.h): Export it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      75c12564
    • E
      util: improve user lookup helper · c1983ba4
      Eric Blake 提交于
      A future patch needs to look up pw_gid; but it is wasteful
      to crawl through getpwuid_r twice for two separate pieces
      of information, and annoying to copy that much boilerplate
      code for doing the crawl.  The current internal-only
      virGetUserEnt is also a rather awkward interface; it's easier
      to just design it to let callers request multiple pieces of
      data as needed from one traversal.
      
      And while at it, I noticed that virGetXDGDirectory could deref
      NULL if the getpwuid_r lookup fails.
      
      * src/util/virutil.c (virGetUserEnt): Alter signature.
      (virGetUserDirectory, virGetXDGDirectory, virGetUserName): Adjust
      callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c1983ba4
    • J
      testutils: Resolve Coverity issues · 8283ef9e
      John Ferlan 提交于
      Recent changes uncovered a NEGATIVE_RETURNS in the return from sysconf()
      when processing a for loop in virtTestCaptureProgramExecChild() in
      testutils.c
      
      Code review uncovered 3 other code paths with the same condition that
      weren't found by Covirity, so fixed those as well.
      8283ef9e
  9. 11 7月, 2013 3 次提交
  10. 10 7月, 2013 5 次提交
  11. 09 7月, 2013 1 次提交
  12. 08 7月, 2013 1 次提交
    • J
      Don't spam logs with "port 0 must be in range" errors · 86dba8f3
      Jiri Denemark 提交于
      Whenever virPortAllocatorRelease is called with port == 0, it complains
      that the port is not in an allowed range, which is expectable as the
      port was never allocated. Let's make virPortAllocatorRelease ignore 0
      ports in a similar way free() ignores NULL pointers.
      86dba8f3
  13. 03 7月, 2013 2 次提交
    • M
      virNetDevBandwidthUnplug: Don't leak @cmd · 5995fcf0
      Michal Privoznik 提交于
      When removing a TAP device, the associated bandwidth settings are
      removed. Currently, the /sbin/tc is used for that. It is spawned
      several times. Moreover, we use the same @cmd variable to
      construct the command and its arguments. That means we need to
      virCommandFree(cmd); prior to each virCommandNew(TC); which
      wasn't done.
      5995fcf0
    • M
      virCgroupNewPartition: Don't leak @newpath · bc132221
      Michal Privoznik 提交于
      The @newpath variable is allocated in virCgroupSetPartitionSuffix(). But
      it's newer freed.
      bc132221