1. 19 9月, 2013 2 次提交
    • D
      Add support for using 3-arg pkcheck syntax for process (CVE-2013-4311) · 69a4bc67
      Daniel P. Berrange 提交于
      With the existing pkcheck (pid, start time) tuple for identifying
      the process, there is a race condition, where a process can make
      a libvirt RPC call and in another thread exec a setuid application,
      causing it to change to effective UID 0. This in turn causes polkit
      to do its permission check based on the wrong UID.
      
      To address this, libvirt must get the UID the caller had at time
      of connect() (from SO_PEERCRED) and pass a (pid, start time, uid)
      triple to the pkcheck program.
      Signed-off-by: NColin Walters <walters@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 922b7fda)
      
      Conflicts:
      	src/access/viraccessdriverpolkit.c
      
      Resolution:
        Dropped file that does not exist in this branch.
      69a4bc67
    • D
      Include process start time when doing polkit checks · 93853474
      Daniel P. Berrange 提交于
      Since PIDs can be reused, polkit prefers to be given
      a (PID,start time) pair. If given a PID on its own,
      it will attempt to lookup the start time in /proc/pid/stat,
      though this is subject to races.
      
      It is safer if the client app resolves the PID start
      time itself, because as long as the app has the client
      socket open, the client PID won't be reused.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 979e9c56)
      
      Conflicts:
      	src/util/virprocess.c
      	src/util/virstring.c
      	src/util/virstring.h
      	src/rpc/virnetserverclient.c
      	src/rpc/virnetsocket.h
      	src/util/viridentity.h
      93853474
  2. 11 7月, 2013 2 次提交
  3. 01 7月, 2013 3 次提交
  4. 01 6月, 2013 1 次提交
    • L
      qemu: prevent termination of guests w/hostdev on driver reconnect · 749d1fd3
      Laine Stump 提交于
      This should resolve:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=959191
      
      The problem was that qemuUpdateActivePciHostdevs was returning 0
      (success) when no hostdevs were present, but would otherwise return -1
      (failure) even when it completed successfully. It is only called from
      qemuProcessReconnect(), and when qemuProcessReconnect got back an
      error, it would not only stop reconnecting, but would terminate the
      guest qemu process "to remove danger of it ending up running twice if
      user tries to start it again later".
      
      (This bug was introduced in commit 011cf7ad, which was pushed between
      v1.0.2 and v1.0.3, so all maintenance branches from v1.0.3 up to 1.0.5
      will need this one line patch applied.)
      (cherry picked from commit 2ea45647)
      749d1fd3
  5. 16 5月, 2013 1 次提交
    • J
      daemon: fix leak after listing all volumes · 7d5e3f02
      Ján Tomko 提交于
      CVE-2013-1962
      
      remoteDispatchStoragePoolListAllVolumes wasn't freeing the pool.
      The pool also held a reference to the connection, preventing it from
      getting freed and closing the netcf interface driver, which held two
      sockets open.
      (cherry picked from commit ca697e90)
      7d5e3f02
  6. 09 5月, 2013 7 次提交
  7. 20 3月, 2013 1 次提交
    • D
      Fix --without-libvirtd builds · 9bf6bec4
      Doug Goldstein 提交于
      When building with --without-libvirtd and udev support is detected we
      will fail to build with the following error:
          node_device/node_device_udev.c:1608:37: error: unknown type name
              'virStateInhibitCallback'
      (cherry picked from commit 52ad612c)
      9bf6bec4
  8. 16 3月, 2013 1 次提交
    • E
      util: portably check for unchanged uid · e0316039
      Eric Blake 提交于
      We've already scrubbed for comparisons of 'uid_t == -1' (which fail
      on platforms where uid_t is a u16), but another one snuck in.
      
      * src/util/virutil.c (virSetUIDGIDWithCaps): Correct uid comparison.
      * cfg.mk (sc_prohibit_risky_id_promotion): New rule.
      (cherry picked from commit 7af86379)
      e0316039
  9. 15 3月, 2013 1 次提交
    • L
      util: fix clear_emulator_capabilities=0 · fe03d586
      Laine Stump 提交于
      My commit 7a2e845a (and its
      prerequisites) managed to effectively ignore the
      clear_emulator_capabilities setting in qemu.conf (visible in the code
      as the VIR_EXEC_CLEAR_CAPS flag when qemu is being exec'ed), with the
      result that the capabilities are always cleared regardless of the
      qemu.conf setting. This patch fixes it by passing the flag through to
      virSetUIDGIDWithCaps(), which uses it to decide whether or not to
      clear existing capabilities before adding in those that were
      requested.
      
      Note that the existing capabilities are *always* cleared if the new
      process is going to run as non-root, since the whole point of running
      non-root is to have the capabilities removed (it's still possible to
      maintain individual capabilities as needed using the capBits argument
      though).
      (cherry picked from commit 2639c6320647778c1496008058dde57dfca35b92)
      fe03d586
  10. 14 3月, 2013 7 次提交
    • J
      Fix size probing for VDI images · cb9170c7
      Ján Tomko 提交于
      Commit 027bf2ea used the wrong offset: the text field at the start
      of the header has 64 bytes, not 68. [1]
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=921452
      
      [1] https://forums.virtualbox.org/viewtopic.php?p=29267#p29267
      (cherry picked from commit 6e46477c)
      cb9170c7
    • G
      qemu: update domain live xml for virsh memtune with --live flag · 2102e03d
      Guannan Ren 提交于
      virsh subcommand memtune forgot updating domain live xml
      after setting cgroup value.
      (cherry picked from commit 0047d5d6)
      2102e03d
    • D
      Daemonize fuse thread in libvirt_lxc · a462372c
      Daniel P. Berrange 提交于
      In some startup failure modes, the fuse thread may get itself
      wedged. This will cause the entire libvirt_lxc process to
      hang trying to the join the thread. There is no compelling
      reason to wait for the thread to exit if the whole process
      is exiting, so just daemonize the fuse thread instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit e31f32c6)
      a462372c
    • J
      virsh: fix snapshot-create with no xmlfile · 5c31970a
      Ján Tomko 提交于
      Properly check the return value of vshCommandOptStringReq for xmlfile:
      * error out on incorrect input (--xmlfile '')
      * use default XML <domainsnapshot/> with no --xmlfile specified
      
      (Broken by commit b2e85855)
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=919826
      (cherry picked from commit 2fc5ff11)
      5c31970a
    • G
      lxc: Init activeUsbHostdevs · 3d59f5f5
      Guido Günther 提交于
      otherwise we crash with
      
       #0  virUSBDeviceListFind (list=0x0, dev=dev@entry=0x8193d70) at util/virusb.c:526
       #1  0xb1a4995b in virLXCPrepareHostdevUSBDevices (driver=driver@entry=0x815d9a0, name=0x815dbf8 "debian-700267", list=list@entry=0x81d8f08) at lxc/lxc_hostdev.c:88
       #2  0xb1a49fce in virLXCPrepareHostUSBDevices (def=0x8193af8, driver=0x815d9a0) at lxc/lxc_hostdev.c:261
       #3  virLXCPrepareHostDevices (driver=driver@entry=0x815d9a0, def=0x8193af8) at lxc/lxc_hostdev.c:328
       #4  0xb1a4c5b1 in virLXCProcessStart (conn=0x817d3f8, driver=driver@entry=0x815d9a0, vm=vm@entry=0x8190908, autoDestroy=autoDestroy@entry=false, reason=reason@entry=VIR_DOMAIN_RUNNING_BOOTED)
           at lxc/lxc_process.c:1068
       #5  0xb1a57e00 in lxcDomainStartWithFlags (dom=dom@entry=0x815e460, flags=flags@entry=0) at lxc/lxc_driver.c:1014
       #6  0xb1a57fc3 in lxcDomainStart (dom=0x815e460) at lxc/lxc_driver.c:1046
       #7  0xb79c8375 in virDomainCreate (domain=domain@entry=0x815e460) at libvirt.c:8450
       #8  0x08078959 in remoteDispatchDomainCreate (args=0x81920a0, rerr=0xb65c21d0, client=0xb0d00490, server=<optimized out>, msg=<optimized out>) at remote_dispatch.h:1066
       #9  remoteDispatchDomainCreateHelper (server=0x80c4928, client=0xb0d00490, msg=0xb0d005b0, rerr=0xb65c21d0, args=0x81920a0, ret=0x815d208) at remote_dispatch.h:1044
       #10 0xb7a36901 in virNetServerProgramDispatchCall (msg=0xb0d005b0, client=0xb0d00490, server=0x80c4928, prog=0x80c6438) at rpc/virnetserverprogram.c:432
       #11 virNetServerProgramDispatch (prog=0x80c6438, server=server@entry=0x80c4928, client=0xb0d00490, msg=0xb0d005b0) at rpc/virnetserverprogram.c:305
       #12 0xb7a300a7 in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x80c4928) at rpc/virnetserver.c:162
       #13 virNetServerHandleJob (jobOpaque=0xb0d00510, opaque=0x80c4928) at rpc/virnetserver.c:183
       #14 0xb7924f98 in virThreadPoolWorker (opaque=opaque@entry=0x80a94b0) at util/virthreadpool.c:144
       #15 0xb7924515 in virThreadHelper (data=0x80a9440) at util/virthreadpthread.c:161
       #16 0xb7887c39 in start_thread (arg=0xb65c2b70) at pthread_create.c:304
       #17 0xb77eb78e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
      
      when adding a domain with a usb device. This is Debian bug
      
          http://bugs.debian.org/700267
      (cherry picked from commit 6082bc27)
      3d59f5f5
    • G
      lxc: include sys/stat.h · dac288fd
      Guido Günther 提交于
      This fixes the build on Debian Wheezy which otherwise fails with:
      
        CC     libvirt_driver_lxc_impl_la-lxc_process.lo
        lxc/lxc_process.c: In function 'virLXCProcessGetNsInode':
        lxc/lxc_process.c:648:5: error: implicit declaration of function 'stat' [-Werror=implicit-function-declaration]
        lxc/lxc_process.c:648:5: error: nested extern declaration of 'stat' [-Werror=nested-externs]
        cc1: all warnings being treated as errors
      (cherry picked from commit c8871d8f)
      dac288fd
    • G
      util: fix a integer boundary error · d45cf984
      Guannan Ren 提交于
      A value which is equal to a integer maximum such as LLONG_MAX is
      a valid integer value.
      
      The patch fix the following error:
      1, virsh memtune vm --swap-hard-limit -1
      2, virsh start vm
      In debug mode, it shows error like:
      virScaleInteger:1813 : numerical overflow:\
                             value too large: 9007199254740991KiB
      (cherry picked from commit b38a040a)
      d45cf984
  11. 05 3月, 2013 13 次提交
  12. 04 3月, 2013 1 次提交
    • G
      util: use string libvirt to prefix error message instead of libvir · b95c13cd
      Guannan Ren 提交于
      BZ:https://bugzilla.redhat.com/show_bug.cgi?id=912021
      Without error handler set, virDefaultErrorFunc will be called, the
      error message is prefixed with "libvir:". It become a little better
      by using prefix "libvirt:" when working with upper application.
      
      For example:
      1, stop libvirtd daemon
      2, run virt-top.
      libvir: XML-RPC error : Failed to connect \
              socket to '/var/run/libvirt/libvirt-sock-ro': \
              No such file or directory
      libvirt: VIR_ERR_SYSTEM_ERROR: VIR_FROM_RPC: \
              Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': \
              No such file or directory
      b95c13cd