1. 25 12月, 2013 1 次提交
    • M
      lxcDomainShutdownFlags: Cleanup @flags usage · aa461933
      Michal Privoznik 提交于
      Currently, the @flags usage is a bit unclear at first sight to say the
      least. There's no need for such unclear code especially when we can
      borrow the working code from qemuDomainShutdownFlags().
      
      In addition, this fixes one bug too. If user requested both
      VIR_DOMAIN_SHUTDOWN_INITCTL and VIR_DOMAIN_SHUTDOWN_SIGNAL at the same
      time, he is basically saying: 'Use the force Luke! If initctl fails try
      sending a signal.' But with the current code we don't do that. If
      initctl fails for some reason (e.g. inability to write to /dev/initctl)
      we don't try sending any signal but fail immediately. To make things
      worse, making a domain shutdown with bare _SIGNAL was working by blind
      chance of a @rc variable being placed at correct place on the stack so
      its initial value was zero.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      aa461933
  2. 20 12月, 2013 2 次提交
    • M
      Fix crash in lxcDomainSetMemoryParameters · 9faf3f29
      Martin Kletzander 提交于
      The function doesn't check whether the request is made for active or
      inactive domain.  Thus when the domain is not running it still tries
      accessing non-existing cgroups (priv->cgroup, which is NULL).
      
      I re-made the function in order for it to work the same way it's qemu
      counterpart does.
      
      Reproducer:
       1) Define an LXC domain
       2) Do 'virsh memtune <domain> --hard-limit 133T'
      
      Backtrace:
       Thread 6 (Thread 0x7fffec8c0700 (LWP 26826)):
       #0  0x00007ffff70edcc4 in virCgroupPathOfController (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", path=0x7fffec8bf718) at util/vircgroup.c:1764
       #1  0x00007ffff70e9206 in virCgroupSetValueStr (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=0x7fffe409f360 "1073741824")
           at util/vircgroup.c:669
       #2  0x00007ffff70e98b4 in virCgroupSetValueU64 (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=1073741824) at util/vircgroup.c:740
       #3  0x00007ffff70ee518 in virCgroupSetMemory (group=0x0, kb=1048576) at util/vircgroup.c:1904
       #4  0x00007ffff70ee675 in virCgroupSetMemoryHardLimit (group=0x0, kb=1048576)
           at util/vircgroup.c:1944
       #5  0x00005555557d54c8 in lxcDomainSetMemoryParameters (dom=0x7fffe40cc420,
           params=0x7fffe409f100, nparams=1, flags=0) at lxc/lxc_driver.c:774
       #6  0x00007ffff72c20f9 in virDomainSetMemoryParameters (domain=0x7fffe40cc420,
           params=0x7fffe409f100, nparams=1, flags=0) at libvirt.c:4051
       #7  0x000055555561365f in remoteDispatchDomainSetMemoryParameters (server=0x555555eb7e00,
           client=0x555555ec4b10, msg=0x555555eb94e0, rerr=0x7fffec8bfb70, args=0x7fffe40b8510)
           at remote_dispatch.h:7621
       #8  0x00005555556133fd in remoteDispatchDomainSetMemoryParametersHelper (server=0x555555eb7e00,
           client=0x555555ec4b10, msg=0x555555eb94e0, rerr=0x7fffec8bfb70, args=0x7fffe40b8510,
           ret=0x7fffe40b84f0) at remote_dispatch.h:7591
       #9  0x00007ffff73b293f in virNetServerProgramDispatchCall (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ec4b10, msg=0x555555eb94e0)
           at rpc/virnetserverprogram.c:435
       #10 0x00007ffff73b207f in virNetServerProgramDispatch (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ec4b10, msg=0x555555eb94e0)
           at rpc/virnetserverprogram.c:305
       #11 0x00007ffff73a4d2c in virNetServerProcessMsg (srv=0x555555eb7e00, client=0x555555ec4b10,
           prog=0x555555ec3ae0, msg=0x555555eb94e0) at rpc/virnetserver.c:165
       #12 0x00007ffff73a4e8d in virNetServerHandleJob (jobOpaque=0x555555ec3e30, opaque=0x555555eb7e00)
           at rpc/virnetserver.c:186
       #13 0x00007ffff7187f3f in virThreadPoolWorker (opaque=0x555555eb7ac0) at util/virthreadpool.c:144
       #14 0x00007ffff718733a in virThreadHelper (data=0x555555eb7890) at util/virthreadpthread.c:161
       #15 0x00007ffff468ed89 in start_thread (arg=0x7fffec8c0700) at pthread_create.c:308
       #16 0x00007ffff3da26bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      9faf3f29
    • M
      CVE-2013-6436: fix crash in lxcDomainGetMemoryParameters · f8c1cb90
      Martin Kletzander 提交于
      The function doesn't check whether the request is made for active or
      inactive domain.  Thus when the domain is not running it still tries
      accessing non-existing cgroups (priv->cgroup, which is NULL).
      
      I re-made the function in order for it to work the same way it's qemu
      counterpart does.
      
      Reproducer:
       1) Define an LXC domain
       2) Do 'virsh memtune <domain>'
      
      Backtrace:
       Thread 6 (Thread 0x7fffec8c0700 (LWP 13387)):
       #0  0x00007ffff70edcc4 in virCgroupPathOfController (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", path=0x7fffec8bf750) at util/vircgroup.c:1764
       #1  0x00007ffff70e958c in virCgroupGetValueStr (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=0x7fffec8bf7c0) at util/vircgroup.c:705
       #2  0x00007ffff70e9d29 in virCgroupGetValueU64 (group=0x0, controller=3,
           key=0x7ffff75734bd "memory.limit_in_bytes", value=0x7fffec8bf810) at util/vircgroup.c:804
       #3  0x00007ffff70ee706 in virCgroupGetMemoryHardLimit (group=0x0, kb=0x7fffec8bf8a8)
           at util/vircgroup.c:1962
       #4  0x00005555557d590f in lxcDomainGetMemoryParameters (dom=0x7fffd40024a0,
           params=0x7fffd40027a0, nparams=0x7fffec8bfa24, flags=0) at lxc/lxc_driver.c:826
       #5  0x00007ffff72c28d3 in virDomainGetMemoryParameters (domain=0x7fffd40024a0,
           params=0x7fffd40027a0, nparams=0x7fffec8bfa24, flags=0) at libvirt.c:4137
       #6  0x000055555563714d in remoteDispatchDomainGetMemoryParameters (server=0x555555eb7e00,
           client=0x555555ebaef0, msg=0x555555ebb3e0, rerr=0x7fffec8bfb70, args=0x7fffd40024e0,
           ret=0x7fffd4002420) at remote.c:1895
       #7  0x00005555556052c4 in remoteDispatchDomainGetMemoryParametersHelper (server=0x555555eb7e00,
           client=0x555555ebaef0, msg=0x555555ebb3e0, rerr=0x7fffec8bfb70, args=0x7fffd40024e0,
           ret=0x7fffd4002420) at remote_dispatch.h:4050
       #8  0x00007ffff73b293f in virNetServerProgramDispatchCall (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ebaef0, msg=0x555555ebb3e0)
           at rpc/virnetserverprogram.c:435
       #9  0x00007ffff73b207f in virNetServerProgramDispatch (prog=0x555555ec3ae0,
           server=0x555555eb7e00, client=0x555555ebaef0, msg=0x555555ebb3e0)
           at rpc/virnetserverprogram.c:305
       #10 0x00007ffff73a4d2c in virNetServerProcessMsg (srv=0x555555eb7e00, client=0x555555ebaef0,
           prog=0x555555ec3ae0, msg=0x555555ebb3e0) at rpc/virnetserver.c:165
       #11 0x00007ffff73a4e8d in virNetServerHandleJob (jobOpaque=0x555555ebc7e0, opaque=0x555555eb7e00)
           at rpc/virnetserver.c:186
       #12 0x00007ffff7187f3f in virThreadPoolWorker (opaque=0x555555eb7ac0) at util/virthreadpool.c:144
       #13 0x00007ffff718733a in virThreadHelper (data=0x555555eb7890) at util/virthreadpthread.c:161
       #14 0x00007ffff468ed89 in start_thread (arg=0x7fffec8c0700) at pthread_create.c:308
       #15 0x00007ffff3da26bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      f8c1cb90
  3. 10 12月, 2013 3 次提交
  4. 21 10月, 2013 1 次提交
  5. 15 10月, 2013 1 次提交
  6. 07 10月, 2013 1 次提交
    • D
      Remove use of virConnectPtr from all remaining nwfilter code · 999d72fb
      Daniel P. Berrange 提交于
      The virConnectPtr is passed around loads of nwfilter code in
      order to provide it as a parameter to the callback registered
      by the virt drivers. None of the virt drivers use this param
      though, so it serves no purpose.
      
      Avoiding the need to pass a virConnectPtr means that the
      nwfilterStateReload method no longer needs to open a bogus
      QEMU driver connection. This addresses a race condition that
      can lead to a crash on startup.
      
      The nwfilter driver starts before the QEMU driver and registers
      some callbacks with DBus to detect firewalld reload. If the
      firewalld reload happens while the QEMU driver is still starting
      up though, the nwfilterStateReload method will open a connection
      to the partially initialized QEMU driver and cause a crash.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      999d72fb
  7. 27 9月, 2013 1 次提交
  8. 26 9月, 2013 1 次提交
  9. 17 9月, 2013 1 次提交
  10. 16 9月, 2013 1 次提交
  11. 09 9月, 2013 1 次提交
  12. 30 7月, 2013 1 次提交
  13. 26 7月, 2013 1 次提交
  14. 22 7月, 2013 1 次提交
  15. 18 7月, 2013 7 次提交
    • M
      Introduce lxcDomObjFromDomain · dbeb04a6
      Michal Privoznik 提交于
      Similarly to qemu driver, we can use a helper function to
      lookup a domain instead of copying multiple lines around.
      dbeb04a6
    • M
      Remove lxcDriverLock from almost everywhere · eb150c86
      Michal Privoznik 提交于
      With the majority of fields in the virLXCDriverPtr struct
      now immutable or self-locking, there is no need for practically
      any methods to be using the LXC driver lock. Only a handful
      of helper APIs now need it.
      eb150c86
    • M
      lxc: Make activeUsbHostdevs use locks · 2a82171a
      Michal Privoznik 提交于
      The activeUsbHostdevs item in LXCDriver are lockable, but the lock has
      to be called explicitly. Call the virObject(Un)Lock() in order to
      achieve mutual exclusion once lxcDriverLock is removed.
      2a82171a
    • M
      Stop accessing driver->caps directly in LXC driver · 64ec738e
      Michal Privoznik 提交于
      The 'driver->caps' pointer can be changed on the fly. Accessing
      it currently requires the global driver lock. Isolate this
      access in a single helper, so a future patch can relax the
      locking constraints.
      64ec738e
    • M
      lxc: switch to virCloseCallbacks API · c8695053
      Michal Privoznik 提交于
      c8695053
    • M
      Introduce a virLXCDriverConfigPtr object · 7fca3755
      Michal Privoznik 提交于
      Currently the virLXCDriverPtr struct contains an wide variety
      of data with varying access needs. Move all the static config
      data into a dedicated virLXCDriverConfigPtr object. The only
      locking requirement is to hold the driver lock, while obtaining
      an instance of virLXCDriverConfigPtr. Once a reference is held
      on the config object, it can be used completely lockless since
      it is immutable.
      
      NB, not all APIs correctly hold the driver lock while getting
      a reference to the config object in this patch. This is safe
      for now since the config is never updated on the fly. Later
      patches will address this fully.
      7fca3755
    • D
      LXC: Wire up the virDomainCreate{XML}WithFiles methods · 11693bc6
      Daniel P. Berrange 提交于
      Wire up the new virDomainCreate{XML}WithFiles methods in the
      LXC driver, so that FDs get passed down to the init process.
      
      The lxc_container code needs to do a little dance in order
      to renumber the file descriptors it receives into linear
      order, starting from STDERR_FILENO + 1.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      11693bc6
  16. 16 7月, 2013 2 次提交
  17. 11 7月, 2013 1 次提交
  18. 10 7月, 2013 1 次提交
  19. 09 7月, 2013 1 次提交
  20. 03 7月, 2013 1 次提交
  21. 25 6月, 2013 1 次提交
  22. 24 6月, 2013 1 次提交
  23. 20 6月, 2013 1 次提交
    • J
      lxc: Resolve issue with GetScheduler APIs for non running domain · 38ada092
      John Ferlan 提交于
      As a consequence of the cgroup layout changes from commit 'cfed9ad4', the
      lxcDomainGetSchedulerParameters[Flags]()' and lxcGetSchedulerType() APIs
      failed to return data for a non running domain.  This can be seen through
      a 'virsh schedinfo <domain>' command which returns:
      
      Scheduler      : Unknown
      error: Requested operation is not valid: cgroup CPU controller is not mounted
      
      Prior to that change a non running domain would return:
      
      Scheduler      : posix
      cpu_shares     : 0
      vcpu_period    : 0
      vcpu_quota     : 0
      emulator_period: 0
      emulator_quota : 0
      
      This patch will restore the capability to return configuration only data
      for a non running domain regardless of whether cgroups are available.
      38ada092
  24. 21 5月, 2013 1 次提交
  25. 09 5月, 2013 1 次提交
  26. 08 5月, 2013 4 次提交
    • D
      Unmerge attach/update/modify device APIs in drivers · a605b7e0
      Daniel P. Berrange 提交于
      The LXC, QEMU, and LibXL drivers have all merged their handling of
      the attach/update/modify device APIs into one large
      
        'xxxxDomainModifyDeviceFlags'
      
      which then does a 'switch()' based on the actual API being invoked.
      While this saves some lines of code, it is not really all that
      significant in the context of the driver API impls as a whole.
      
      This merger of the handling of different APIs creates pain when
      wanting to automated analysis of the code and do things which
      are specific to individual APIs. The slight duplication of code
      from unmerged the API impls, is preferrable to allow for easier
      automated analysis.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a605b7e0
    • D
      Separate internal node suspend APIs from public API · 4a044d02
      Daniel P. Berrange 提交于
      The individual hypervisor drivers were directly referencing
      APIs in virnodesuspend.c in their virDriverPtr struct. Separate
      these methods, so there is always a wrapper in the hypervisor
      driver. This allows the unused virConnectPtr args to be removed
      from the virnodesuspend.c file. Again this will ensure that
      ACL checks will only be performed on invocations that are
      directly associated with public API usage.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4a044d02
    • D
      Separate internal node device APIs from public API · 1c6d4ca5
      Daniel P. Berrange 提交于
      The individual hypervisor drivers were directly referencing
      APIs in src/nodeinfo.c in their virDriverPtr struct. Separate
      these methods, so there is always a wrapper in the hypervisor
      driver. This allows the unused virConnectPtr args to be
      removed from the nodeinfo.c file. Again this will ensure that
      ACL checks will only be performed on invocations that are
      directly associated with public API usage.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c6d4ca5
    • D
      Separate virGetHostname() API contract from driver APIs · ead63031
      Daniel P. Berrange 提交于
      Currently the virGetHostname() API has a bogus virConnectPtr
      parameter. This is because virtualization drivers directly
      reference this API in their virDriverPtr tables, tieing its
      API design to the public virConnectGetHostname API design.
      
      This also causes problems for access control checks since
      these must only be done for invocations from the public
      API, not internal invocation.
      
      Remove the bogus virConnectPtr parameter, and make each
      hypervisor driver provide a dedicated function for the
      driver API impl. This will allow access control checks
      to be easily inserted later.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ead63031
  27. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88