1. 14 10月, 2017 2 次提交
  2. 05 10月, 2017 4 次提交
  3. 06 9月, 2017 1 次提交
  4. 04 9月, 2017 1 次提交
    • M
      lxcStateInitialize: Don't leak driver's caps · e703039c
      Michal Privoznik 提交于
      Funny thing. So when initializing LXC driver's capabilities,
      firstly the virLXCDriverGetCapabilities() is called. This creates
      new capabilities, stores them under driver->caps, ref() them and
      return them. However, the return value is ignored. Secondly, the
      function is called yet again and since we have driver->caps set,
      they are ref()-ed again an returned. So in the end, driver's
      capabilities have refcount of three when in fact they should have
      refcount of one.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e703039c
  5. 20 7月, 2017 2 次提交
  6. 25 6月, 2017 1 次提交
    • J
      events: Avoid double free possibility on remote call failure · 2065499b
      John Ferlan 提交于
      If a remote call fails during event registration (more than likely from
      a network failure or remote libvirtd restart timed just right), then when
      calling the virObjectEventStateDeregisterID we don't want to call the
      registered @freecb function because that breaks our contract that we
      would only call it after succesfully returning.  If the @freecb routine
      were called, it could result in a double free from properly coded
      applications that free their opaque data on failure to register, as seen
      in the following details:
      
          Program terminated with signal 6, Aborted.
          #0  0x00007fc45cba15d7 in raise
          #1  0x00007fc45cba2cc8 in abort
          #2  0x00007fc45cbe12f7 in __libc_message
          #3  0x00007fc45cbe86d3 in _int_free
          #4  0x00007fc45d8d292c in PyDict_Fini
          #5  0x00007fc45d94f46a in Py_Finalize
          #6  0x00007fc45d960735 in Py_Main
          #7  0x00007fc45cb8daf5 in __libc_start_main
          #8  0x0000000000400721 in _start
      
      The double dereference of 'pyobj_cbData' is triggered in the following way:
      
          (1) libvirt_virConnectDomainEventRegisterAny is invoked.
          (2) the event is successfully added to the event callback list
              (virDomainEventStateRegisterClient in
              remoteConnectDomainEventRegisterAny returns 1 which means ok).
          (3) when function remoteConnectDomainEventRegisterAny is hit,
              network connection disconnected coincidently (or libvirtd is
              restarted) in the context of function 'call' then the connection
              is lost and the function 'call' failed, the branch
              virObjectEventStateDeregisterID is therefore taken.
          (4) 'pyobj_conn' is dereferenced the 1st time in
              libvirt_virConnectDomainEventFreeFunc.
          (5) 'pyobj_cbData' (refered to pyobj_conn) is dereferenced the
               2nd time in libvirt_virConnectDomainEventRegisterAny.
          (6) the double free error is triggered.
      
      Resolve this by adding a @doFreeCb boolean in order to avoid calling the
      freeCb in virObjectEventStateDeregisterID for any remote call failure in
      a remoteConnect*EventRegister* API. For remoteConnect*EventDeregister* calls,
      the passed value would be true indicating they should run the freecb if it
      exists; whereas, it's false for the remote call failure path.
      
      Patch based on the investigation and initial patch posted by
      fangying <fangying1@huawei.com>.
      2065499b
  7. 03 4月, 2017 1 次提交
    • M
      virGetDomain: Set domain ID too · 5683b213
      Michal Privoznik 提交于
      So far our code is full of the following pattern:
      
        dom = virGetDomain(conn, name, uuid)
        if (dom)
            dom->id = 42;
      
      There is no reasong why it couldn't be just:
      
        dom = virGetDomain(conn, name, uuid, id);
      
      After all, client domain representation consists of tuple (name,
      uuid, id).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5683b213
  8. 27 3月, 2017 3 次提交
    • M
      util: Fix naming in util/virnodesuspend · d2d1dec1
      Martin Kletzander 提交于
      That file has only two exported files and each one of them has
      different naming.  virNode is what all the other files use, so let's
      use it.  It wasn't used before because the clash with public API
      naming, so let's fix that by shortening the name (there is no other
      private variant of it anyway).
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      d2d1dec1
    • M
      Remove src/nodeinfo · 26ae4e48
      Martin Kletzander 提交于
      There is no "node driver" as there was before, drivers have to do
      their own ACL checking anyway, so they all specify their functions and
      nodeinfo is basically just extending conf/capablities.  Hence moving
      the code to src/conf/ is the right way to go.
      
      Also that way we can de-duplicate some code that is in virsysfs and/or
      virhostcpu that got duplicated during the virhostcpu.c split.  And
      Some cleanup is done throughout the changes, like adding the vir*
      prefix etc.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      26ae4e48
    • M
      Move src/fdstream to src/util/virfdstream · bdcb1995
      Martin Kletzander 提交于
      There is no reason for it not to be in the utils, all global symbols
      under that file already have prefix vir* and there is no reason for it
      to be part of DRIVER_SOURCES because that is just a leftover from
      older days (pre-driver modules era, I believe).
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      bdcb1995
  9. 12 1月, 2017 1 次提交
    • M
      lxc: Move lxcContainerAvailable to virprocess · 083fcd06
      Michal Privoznik 提交于
      Other drivers (like qemu) would like to know if the namespaces
      are available therefore it makes sense to move this function to
      a shared module.
      
      At the same time, this function had some default namespaces that
      are checked with every call. It is not necessary - let callers
      pass just those namespaces they are interested in.
      
      With the move the function is renamed to
      virProcessNamespaceAvailable.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      083fcd06
  10. 09 1月, 2017 1 次提交
  11. 09 12月, 2016 2 次提交
  12. 22 11月, 2016 1 次提交
  13. 27 10月, 2016 1 次提交
  14. 22 10月, 2016 1 次提交
  15. 14 10月, 2016 1 次提交
  16. 13 10月, 2016 1 次提交
    • M
      src: Treat PID as signed · b7d2d4af
      Michal Privoznik 提交于
      This initially started as a fix of some debug printing in
      virCgroupDetect. However it turned out that other places suffer
      from the similar problem. While dealing with pids, esp. in cases
      where we cannot use pid_t for ABI stability reasons, we often
      chose an unsigned integer type. This makes no sense as pid_t is
      signed.
      Also, new syntax-check rule is introduced so we won't repeat this
      mistake.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b7d2d4af
  17. 12 10月, 2016 1 次提交
  18. 26 9月, 2016 1 次提交
  19. 06 9月, 2016 1 次提交
    • M
      Make sure sys/types.h is included after sys/sysmacros.h · f3f15cc2
      Michal Privoznik 提交于
      In the latest glibc, major() and minor() functions are marked as
      deprecated (glibc commit dbab6577):
      
        CC       util/libvirt_util_la-vircgroup.lo
      util/vircgroup.c: In function 'virCgroupGetBlockDevString':
      util/vircgroup.c:768:5: error: '__major_from_sys_types' is deprecated:
        In the GNU C Library, `major' is defined by <sys/sysmacros.h>.
        For historical compatibility, it is currently defined by
        <sys/types.h> as well, but we plan to remove this soon.
        To use `major', include <sys/sysmacros.h> directly.
        If you did not intend to use a system-defined macro `major',
        you should #undef it after including <sys/types.h>.
        [-Werror=deprecated-declarations]
           if (virAsprintf(&ret, "%d:%d ", major(sb.st_rdev), minor(sb.st_rdev)) < 0)
           ^~
      In file included from /usr/include/features.h:397:0,
                       from /usr/include/bits/libc-header-start.h:33,
                       from /usr/include/stdio.h:28,
                       from ../gnulib/lib/stdio.h:43,
                       from util/vircgroup.c:26:
      /usr/include/sys/sysmacros.h:87:1: note: declared here
       __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_FST_IMPL_TEMPL)
       ^
      
      Moreover, in the glibc commit, there's suggestion to keep
      ordering of including of header files as implemented here.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f3f15cc2
  20. 05 8月, 2016 1 次提交
    • M
      lxcDomainCreateXMLWithFiles: Avoid crash · 5f5a5a42
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1363773
      
      Imagine that you're creating a transient domain, but for some reason,
      starting it fails. That is virLXCProcessStart() returns an error. With
      current code, in the error handling code the domain object is removed
      from the domain object list, @vm is set to NULL and controls jump to
      enjob label where virLXCDomainObjEndJob() is called which dereference vm
      leading to instant crash.
      
      The fix is to end the job in the error handling code and only after that
      remove the domain from the list and jump onto cleanup label instead of
      endjob.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5f5a5a42
  21. 24 7月, 2016 1 次提交
  22. 07 7月, 2016 2 次提交
  23. 17 6月, 2016 1 次提交
  24. 10 6月, 2016 5 次提交
  25. 08 6月, 2016 3 次提交