1. 29 7月, 2013 1 次提交
  2. 23 7月, 2013 2 次提交
    • M
      virSecurityManagerGenLabel: Skip seclabels without model · c5433874
      Michal Privoznik 提交于
      While generating seclabels, we check the seclabel stack if required
      driver is in the stack. If not, an error is returned. However, it is
      possible for a seclabel to not have any model set (happens with LXC
      domains that have just <seclabel type='none'>). If that's the case,
      we should just skip the iteration instead of calling STREQ(NULL, ...)
      and SIGSEGV-ing subsequently.
      (cherry picked from commit ba44dd24)
      c5433874
    • M
      lxcCapsInit: Allocate primary security driver unconditionally · 06e612e9
      Michal Privoznik 提交于
      Currently, if the primary security driver is 'none', we skip
      initializing caps->host.secModels. This means, later, when LXC domain
      XML is parsed and <seclabel type='none'/> is found (see
      virSecurityLabelDefsParseXML), the model name is not copied to the
      seclabel. This leads to subsequent crash in virSecurityManagerGenLabel
      where we call STREQ() over the model (note, that we are expecting model
      to be !NULL).
      (cherry picked from commit 37d96498)
      
      Conflicts:
      	src/lxc/lxc_conf.c
      06e612e9
  3. 20 7月, 2013 13 次提交
    • E
      security: fix deadlock with prefork · 7f72e6c3
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964358
      
      Attempts to start a domain with both SELinux and DAC security
      modules loaded will deadlock; latent problem introduced in commit
      fdb3bde3 and exposed in commit 29fe5d74.  Basically, when recursing
      into the security manager for other driver's prefork, we have to
      undo the asymmetric lock taken at the manager level.
      
      Reported by Jiri Denemark, with diagnosis help from Dan Berrange.
      
      * src/security/security_stack.c (virSecurityStackPreFork): Undo
      extra lock grabbed during recursion.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit bfc183c1)
      7f72e6c3
    • E
      security_dac: compute supplemental groups before fork · 47d520cd
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964358
      
      Commit 75c12564 states that virGetGroupList must not be called
      between fork and exec, then commit ee777e99 promptly violated
      that for lxc's use of virSecurityManagerSetProcessLabel.  Hoist
      the supplemental group detection to the time that the security
      manager needs to fork.  Qemu is safe, as it uses
      virSecurityManagerSetChildProcessLabel which in turn uses
      virCommand to determine supplemental groups.
      
      This does not fix the fact that virSecurityManagerSetProcessLabel
      calls virSecurityDACParseIds calls parseIds which eventually
      calls getpwnam_r, which also violates fork/exec async-signal-safe
      safety rules, but so far no one has complained of hitting
      deadlock in that case.
      
      * src/security/security_dac.c (_virSecurityDACData): Track groups
      in private data.
      (virSecurityDACPreFork): New function, to set them.
      (virSecurityDACClose): Clean up new fields.
      (virSecurityDACGetIds): Alter signature.
      (virSecurityDACSetSecurityHostdevLabelHelper)
      (virSecurityDACSetChardevLabel, virSecurityDACSetProcessLabel)
      (virSecurityDACSetChildProcessLabel): Update callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 29fe5d74)
      47d520cd
    • E
      security: framework for driver PreFork handler · 6a47028a
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964358
      
      A future patch wants the DAC security manager to be able to safely
      get the supplemental group list for a given uid, but at the time
      of a fork rather than during initialization so as to pick up on
      live changes to the system's group database.  This patch adds the
      framework, including the possibility of a pre-fork callback
      failing.
      
      For now, any driver that implements a prefork callback must be
      robust against the possibility of being part of a security stack
      where a later element in the chain fails prefork.  This means
      that drivers cannot do any action that requires a call to postfork
      for proper cleanup (no grabbing a mutex, for example).  If this
      is too prohibitive in the future, we would have to switch to a
      transactioning sequence, where each driver has (up to) 3 callbacks:
      PreForkPrepare, PreForkCommit, and PreForkAbort, to either clean
      up or commit changes made during prepare.
      
      * src/security/security_driver.h (virSecurityDriverPreFork): New
      callback.
      * src/security/security_manager.h (virSecurityManagerPreFork):
      Change signature.
      * src/security/security_manager.c (virSecurityManagerPreFork):
      Optionally call into driver, and allow returning failure.
      * src/security/security_stack.c (virSecurityDriverStack):
      Wrap the handler for the stack driver.
      * src/qemu/qemu_process.c (qemuProcessStart): Adjust caller.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit fdb3bde3)
      6a47028a
    • E
      util: make virSetUIDGID async-signal-safe · 97565e96
      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>
      (cherry picked from commit ee777e99)
      
      Conflicts:
      	src/lxc/lxc_container.c - did not use setUIDGID before 1.1.0
      	src/util/virutil.c - oom handling changes not backported
      97565e96
    • E
      util: add virGetGroupList · c3c8689e
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964358
      
      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>
      (cherry picked from commit 75c12564)
      c3c8689e
    • E
      util: improve user lookup helper · eae63106
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964358
      
      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>
      (cherry picked from commit c1983ba4)
      
      Conflicts:
      	src/util/virutil.c - oom reporting changes not backported
      eae63106
    • J
      Fix build with clang · 11ef5969
      Ján Tomko 提交于
      Partially revert cdd703f4's revert of c1634100, as linking with clang
      with --param=ssp-buffer-size=4 still fails with:
      "argument unused during compilation".
      
      (cherry picked from commit 4b91dc24)
      11ef5969
    • E
      maint: update to latest gnulib · 89742f50
      Eric Blake 提交于
      Upstream gnulib recently patched a bug in bootstrap, for projects
      that use a different name than build-aux for a subdirectory.  We
      don't, but it doesn't hurt to update.
      
      * .gnulib: Update, for bootstrap fix.
      * bootstrap: Sync to upstream.
      * bootstrap.conf: Match upstream bug fix.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit ac0852c7)
      89742f50
    • E
      maint: update to latest gnulib · 4732be40
      Eric Blake 提交于
      Future patches need LGPLv2+ versions of some modules that had
      recent license changes; but separating the gnulib update from
      the actual use of the modules makes it easier to backport to
      an older version while avoiding a submodule update (assuming,
      of course, that the backport is to a system where glibc provides
      adequate functionaliy without needing the gnulib module).
      
      * .gnulib: Update to latest, for modules needed in later patches.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 7961ad21)
      4732be40
    • E
      build: honor autogen.sh --no-git · dea245eb
      Eric Blake 提交于
      Based on a report by Chandrashekar Shastri, at
      https://bugzilla.redhat.com/show_bug.cgi?id=979360
      
      On systems where git cannot access the outside world, a developer
      can instead arrange to get a copy of gnulib at the right commit
      via side channels (such as NFS share drives), set GNULIB_SRCDIR,
      then use ./autogen.sh --no-git.  In this setup, we will now
      avoid direct use of git.  Of course, this means no automatic
      gnulib updates when libvirt.git updates its submodule, but it
      is expected that any developer in such a situation is already
      prepared to deal with the fallout.
      
      * .gnulib: Update to latest, for bootstrap.
      * bootstrap: Synchronize from gnulib.
      * autogen.sh (no_git): Avoid git when requested.
      * cfg.mk (_update_required): Skip automatic rerun of bootstrap if
      we can't use git.
      * docs/compiling.html.in: Document this setup.
      * docs/hacking.html.in: Mention this.
      * HACKING: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 1e503ee5)
      dea245eb
    • E
      maint: update to latest gnulib · 47e2fbb5
      Eric Blake 提交于
      The latest mingw headers on Fedora 19 fail to build with gnulib
      without an update.
      
      Meanwhile, now that upstream gnulib has better handling of -W
      probing for clang, we can drop some of our own solutions in
      favor of upstream; thus this reverts commit c1634100, "Correctly
      detect warning flags with clang".
      
      * .gnulib: Update to latest, for mingw and clang.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit cdd703f4)
      47e2fbb5
    • P
      qemu: Fix double free of returned JSON array in qemuAgentGetVCPUs() · cafcec2f
      Peter Krempa 提交于
      CVE-2013-4153
      
      A part of the returned monitor response was freed twice and caused
      crashes of the daemon when using guest agent cpu count retrieval.
      
       # virsh vcpucount dom --guest
      
      Introduced in v1.0.6-48-gc6afcb05
      
      (cherry picked from commit dfc69235)
      cafcec2f
    • A
      qemu: Prevent crash of libvirtd without guest agent configuration · a0f8c42b
      Alex Jia 提交于
      CVE-2013-4154
      
      If users haven't configured guest agent then qemuAgentCommand() will
      dereference a NULL 'mon' pointer, which causes crash of libvirtd when
      using agent based cpu (un)plug.
      
      With the patch, when the qemu-ga service isn't running in the guest,
      a expected error "error: Guest agent is not responding: Guest agent
      not available for now" will be raised, and the error "error: argument
      unsupported: QEMU guest agent is not configured" is raised when the
      guest hasn't configured guest agent.
      
      GDB backtrace:
      
       (gdb) bt
       #0  virNetServerFatalSignal (sig=11, siginfo=<value optimized out>, context=<value optimized out>) at rpc/virnetserver.c:326
       #1  <signal handler called>
       #2  qemuAgentCommand (mon=0x0, cmd=0x7f39300017b0, reply=0x7f394b090910, seconds=-2) at qemu/qemu_agent.c:975
       #3  0x00007f39429507f6 in qemuAgentGetVCPUs (mon=0x0, info=0x7f394b0909b8) at qemu/qemu_agent.c:1475
       #4  0x00007f39429d9857 in qemuDomainGetVcpusFlags (dom=<value optimized out>, flags=9) at qemu/qemu_driver.c:4849
       #5  0x00007f3957dffd8d in virDomainGetVcpusFlags (domain=0x7f39300009c0, flags=8) at libvirt.c:9843
      
      How to reproduce?
      
       # To start a guest without guest agent configuration
       # then run the following cmdline
      
       # virsh vcpucount foobar --guest
       error: End of file while reading data: Input/output error
       error: One or more references were leaked after disconnect from the hypervisor
       error: Failed to reconnect to the hypervisor
      
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=984821Signed-off-by: NAlex Jia <ajia@redhat.com>
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      (cherry picked from commit 96518d43)
      a0f8c42b
  4. 11 7月, 2013 1 次提交
  5. 10 7月, 2013 2 次提交
  6. 09 7月, 2013 2 次提交
  7. 03 7月, 2013 1 次提交
    • E
      build: don't ship access syms files in tarball · 53ad5729
      Eric Blake 提交于
      On a mingw VPATH build (such as done by ./autobuild.sh), the tarball
      created by 'make dist' was including generated files.  The VPATH
      rules were then seeing that the tarball files were up-to-date, and
      not regenerating files locally, leading to this failure:
      
        GEN      libvirt.syms
      cat: libvirt_access.syms: No such file or directory
      cat: libvirt_access_qemu.syms: No such file or directory
      cat: libvirt_access_lxc.syms: No such file or directory
      make: *** [libvirt.syms] Error 1
      
      We already have a category for generated sym files, which are
      intentionally not part of the tarball; stick the access sym
      files in that category.  The rearrange the declarations a bit
      to make it harder to repeat the problem, dropping things that
      are now redundant (for example, BUILT_FILES already includes
      GENERATED_SYM_FILES, so it does not also need to call out
      ACCESS_DRIVER_SYM_FILES).
      
      * src/Makefile.am (USED_SYM_FILES): Don't include generated files.
      (GENERATED_SYM_FILES): Access syms files are generated.
      (libvirt.syms): Include access syms files here.
      (ACCESS_DRIVER_SYMFILES): Rename...
      (ACCESS_DRIVER_SYM_FILES): ...for consistency.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 336bf8e2)
      53ad5729
  8. 02 7月, 2013 5 次提交
    • E
      build: work around mingw header pollution · 612ba1ec
      Eric Blake 提交于
      On Fedora 18, when cross-compiling to mingw with the mingw*-dbus
      packages installed, compilation fails with:
      
        CC       libvirt_net_rpc_server_la-virnetserver.lo
      In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31,
                       from ../../src/util/virdbus.h:26,
                       from ../../src/rpc/virnetserver.c:39:
      /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct'
      
      I have reported this as a bug against two packages:
      - mingw-headers, for polluting the namespace
      https://bugzilla.redhat.com/show_bug.cgi?id=980270
      - dbus, for not dealing with the pollution
      https://bugzilla.redhat.com/show_bug.cgi?id=980278
      
      At least dbus has agreed that a future version of dbus headers will
      do s/interface/iface/, regardless of what happens in mingw. But it
      is also easy to workaround in libvirt in the meantime, without having
      to wait for either mingw or dbus to upgrade.
      
      * src/util/virdbus.h (includes): Undo mingw's pollution so that
      dbus doesn't fail.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 1528e8b2)
      612ba1ec
    • M
      qemuNodeDeviceDetachFlags: Avoid use of uninitialized variables · e49baa06
      Michal Privoznik 提交于
      After abf75aea the compiler screams:
      
      qemu/qemu_driver.c: In function 'qemuNodeDeviceDetachFlags':
      qemu/qemu_driver.c:10693:9: error: 'domain' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           pci = virPCIDeviceNew(domain, bus, slot, function);
               ^
      qemu/qemu_driver.c:10693:9: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      qemu/qemu_driver.c:10693:9: error: 'slot' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      qemu/qemu_driver.c:10693:9: error: 'function' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      Since the other functions qemuNodeDeviceReAttach and qemuNodeDeviceReset
      looks exactly the same, I've initialized the variables there as well.
      However, I am still wondering why those functions don't matter to gcc
      while the first one does.
      (cherry picked from commit bc09c5d3)
      e49baa06
    • J
      qemu: fix return value of qemuDomainBlockPivot on errors · ab84d974
      Ján Tomko 提交于
      If qemuMonitorBlockJob returned 0, qemuDomainBlockPivot
      might return 0 even if an error occured.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=977678
      (cherry picked from commit c34107df)
      ab84d974
    • E
      build: configure must not affect tarball contents · 48754fb7
      Eric Blake 提交于
      On mingw, configure sets the name of the lxc symfile to
      libvirt_lxc.defs rather than libvirt_lxc.syms.  But tarballs
      must be arch-independent, regardless of the configure options
      used for the tree where we ran 'make dist'.  This led to the
      following failure in autobuild.sh:
      
        CCLD     libvirt-lxc.la
        CCLD     libvirt-qemu.la
      /usr/lib64/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld: cannot find libvirt_lxc.def: No such file or directory
      collect2: error: ld returned 1 exit status
      make[3]: *** [libvirt-lxc.la] Error 1
      make[3]: *** Waiting for unfinished jobs....
      
      We were already doing the right thing with libvirt_qemu.syms.
      
      * src/Makefile.am (EXTRA_DIST): Don't ship a built file which
      depends on configure for its final name.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit d79c9273)
      48754fb7
    • E
      build: avoid build failure without gnutls · a3a26e3b
      Eric Blake 提交于
      Found while trying to cross-compile to mingw:
      
        CC       libvirt_driver_remote_la-remote_driver.lo
      ../../src/remote/remote_driver.c: In function 'doRemoteOpen':
      ../../src/remote/remote_driver.c:487:23: error: variable 'verify' set but not used [-Werror=unused-but-set-variable]
      
      * src/remote/remote_driver.c (doRemoteOpen): Also ignore 'verify'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 4e6a78e7)
      a3a26e3b
  9. 01 7月, 2013 5 次提交
    • D
      Release of libvirt-1.1.0 · 034d3229
      Daniel Veillard 提交于
      * configure.ac docs/news.html.in libvirt.spec.in: updated for the release
      * po/*.po*: updated localizations and regenerated
      034d3229
    • D
      Crash of libvirtd by unprivileged user in virConnectListAllInterfaces · 244e0b8c
      Daniel P. Berrange 提交于
      On Thu, Jun 27, 2013 at 03:56:42PM +0100, Daniel P. Berrange wrote:
      > Hi Security Team,
      >
      > I've discovered a way for an unprivileged user with a readonly connection
      > to libvirtd, to crash the daemon.
      
      Ok, the final patch for this is issue will be the simpler variant that
      Eric suggested
      
      The embargo can be considered to be lifted on Monday July 1st, at
      0900 UTC
      
      The following is the GIT change that DV or myself will apply to libvirt
      GIT master immediately before the 1.1.0 release:
      
      >From 177b4165c531a4b3ba7f6ab6aa41dca9ceb0b8cf Mon Sep 17 00:00:00 2001
      From: "Daniel P. Berrange" <berrange@redhat.com>
      Date: Fri, 28 Jun 2013 10:48:37 +0100
      Subject: [PATCH] CVE-2013-2218: Fix crash listing network interfaces with
       filters
      
      The virConnectListAllInterfaces method has a double-free of the
      'struct netcf_if' object when any of the filtering flags cause
      an interface to be skipped over. For example when running the
      command 'virsh iface-list --inactive'
      
      This is a regression introduced in release 1.0.6 by
      
        commit 7ac2c4fe
        Author: Guannan Ren <gren@redhat.com>
        Date:   Tue May 21 21:29:38 2013 +0800
      
          interface: list all interfaces with flags == 0
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      244e0b8c
    • L
      pci: initialize virtual_functions array pointer to avoid segfault · 2c2525ab
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=971325
      
      The problem was that if virPCIGetVirtualFunctions was given the name
      of a non-existent interface, it would return to its caller without
      initializing the pointer to the array of virtual functions to NULL,
      and the caller (virNetDevGetVirtualFunctions) would try to VIR_FREE()
      the invalid pointer.
      
      The final error message before the crash would be:
      
       virPCIGetVirtualFunctions:2088 :
        Failed to open dir '/sys/class/net/eth2/device':
        No such file or directory
      
      In this patch I move the initialization in virPCIGetVirtualFunctions()
      to the begining of the function, and also do an explicit
      initialization in virNetDevGetVirtualFunctions, just in case someone
      in the future adds code into that function prior to the call to
      virPCIGetVirtualFunctions.
      2c2525ab
    • L
      node device driver: update driver name during dumpxml · 374c5e4f
      Laine Stump 提交于
      This fixes:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=979290
        https://bugzilla.redhat.com/show_bug.cgi?id=979330
      
      The node device driver was written with the assumption that udev would
      use a "change" event to notify libvirt of any change to device status
      (including the name of the driver it was bound to). It turns out this
      is not the case (see Comment 4 of BZ 979290). That means that a
      dumpxml for a device would always show whatever driver happened to be
      bound at the time libvirt was started (when the node device cache was
      built).
      
      There was already code in the driver (for the benefit of the HAL
      backend) that updated the driver name from sysfs each time a device's
      info was retrieved from the cache. This patch just enables that manual
      update for the udev backend as well.
      374c5e4f
    • D
      Document security reporting & handling process · 49e6a16f
      Daniel P. Berrange 提交于
      Historically security issues in libvirt have been primarily
      triaged & fixed by the Red Hat libvirt members & Red Hat
      security team, who then usually notify other vendors via
      appropriate channels. There have been a number of times
      when vendors have not been properly notified ahead of
      announcement. It has also disadvantaged community members
      who have to backport fixes to releases for which there are
      no current libvirt stable branches.
      
      To address this, we want to make the libvirt security process
      entirely community focused / driven. To this end I have setup
      a new email address "libvirt-security@redhat.com" for end
      users to report bugs which have (possible) security implications.
      
      This email addr is backed by an invitation only, private
      archive, mailing list. The intent is for the list membership
      to comprise a subset of the libvirt core team, along with any
      vendor security team engineers who wish to participate in a
      responsible disclosure process for libvirt. Members of the
      list will be responsible for analysing the problem to determine
      if a security issue exists and then issue fixes for all current
      official stable branches & git master.
      
      I am proposing the following libvirt core team people as
      members of the security team / list (all cc'd):
      
         Daniel Berrange (Red Hat)
         Eric Blake (Red Hat)
         Jiri Denemar (Red Hat)
         Daniel Veillard (Red Hat)
         Jim Fehlig (SUSE)
         Doug Goldstein (Gentoo)
         Guido Günther (Debian)
      
      We don't have anyone from Ubuntu on the libvirt core team.
      Serge Hallyn is the most frequent submitter of patches from
      Ubuntu in recent history, so I'd like to invite him to join.
      Alternatively, Serge, feel free to suggest someone else to
      represent Ubuntu's interests.
      
      If any other vendors/distros have security people who are
      responsible for dealing with libvirt security issues, and
      want to join to get early disclosure of issues, they can
      suggest people. Existing security team members will vet /
      approve such requests to ensure they are genuine.
      
      Anyone on the team / list will be **required** to honour any
      embargo period agreed between members for non-public issues
      that are reported. The aim will be to have a maximum 2 week
      embargo period in the common case, extendable to 1 month if
      there is sufficient justification made. If anyone feels they
      are unable to follow such an embargo process for whatever
      reason, please decline membership of the security list/team.
      
      The patch which follows puts up some docs on the website
      about all of this....
      
      Document how to report security bugs and the process that
      will be used for addressing them.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      49e6a16f
  10. 30 6月, 2013 1 次提交
    • E
      spec: require xen-devel for libxl driver · 3a214482
      Eric Blake 提交于
      When using 'rpmbuild --define "_without_xen 1"', but on a new enough
      Fedora where %{with_libxl} still gets set to 1 by default, the
      build dependencies were incomplete, which could result in 'make rpm'
      failing because ./configure failed to build the libxl driver.
      
      * libvirt.spec.in (BuildRequires): Fix xen-devel condition.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3a214482
  11. 29 6月, 2013 5 次提交
    • J
      Resolve valgrind errors for nodedev cap parsing · 79e9a224
      John Ferlan 提交于
      There were two errors, one as a direct result of commit id '8807b285'
      and the other from cut-n-paste
      
      TEST: nodedevxml2xmltest
            ..............                           14  OK
      ==25735== 3 bytes in 1 blocks are definitely lost in loss record 1 of 24
      ==25735==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==25735==    by 0x344D2AF275: xmlStrndup (in /usr/lib64/libxml2.so.2.9.1)
      ==25735==    by 0x4D0C767: virNodeDeviceDefParseNode (node_device_conf.c:997)
      ==25735==    by 0x4D0D3D2: virNodeDeviceDefParse (node_device_conf.c:1337)
      ==25735==    by 0x401CA4: testCompareXMLToXMLHelper (nodedevxml2xmltest.c:28)
      ==25735==    by 0x402B2F: virtTestRun (testutils.c:158)
      ==25735==    by 0x401B27: mymain (nodedevxml2xmltest.c:81)
      ==25735==    by 0x40316A: virtTestMain (testutils.c:722)
      ==25735==    by 0x37C1021A04: (below main) (libc-start.c:225)
      ==25735==
      ==25735== 16 bytes in 1 blocks are definitely lost in loss record 10 of 24
      ==25735==    at 0x4A08A6E: realloc (vg_replace_malloc.c:662)
      ==25735==    by 0x4C7385E: virReallocN (viralloc.c:184)
      ==25735==    by 0x4C73906: virExpandN (viralloc.c:214)
      ==25735==    by 0x4C73B4A: virInsertElementsN (viralloc.c:324)
      ==25735==    by 0x4D0C84C: virNodeDeviceDefParseNode (node_device_conf.c:1026)
      ==25735==    by 0x4D0D3D2: virNodeDeviceDefParse (node_device_conf.c:1337)
      ==25735==    by 0x401CA4: testCompareXMLToXMLHelper (nodedevxml2xmltest.c:28)
      ==25735==    by 0x402B2F: virtTestRun (testutils.c:158)
      ==25735==    by 0x401B27: mymain (nodedevxml2xmltest.c:81)
      ==25735==    by 0x40316A: virtTestMain (testutils.c:722)
      ==25735==    by 0x37C1021A04: (below main) (libc-start.c:225)
      ==25735==
      PASS: nodedevxml2xmltest
      
      The first error was resolved by adding a missing VIR_FREE(numberStr); in
      the new function virNodeDevCapPciDevIommuGroupParseXML().
      
      The second error was a bit more opaque as the error was a result of copying
      the free methodolgy of the existing code in virNodeDevCapsDefFree(). The code
      would free each of the entries in the array, but not the memory for the
      array itself.  Added the necessary VIR_FREE(data->pci_dev.iommuGroupDevices)
      and while at it added the missing VIR_FREE(data->pci_dev.virtual_functions)
      although there wasn't a test that tripped across it (thus it's been lurking
      since commit id 'a010165d').
      79e9a224
    • J
      Resolve valgrind error in remoteConfigGetStringList() · ba6e187f
      John Ferlan 提交于
      Commit id 'ed3bac71' introduced the following:
      
      TEST: libvirtdconftest
            ........................................ 40  OK
      ==25875== 690 (480 direct, 210 indirect) bytes in 30 blocks are definitely lost in loss record 18 of 24
      ==25875==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
      ==25875==    by 0x4C737DF: virAllocN (viralloc.c:152)
      ==25875==    by 0x403BC8: remoteConfigGetStringList (libvirtd-config.c:74)
      ==25875==    by 0x4042CF: daemonConfigLoadOptions (libvirtd-config.c:382)
      ==25875==    by 0x4052F5: daemonConfigLoadData (libvirtd-config.c:479)
      ==25875==    by 0x40222C: testCorrupt (libvirtdconftest.c:112)
      ==25875==    by 0x40321F: virtTestRun (testutils.c:158)
      ==25875==    by 0x401FEE: mymain (libvirtdconftest.c:228)
      ==25875==    by 0x40385A: virtTestMain (testutils.c:722)
      ==25875==    by 0x37C1021A04: (below main) (libc-start.c:225)
      ==25875==
      PASS: libvirtdconftest
      ba6e187f
    • J
      Resolve valgrind error in virStorageBackendCreateQemuImgCmd() · 164d46e8
      John Ferlan 提交于
      Commit id '53d5967c' introduced the following:
      
      TEST: storagevolxml2argvtest
            ..............                           14  OK
      ==25636== 358 (264 direct, 94 indirect) bytes in 1 blocks are definitely lost in loss record 67 of 75
      ==25636==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
      ==25636==    by 0x4C95791: virAlloc (viralloc.c:124)
      ==25636==    by 0x4CA0BB4: virCommandNewArgs (vircommand.c:805)
      ==25636==    by 0x4CA0C88: virCommandNew (vircommand.c:789)
      ==25636==    by 0x408602: virStorageBackendCreateQemuImgCmd (storage_backend.c:849)
      ==25636==    by 0x405427: testCompareXMLToArgvHelper (storagevolxml2argvtest.c:61)
      ==25636==    by 0x4064DF: virtTestRun (testutils.c:158)
      ==25636==    by 0x40516F: mymain (storagevolxml2argvtest.c:195)
      ==25636==    by 0x406B1A: virtTestMain (testutils.c:722)
      ==25636==    by 0x37C1021A04: (below main) (libc-start.c:225)
      ==25636==
      PASS: storagevolxml2argvtest
      164d46e8
    • J
      Resolve valgrind error in virNetDevVlanParse() · babb57aa
      John Ferlan 提交于
      Commit '861d4056' introduced the following:
      
      TEST: networkxml2xmltest
            ..................                       18  OK
      ==25504== 7 bytes in 1 blocks are definitely lost in loss record 5 of 23
      ==25504==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==25504==    by 0x37C1085D71: strdup (strdup.c:42)
      ==25504==    by 0x4CB835F: virStrdup (virstring.c:546)
      ==25504==    by 0x4CC5179: virXPathString (virxml.c:90)
      ==25504==    by 0x4CC75C2: virNetDevVlanParse (netdev_vlan_conf.c:78)
      ==25504==    by 0x4CF928A: virNetworkPortGroupParseXML (network_conf.c:1555)
      ==25504==    by 0x4CFE385: virNetworkDefParseXML (network_conf.c:2049)
      ==25504==    by 0x4D0113B: virNetworkDefParseNode (network_conf.c:2273)
      ==25504==    by 0x4D01254: virNetworkDefParse (network_conf.c:2234)
      ==25504==    by 0x401E80: testCompareXMLToXMLHelper (networkxml2xmltest.c:32)
      ==25504==    by 0x402D4F: virtTestRun (testutils.c:158)
      ==25504==    by 0x401CE9: mymain (networkxml2xmltest.c:110)
      ==25504==
      PASS: networkxml2xmltest
      
      Also changed the label from error to cleanup and adjusted code since it's
      all one exit path
      babb57aa
    • P
      doc: Fix reference to #elementsUSB · dc8614d7
      Philipp Hahn 提交于
      aae0fc2a removed the #elementsUSB anchor
      but did not update the links to point to the new section #elementsHostDev.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      dc8614d7
  12. 28 6月, 2013 2 次提交