1. 30 10月, 2013 8 次提交
    • D
      Block all use of getenv with syntax-check · d47659dc
      Daniel P. Berrange 提交于
      The use of getenv is typically insecure, and we want people
      to use our wrappers, to force them to think about setuid
      needs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 71b21f12)
      d47659dc
    • D
      Remove all direct use of getenv · 97f3a8d8
      Daniel P. Berrange 提交于
      Unconditional use of getenv is not secure in setuid env.
      While not all libvirt code runs in a setuid env (since
      much of it only exists inside libvirtd) this is not always
      clear to developers. So make all the code paranoid, even
      if it only ever runs inside libvirtd.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 1e4a02bd)
      97f3a8d8
    • D
      Make virCommand env handling robust in setuid env · 6f5f52c4
      Daniel P. Berrange 提交于
      When running setuid, we must be careful about what env vars
      we allow commands to inherit from us. Replace the
      virCommandAddEnvPass function with two new ones which do
      filtering
      
        virCommandAddEnvPassAllowSUID
        virCommandAddEnvPassBlockSUID
      
      And make virCommandAddEnvPassCommon use the appropriate
      ones
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 9b8f307c)
      
      Conflicts:
      	src/qemu/qemu_command.c
      6f5f52c4
    • D
      Initialize threading & error layer in LXC controller · b4ae6429
      Daniel P. Berrange 提交于
      In Fedora 20, libvirt_lxc crashes immediately at startup with a
      trace
      
       #0  0x00007f0cddb653ec in free () from /lib64/libc.so.6
       #1  0x00007f0ce0e16f4a in virFree (ptrptr=ptrptr@entry=0x7f0ce1830058) at util/viralloc.c:580
       #2  0x00007f0ce0e2764b in virResetError (err=0x7f0ce1830030) at util/virerror.c:354
       #3  0x00007f0ce0e27a5a in virResetLastError () at util/virerror.c:387
       #4  0x00007f0ce0e28858 in virEventRegisterDefaultImpl () at util/virevent.c:233
       #5  0x00007f0ce0db47c6 in main (argc=11, argv=0x7fff4596c328) at lxc/lxc_controller.c:2352
      
      Normally virInitialize calls virErrorInitialize and
      virThreadInitialize, but we don't link to libvirt.so
      in libvirt_lxc, and nor did we ever call the error
      or thread initializers.
      
      I have absolutely no idea how this has ever worked, let alone
      what caused it to stop working in Fedora 20.
      
      In addition not all code paths from virLogSetFromEnv will
      ensure virLogInitialize is called correctly, which is another
      possible crash scenario.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 97973ebb)
      b4ae6429
    • D
      Fix flaw in detecting log format · 00991ef1
      Daniel P. Berrange 提交于
      The log message regex has been
      
      [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{4}: [0-9]+: debug|info|warning|error :
      
      The precedence of '|' is high though, so this is equivalent to matching
      
         [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{4}: [0-9]+: debug
      
      Or
      
         info
      
      Or
      
         warning
      
      Or
      
         error :
      
      Which is clearly not what it should have done. This caused the code to
      skip over things which are not log messages. The solution is to simply
      add brackets.
      
      A test case is also added to validate correctness.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 5787f0b9)
      00991ef1
    • D
      Move virt-login-shell into libvirt-login-shell sub-RPM · 908efd3e
      Daniel P. Berrange 提交于
      Many people will not want the setuid virt-login-shell binary
      installed by default, so move it into a separate sub-RPM
      named libvirt-login-shell. This RPM is only generated if
      LXC is enabled
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 8adc9269)
      908efd3e
    • E
      spec: fix rpm build when lxc disabled · 0a256771
      Eric Blake 提交于
      'make rpm' failed if ~/.rpmmacros contains '%_without_lxc 1',
      which simulates the case of not having lxc available.
      
      RPM build errors:
          File not found: /home/eblake/rpmbuild/BUILDROOT/libvirt-1.1.1-1.fc19.x86_64/etc/libvirt/virt-login-shell.conf
          File not found by glob: /home/eblake/rpmbuild/BUILDROOT/libvirt-1.1.1-1.fc19.x86_64/usr/share/man/man1/virt-login-shell.1*
          File not found: /home/eblake/rpmbuild/BUILDROOT/libvirt-1.1.1-1.fc19.x86_64/usr/bin/virt-login-shell
      make: *** [rpm] Error 1
      
      Reported by Dan Berrange.
      
      * libvirt.spec.in: Mark virt-login-shell as conditional on lxc.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit d42906fd)
      0a256771
    • D
      Set a sane $PATH for virt-login-shell · 050c432d
      Daniel P. Berrange 提交于
      The virt-login-shell binary shouldn't need to execute programs
      relying on $PATH, but just in case set a fixed $PATH value
      of /bin:/usr/bin
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit d665003d)
      050c432d
  2. 23 10月, 2013 3 次提交
    • M
      python: Fix Create*WithFiles filefd passing · 713a4f4b
      Marian Neagul 提交于
      Commit d76227be added functions virDomainCreateWithFiles and
      virDomainCreateXMLWithFiles, but there was a little piece missing in
      python bindings.  This patch fixes proper passing of file descriptors
      in the overwrites of these functions.
      713a4f4b
    • J
      build: fix build of virt-login-shell on systems with older gnutls · 549f9649
      Jim Fehlig 提交于
      On systems where gnutls uses libgcrypt, I'm seeing the following
      build failure
      
      libvirt.c:314: error: variable 'virTLSThreadImpl' has initializer but incomplete type
      libvirt.c:319: error: 'GCRY_THREAD_OPTION_PTHREAD' undeclared here (not in a function)
      ...
      
      Fix by undefining WITH_GNUTLS_GCRYPT in config-post.h
      549f9649
    • J
      build: fix linking virt-login-shell · 5a275469
      Jim Fehlig 提交于
      After commit 3e2f27e1, I've noticed build failures of virt-login-shell
      when libapparmor-devel is installed on the build host
      
      CCLD     virt-login-shell
      ../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-vircommand.o):
      In function `virExec':
      /home/jfehlig/virt/upstream/libvirt/src/util/vircommand.c:653: undefined
      reference to `aa_change_profile'
      collect2: error: ld returned 1 exit status
      
      I was about to commit an easy fix under the build-breaker rule
      (build-fix-1.patch), but thought to extend the notion of SECDRIVER_LIBS
      to SECDRIVER_CFLAGS, and use both throughout src/Makefile.am where it
      makes sense (build-fix-2.patch).
      
      Should I just stick with the simple fix, or is something along the lines
      of patch 2 preferred?
      
      Regards,
      Jim
      
      >From a0f35945f3127ab70d051101037e821b1759b4bb Mon Sep 17 00:00:00 2001
      From: Jim Fehlig <jfehlig@suse.com>
      Date: Mon, 21 Oct 2013 15:30:02 -0600
      Subject: [PATCH] build: fix virt-login-shell build with apparmor
      
      With libapparmor-devel installed, virt-login-shell fails to link
      
      CCLD     virt-login-shell
      ../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-vircommand.o): In function `virExec':
      /home/jfehlig/virt/upstream/libvirt/src/util/vircommand.c:653: undefined reference to `aa_change_profile'
      collect2: error: ld returned 1 exit status
      
      Fix by linking libvirt_setuid_rpc_client with previously determined
      SECDRIVER_LIBS in src/Makefile.am.  While at it, introduce SECDRIVER_CFLAGS
      and use both throughout src/Makefile.am where it makes sense.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      
      Conflicts:
      	src/Makefile.am: Context
      5a275469
  3. 21 10月, 2013 5 次提交
  4. 18 10月, 2013 1 次提交
  5. 15 10月, 2013 7 次提交
  6. 07 10月, 2013 1 次提交
  7. 01 10月, 2013 1 次提交
  8. 27 9月, 2013 1 次提交
    • D
      Fix crash in libvirtd when events are registered & ACLs active · 841284a0
      Daniel P. Berrange 提交于
      When a client disconnects from libvirtd, all event callbacks
      must be removed. This involves running the public API
      
        virConnectDomainEventDeregisterAny
      
      This code does not run in normal API dispatch context, so no
      identity was set. The result was that the access control drivers
      denied the attempt to deregister callbacks. The callbacks thus
      continued to trigger after the client was free'd causing fairly
      predictable use of free memory & a crash.
      
      This can be triggered by any client with readonly access when
      the ACL drivers are active.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 8294aa0c)
      841284a0
  9. 25 9月, 2013 1 次提交
    • M
      qemu: Fix seamless SPICE migration · b6ea7abc
      Martin Kletzander 提交于
      Since the wait is done during migration (still inside
      QEMU_ASYNC_JOB_MIGRATION_OUT), the code should enter the monitor as such
      in order to prohibit all other jobs from interfering in the meantime.
      This patch fixes bug #1009886 in which qemuDomainGetBlockInfo was
      waiting on the monitor condition and after GetSpiceMigrationStatus
      mangled its internal data, the daemon crashed.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1009886
      (cherry picked from commit 484cc321)
      b6ea7abc
  10. 24 9月, 2013 1 次提交
  11. 20 9月, 2013 1 次提交
  12. 19 9月, 2013 1 次提交
    • D
      Fix crash in remoteDispatchDomainMemoryStats (CVE-2013-4296) · 10d159fe
      Daniel P. Berrange 提交于
      The 'stats' variable was not initialized to NULL, so if some
      early validation of the RPC call fails, it is possible to jump
      to the 'cleanup' label and VIR_FREE an uninitialized pointer.
      This is a security flaw, since the API can be called from a
      readonly connection which can trigger the validation checks.
      
      This was introduced in release v0.9.1 onwards by
      
        commit 158ba873
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed Apr 13 16:21:35 2011 +0100
      
          Merge all returns paths from dispatcher into single path
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit e7f400a1)
      10d159fe
  13. 18 9月, 2013 3 次提交
  14. 17 9月, 2013 1 次提交
    • E
      build: fix build with latest rawhide kernel headers · 68b18130
      Eric Blake 提交于
      Bother those kernel developers.  In the latest rawhide, kernel
      and glibc have now been unified so that <netinet/in.h> and
      <linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
      not self-contained.  Because of the latest header change, the
      build is failing with:
      
      checking for linux/param.h... no
      configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
      
      with details:
      
      In file included from conftest.c:561:0:
      /usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
        struct in6_addr flr_dst;
      
      We need a workaround to avoid our workaround :)
      
      * configure.ac (NETINET_LINUX_WORKAROUND): New test.
      * src/util/virnetdevbridge.c (includes): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit e62e0094)
      68b18130
  15. 06 9月, 2013 2 次提交
    • G
      Pass AM_LDFLAGS to driver modules too · e89bdf01
      Guido Günther 提交于
      This gives us a RO got, otherwise Debian's lintian complains:
      
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_qemu.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_storage.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_uml.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_vbox.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_xen.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_nwfilter.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_storage.so
      W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_uml.so
      W: libvirt-sanlock: hardening-no-relro usr/lib/libvirt/lock-driver/sanlock.so
      (cherry picked from commit f1f0e53b)
      e89bdf01
    • G
      Fix AM_LDFLAGS typo · 261d5fd5
      Guido Günther 提交于
      (cherry picked from commit fe502de3)
      261d5fd5
  16. 05 9月, 2013 1 次提交
  17. 02 9月, 2013 2 次提交