1. 11 5月, 2017 40 次提交
    • P
      util: check ifa_addr pointer before accessing its elements · 2679eeea
      Pavel Hrdina 提交于
      Reported by Rafał Wojciechowski <it@rafalwojciechowski.pl>.
      
      Thread 1 (Thread 0x7f194b99d700 (LWP 5631)):
      0  virNetDevGetifaddrsAddress (addr=0x7f194b99c7c0, ifname=0x7f193400e2b0 "ovirtmgmt") at util/virnetdevip.c:738
      1  virNetDevIPAddrGet (ifname=0x7f193400e2b0 "ovirtmgmt", addr=addr@entry=0x7f194b99c7c0) at util/virnetdevip.c:795
      2  0x00007f19467800d6 in networkGetNetworkAddress (netname=<optimized out>, netaddr=netaddr@entry=0x7f1924013f18) at network/bridge_driver.c:4780
      3  0x00007f193e43a33c in qemuProcessGraphicsSetupNetworkAddress (listenAddr=0x7f19340f7650 "127.0.0.1", glisten=0x7f1924013f10) at qemu/qemu_process.c:4062
      4  qemuProcessGraphicsSetupListen (vm=<optimized out>, graphics=0x7f1924014f10, cfg=0x7f1934119f00) at qemu/qemu_process.c:4133
      5  qemuProcessSetupGraphics (flags=17, vm=0x7f19240155d0, driver=0x7f193411f1d0) at qemu/qemu_process.c:4196
      6  qemuProcessPrepareDomain (conn=conn@entry=0x7f192c00ab50, driver=driver@entry=0x7f193411f1d0, vm=vm@entry=0x7f19240155d0, flags=flags@entry=17) at qemu/qemu_process.c:4969
      7  0x00007f193e4417c0 in qemuProcessStart (conn=conn@entry=0x7f192c00ab50, driver=driver@entry=0x7f193411f1d0, vm=0x7f19240155d0,asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_START, migrateFrom=migrateFrom@entry=0x0, migrateFd=migrateFd@entry=-1, migratePath=migratePath@entry=0x0,snapshot=snapshot@entry=0x0, vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=17, flags@entry=1) at qemu/qemu_process.c:5553
      
      Man page for getifaddrs also states that the "ifa_addr" may contain
      a null pointer which happens if there is an existing network interface
      on the host without IP address.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit 42000bf7)
      2679eeea
    • J
      Increase default task limit for libvirtd · be3051bf
      Jim Fehlig 提交于
      libvirtd can spawn threads/tasks when creating new domains for
      some hypervisors such as Xen's libxl driver, quickly reaching
      the cgroups pids controller default TasksMax setting of 512. When
      the limit is reached, attempting to create additional domains
      results in an error from the cgroups pids controller, e.g.
      
      kernel: [71282.213347] cgroup: fork rejected by pids controller in
      /system.slice/libvirtd.service
      
      Depending on domain type and configuration, anywhere from 4-7
      threads/tasks may be created by libxl when starting a domain.
      In order to support 4096 domains, similar to commit 27cd7635,
      increase the TasksMax setting in libvirtd.service to
      4096 * 8 = 32768 tasks.
      
      (cherry picked from commit 6b3fb86b)
      be3051bf
    • D
      Fix error reporting when poll returns POLLHUP/POLLERR · de609c01
      Daniel P. Berrange 提交于
      In the RPC client event loop code, if poll() returns only a POLLHUP
      or POLLERR status, then we end up reporting a bogus error message:
      
        error: failed to connect to the hypervisor
        error: An error occurred, but the cause is unknown
      
      We do actually report an error, but we virNetClientMarkClose method
      has already captured the error status before we report it, so the
      real error gets thrown away. The key fix is to report the error
      before calling virNetClientMarkClose(). In changing this, we also
      split out reporting of POLLHUP vs POLLERR to make any future bugs
      easier to diagnose.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 234ac4e1)
      de609c01
    • J
      spec: Avoid RPM verification errors on nwfilter XMLs · 6611f380
      Jiri Denemark 提交于
      /etc/libvirt/nwfilter/*.xml files are installed with no UUID, which
      means libvirtd will automatically alter all of them once it starts. Thus
      RPM verification will always fail on them. Let's use a trick similar to
      the default network XML and store nwfilter XMLs in /usr/share. They will
      be copied into /etc in %post. Additionally the /etc files are marked as
      %ghost so that they are uninstalled if the RPM package is removed.
      
      Note that the %post script overwrites existing files with new ones on
      upgrade, which is what has always been happening.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1431581
      https://bugzilla.redhat.com/show_bug.cgi?id=1378774Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      (cherry picked from commit 1d3963db)
      6611f380
    • J
      xenconfig: avoid double free on OOM testing · 79e09184
      Jim Fehlig 提交于
      Fix xlconfig channel tests when OOM testing is enabled.
      
      TEST: xlconfigtest
      32) Xen XL-2-XML Format channel-unix                                  ... OK
          Test OOM for nalloc=55 ................................................*** Error in `/home/jfehlig/virt/upstream/libvirt/tests/.libs/xlconfigtest': double free or corruption (fasttop): 0x0000000000679550 ***
      ...
      (gdb) bt
      #0  0x00007ffff36875af in raise () from /lib64/libc.so.6
      #1  0x00007ffff36889aa in abort () from /lib64/libc.so.6
      #2  0x00007ffff36c5150 in __libc_message () from /lib64/libc.so.6
      #3  0x00007ffff36cb4f6 in malloc_printerr () from /lib64/libc.so.6
      #4  0x00007ffff36cbcee in _int_free () from /lib64/libc.so.6
      #5  0x00007ffff782babf in virFree (ptrptr=0x7fffffffdca8) at util/viralloc.c:582
      #6  0x000000000042f2f3 in xenParseXLChannel (conf=0x677350, def=0x6815b0) at xenconfig/xen_xl.c:788
      #7  0x000000000042f44e in xenParseXL (conf=0x677350, caps=0x6832b0, xmlopt=0x67f6e0) at xenconfig/xen_xl.c:828
      #8  0x00000000004105a3 in testCompareFormatXML (
          xlcfg=0x6811e0 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.cfg",
          xml=0x681110 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.xml", replaceVars=false)
          at xlconfigtest.c:152
      
      When a channel is successfully parsed and its path and name fields
      assigned from local variables, set the local variables to NULL to
      prevent a double free on error.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      (cherry picked from commit b2c12f57)
      79e09184
    • W
      xenFormatXLDomainDisks: avoid double free on OOM testing · 48158a8b
      Wim ten Have 提交于
      Fix xlconfigtest runs build for --enable-test-oom on
              Xen XL-2-XML Parse  new-disk
      
          #0  0x00007ffff3bd791f in raise () from /lib64/libc.so.6
          #1  0x00007ffff3bd951a in abort () from /lib64/libc.so.6
          #2  0x00007ffff3c1b200 in __libc_message () from /lib64/libc.so.6
          #3  0x00007ffff3c2488a in _int_free () from /lib64/libc.so.6
          #4  0x00007ffff3c282bc in free () from /lib64/libc.so.6
          #5  0x00007ffff7864fcb in virFree (ptrptr=ptrptr@entry=0x7fffffffd868) at util/viralloc.c:582
          #6  0x00007ffff78776e5 in virConfFreeValue (val=<optimized out>) at util/virconf.c:178
      ==> #7  0x0000000000425759 in xenFormatXLDomainDisks (def=0x7fffffffd8c0, def=0x7fffffffd8c0, conf=0x658220)
              at xenconfig/xen_xl.c:1159
          #8  xenFormatXL (def=def@entry=0x66ec20, conn=conn@entry=0x668cf0) at xenconfig/xen_xl.c:1558
          #9  0x000000000040ea1d in testCompareParseXML (replaceVars=<optimized out>,
              xml=0x65f5e0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.xml",
              xlcfg=0x65f6b0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.cfg")
              at xlconfigtest.c:105
          #10 testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
          #11 0x000000000041079a in virTestRun (title=title@entry=0x431cf0 "Xen XL-2-XML Parse  fullvirt-ovmf",
              body=body@entry=0x40e720 <testCompareHelper>, data=data@entry=0x7fffffffda50) at testutils.c:247
          #12 0x000000000040ebc2 in mymain () at xlconfigtest.c:256
          #13 0x0000000000411070 in virTestMain (argc=1, argv=0x7fffffffdc08, func=0x40f2c0 <mymain>) at testutils.c:992
          #14 0x00007ffff3bc2401 in __libc_start_main () from /lib64/libc.so.6
          #15 0x000000000040e5da in _start ()
      
      symmetry seems missing its sibbling coded functionality
      demonstrated under functions;
              xenFormatXLUSBController()
              xenFormatXLUSB()
              xenFormatXLDomainChannels()
              xenFormatXMDisks
      Signed-off-by: NWim ten Have <wim.ten.have@oracle.com>
      (cherry picked from commit 2c1a31a3)
      48158a8b
    • W
      virConfSaveValue: protect against a NULL pointer reference · 9a2ed8c0
      Wim ten Have 提交于
      Fix xlconfigtest runs build for --enable-test-oom on
              Xen XL-2-XML Parse  channel-pty
      
      Program received signal SIGSEGV, Segmentation fault.
      
          #0  0x00007ffff3c2b373 in __strchr_sse2 () from /lib64/libc.so.6
      ==> #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
          #2  0x00007ffff7875668 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=<optimized out>) at util/virconf.c:306
          #3  0x00007ffff78757ef in virConfSaveEntry (buf=buf@entry=0x7fffffffd8a0, cur=cur@entry=0x674780) at util/virconf.c:338
          #4  0x00007ffff78783eb in virConfWriteMem (memory=0x665570 "", len=len@entry=0x7fffffffd910, conf=conf@entry=0x65b940)
              at util/virconf.c:1543
          #5  0x000000000040eccb in testCompareParseXML (replaceVars=<optimized out>, xml=<optimized out>,
              xlcfg=0x662c00 "/home/wtenhave/WORK/libvirt/OOMtesting/libvirt-devel/tests/xlconfigdata/test-channel-pty.cfg")
              at xlconfigtest.c:108
          #6  testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
          #7  0x0000000000410b3a in virTestRun (title=title@entry=0x432cc0 "Xen XL-2-XML Parse  channel-pty",
              body=body@entry=0x40e9b0 <testCompareHelper>, data=data@entry=0x7fffffffd9f0) at testutils.c:247
          #8  0x000000000040f322 in mymain () at xlconfigtest.c:278
          #9  0x0000000000411410 in virTestMain (argc=1, argv=0x7fffffffdba8, func=0x40f660 <mymain>) at testutils.c:992
          #10 0x00007ffff3bc0401 in __libc_start_main () from /lib64/libc.so.6
          #11 0x000000000040e86a in _start ()
      
          (gdb) frame 1
          #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
          290                 if (strchr(val->str, '\n') != NULL) {
          (gdb) print *val
          $1 = {type = VIR_CONF_STRING, next = 0x0, l = 0, str = 0x0, list = 0x0}
      Signed-off-by: NWim ten Have <wim.ten.have@oracle.com>
      (cherry picked from commit ae5d7582)
      9a2ed8c0
    • J
      conf: Add check for non scsi_host parent during vport delete · 5040c8da
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1420740
      
      If the parent is not a scsi_host, then we can just happily return since
      we won't be removing a vport.
      
      Fixes a bug with the following output:
      
      $ virsh pool-destroy host4_hba_pool
      error: Failed to destroy pool host4_hba_pool
      error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool
      
      $
      
      (cherry picked from commit 84f178bd)
      5040c8da
    • W
      util: Fix resource leak · 268c7e08
      Wang King 提交于
      The virRotatingFileWriterAppend method leaks the file->entry
      on the virRotatingFileWriterEntryNew failing path.
      
      (cherry picked from commit 123770cd)
      268c7e08
    • W
      test: Remove unused variate @maxcpu in testDomainGetVcpus · 0c20c909
      Wang King 提交于
      Since refactoring by commit id '3dd859c0', @maxcpu is no longer used.
      
      (cherry picked from commit b2641b43)
      0c20c909
    • W
      esx: Fix memory leak · 3e790949
      Wang King 提交于
      Variable def going out of scope leaks the storage def.source.hosts points to.
      
      (cherry picked from commit d76267b2)
      3e790949
    • W
      esx: Fix incorrect memory compare size in esxStoragePoolLookupByUUID · e0af3fd5
      Wang King 提交于
      Use MD5_DIGEST_SIZE or VIR_UUID_BUFLEN rather than VIR_UUID_STRING_BUFLEN
      when compare @uuid with @md5.
      
      (cherry picked from commit 77cc51a4)
      e0af3fd5
    • P
      qemu: snapshot: Skip empty drives with internal snapshots · 2c593526
      Peter Krempa 提交于
      The code that validates whether an internal snapshot is possible would
      reject an empty but not-readonly drive. Since floppies can have this
      property, add a check for emptiness.
      
      (cherry picked from commit eee3b4b9)
      2c593526
    • J
      qemu: do not crash on USB address with no port and invalid bus · e62d61e7
      Ján Tomko 提交于
      Properly error out when the user requests a port from a bus
      that does not have a controller present in the domain XML.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1441589
      (cherry picked from commit b003b978)
      e62d61e7
    • M
      man: Align vol-resize arguments with the output of help · 670102c0
      Martin Kletzander 提交于
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit c3d1df7b)
      670102c0
    • P
      qemu: conf: Don't leak snapshot image format conf variable · c4d7361f
      Peter Krempa 提交于
      ==20406== 4 bytes in 1 blocks are definitely lost in loss record 6 of 1,059
      ==20406==    at 0x4C2AF3F: malloc (vg_replace_malloc.c:299)
      ==20406==    by 0x8F17D39: strdup (in /lib64/libc-2.24.so)
      ==20406==    by 0x552C0E0: virStrdup (virstring.c:784)
      ==20406==    by 0x54D3622: virConfGetValueString (virconf.c:945)
      ==20406==    by 0x144E4692: virQEMUDriverConfigLoadFile (qemu_conf.c:687)
      ==20406==    by 0x1452A744: qemuStateInitialize (qemu_driver.c:664)
      ==20406==    by 0x55DB585: virStateInitialize (libvirt.c:770)
      ==20406==    by 0x124570: daemonRunStateInit (libvirtd.c:881)
      ==20406==    by 0x5532990: virThreadHelper (virthread.c:206)
      ==20406==    by 0x8C82493: start_thread (in /lib64/libpthread-2.24.so)
      ==20406==    by 0x8F7FA1E: clone (in /lib64/libc-2.24.so)
      
      (cherry picked from commit 2ef3aa8f)
      c4d7361f
    • E
      qemu: Fix mdev checking for VFIO support · 1cf9493e
      Erik Skultety 提交于
      Commit a4a39d90 added a check that checks for VFIO support with mediated
      devices. The problem is that the hostdev preparing functions behave like
      a fallthrough if device of that specific type doesn't exist. However,
      the check for VFIO support was independent of the existence of a mdev
      device which caused the guest to fail to start with any device to be
      directly assigned if VFIO was disabled/unavailable in the kernel.
      The proposed change first ensures that it makes sense to check for VFIO
      support in the first place, and only then performs the VFIO support check
      itself.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441291Signed-off-by: NErik Skultety <eskultet@redhat.com>
      (cherry picked from commit b4c2ac8d)
      1cf9493e
    • W
      util: systemd: Don't strlen a possibly NULL string · 679aa190
      Wang King 提交于
      Coverity complains about virBufferCurrentContent might be return null
      when calling strlen, so check virBufferError first before calling
      strlen.
      
      (cherry picked from commit c5ca209f)
      679aa190
    • W
      interface: Fix resource leak in netcfConnectListAllInterfaces error path · a7aacb74
      Wang King 提交于
      On virGetInterface failure, call virInterfaceDefFree for the @def.
      
      (cherry picked from commit 1b1b0459)
      a7aacb74
    • W
      virsh: don't leak @cpumap in virshVcpuPinQuery · dce5c95c
      Wang King 提交于
      ==18591== 16 bytes in 1 blocks are definitely lost in loss record 41 of 183
      ==18591==    at 0x4C2B934: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==18591==    by 0x54EBB1C: virAllocN (viralloc.c:191)
      ==18591==    by 0x1628CA: _vshMalloc (vsh.c:136)
      ==18591==    by 0x1344C4: virshVcpuPinQuery (virsh-domain.c:6603)
      ==18591==    by 0x1344C4: cmdVcpuPin (virsh-domain.c:6707)
      ==18591==    by 0x1631BF: vshCommandRun (vsh.c:1312)
      ==18591==    by 0x12DBB1: main (virsh.c:961)
      
      (cherry picked from commit b1aa4613)
      dce5c95c
    • P
      tests: fix some resource leaks · 3cfd60b1
      Pavel Hrdina 提交于
      Found by running valgrind for these tests.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit 9005a64b)
      3cfd60b1
    • P
      rpc: fix resource leak · e675e874
      Pavel Hrdina 提交于
      Commit 252610f7 switched to use hash to store servers.
      Function virHashGetItems returns allocated array which needs
      to be freed also for successful path, not only if there is
      an error.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit ab0a461b)
      e675e874
    • P
      src: fix multiple resource leaks in loops · c714afcc
      Pavel Hrdina 提交于
      All of the variables are filled inside a loop and therefore
      needs to be also freed in every cycle.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit ffc810b7)
      c714afcc
    • P
      conf/domain_capabilities: fix resource leak · fdd08607
      Pavel Hrdina 提交于
      Commit 14319c81 introduced CPU host model in domain capabilities
      and the *hostmodel* variable is always filled by virCPUDefCopy()
      and needs to be freed.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit 87d97a9d)
      fdd08607
    • M
      qemu: Fix two use-after-free situations · 9a47afb1
      Marc Hartmayer 提交于
      There were multiple race conditions that could lead to segmentation
      faults. The first precondition for this is qemuProcessLaunch must fail
      sometime shortly after starting the new QEMU process. The second
      precondition for the segmentation faults is that the new QEMU process
      dies - or to be more precise the QEMU monitor has to be closed
      irregularly. If both happens during qemuProcessStart (starting a
      domain) there are race windows between the thread with the event
      loop (T1) and the thread that is starting the domain (T2).
      
      First segmentation fault scenario:
      If qemuProcessLaunch fails during qemuProcessStart the code branches
      to the 'stop' path where 'qemuMonitorSetDomainLog(priv->mon, NULL,
      NULL, NULL)' will set the log function of the monitor to NULL (done in
      T2). In the meantime the event loop of T1 will wake up with an EOF
      event for the QEMU monitor because the QEMU process has died. The
      crash occurs if T1 has checked 'mon->logFunc != NULL' in qemuMonitorIO
      just before the logFunc was set to NULL by T2. If this situation
      occurs T1 will try to call mon->logFunc which leads to the
      segmentation fault.
      
      Solution:
      Require the monitor lock for setting the log function.
      
      Backtrace:
      0  0x0000000000000000 in ?? ()
      1  0x000003ffe9e45316 in qemuMonitorIO (watch=<optimized out>,
      fd=<optimized out>, events=<optimized out>, opaque=0x3ffe08aa860) at
      ../../src/qemu/qemu_monitor.c:727
      2  0x000003fffda2e1a4 in virEventPollDispatchHandles (nfds=<optimized
      out>, fds=0x2aa000fd980) at ../../src/util/vireventpoll.c:508
      3  0x000003fffda2e398 in virEventPollRunOnce () at
      ../../src/util/vireventpoll.c:657
      4  0x000003fffda2ca10 in virEventRunDefaultImpl () at
      ../../src/util/virevent.c:314
      5  0x000003fffdba9366 in virNetDaemonRun (dmn=0x2aa000cc550) at
      ../../src/rpc/virnetdaemon.c:818
      6  0x000002aa00024668 in main (argc=<optimized out>, argv=<optimized
      out>) at ../../daemon/libvirtd.c:1541
      
      Second segmentation fault scenario:
      If qemuProcessLaunch fails it will unref the log context and with
      invoking qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL)
      qemuDomainLogContextFree() will be invoked. qemuDomainLogContextFree()
      invokes virNetClientClose() to close the client and cleans everything
      up (including unref of _virLogManager.client) when virNetClientClose()
      returns. When T1 is now trying to report 'qemu unexpectedly closed the
      monitor' libvirtd will crash because the client has already been
      freed.
      
      Solution:
      As the critical section in qemuMonitorIO is protected with the monitor
      lock we can use the same solution as proposed for the first
      segmentation fault.
      
      Backtrace:
      0  virClassIsDerivedFrom (klass=0x3100979797979797,
      parent=0x2aa000d92f0) at ../../src/util/virobject.c:169
      1  0x000003fffda659e6 in virObjectIsClass (anyobj=<optimized out>,
      klass=<optimized out>) at ../../src/util/virobject.c:365
      2  0x000003fffda65a24 in virObjectLock (anyobj=0x3ffe08c1db0) at
      ../../src/util/virobject.c:317
      3  0x000003fffdba4688 in
      virNetClientIOEventLoop (client=client@entry=0x3ffe08c1db0,
      thiscall=thiscall@entry=0x2aa000fbfa0) at
      ../../src/rpc/virnetclient.c:1668
      4  0x000003fffdba4b4c in
      virNetClientIO (client=client@entry=0x3ffe08c1db0,
      thiscall=0x2aa000fbfa0) at ../../src/rpc/virnetclient.c:1944
      5  0x000003fffdba4d42 in
      virNetClientSendInternal (client=client@entry=0x3ffe08c1db0,
      msg=msg@entry=0x2aa000cc710, expectReply=expectReply@entry=true,
      nonBlock=nonBlock@entry=false) at ../../src/rpc/virnetclient.c:2116
      6  0x000003fffdba6268 in
      virNetClientSendWithReply (client=0x3ffe08c1db0, msg=0x2aa000cc710) at
      ../../src/rpc/virnetclient.c:2144
      7  0x000003fffdba6e8e in virNetClientProgramCall (prog=0x3ffe08c1120,
      client=<optimized out>, serial=<optimized out>, proc=<optimized out>,
      noutfds=<optimized out>, outfds=0x0, ninfds=0x0, infds=0x0,
      args_filter=0x3fffdb64440
      <xdr_virLogManagerProtocolDomainReadLogFileArgs>, args=0x3ffffffe010,
      ret_filter=0x3fffdb644c0
      <xdr_virLogManagerProtocolDomainReadLogFileRet>, ret=0x3ffffffe008) at
      ../../src/rpc/virnetclientprogram.c:329
      8  0x000003fffdb64042 in
      virLogManagerDomainReadLogFile (mgr=<optimized out>, path=<optimized
      out>, inode=<optimized out>, offset=<optimized out>, maxlen=<optimized
      out>, flags=0) at ../../src/logging/log_manager.c:272
      9  0x000003ffe9e0315c in qemuDomainLogContextRead (ctxt=0x3ffe08c2980,
      msg=0x3ffffffe1c0) at ../../src/qemu/qemu_domain.c:4422
      10 0x000003ffe9e280a8 in qemuProcessReadLog (logCtxt=<optimized out>,
      msg=msg@entry=0x3ffffffe288) at ../../src/qemu/qemu_process.c:1800
      11 0x000003ffe9e28206 in qemuProcessReportLogError (logCtxt=<optimized
      out>, msgprefix=0x3ffe9ec276a "qemu unexpectedly closed the monitor")
      at ../../src/qemu/qemu_process.c:1836
      12 0x000003ffe9e28306 in
      qemuProcessMonitorReportLogError (mon=mon@entry=0x3ffe085cf10,
      msg=<optimized out>, opaque=<optimized out>) at
      ../../src/qemu/qemu_process.c:1856
      13 0x000003ffe9e452b6 in qemuMonitorIO (watch=<optimized out>,
      fd=<optimized out>, events=<optimized out>, opaque=0x3ffe085cf10) at
      ../../src/qemu/qemu_monitor.c:726
      14 0x000003fffda2e1a4 in virEventPollDispatchHandles (nfds=<optimized
      out>, fds=0x2aa000fd980) at ../../src/util/vireventpoll.c:508
      15 0x000003fffda2e398 in virEventPollRunOnce () at
      ../../src/util/vireventpoll.c:657
      16 0x000003fffda2ca10 in virEventRunDefaultImpl () at
      ../../src/util/virevent.c:314
      17 0x000003fffdba9366 in virNetDaemonRun (dmn=0x2aa000cc550) at
      ../../src/rpc/virnetdaemon.c:818
      18 0x000002aa00024668 in main (argc=<optimized out>, argv=<optimized
      out>) at ../../daemon/libvirtd.c:1541
      
      Other code parts where the same problem was possible to occur are
      fixed as well (qemuMigrationFinish, qemuProcessStart, and
      qemuDomainSaveImageStartVM).
      Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
      Reported-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      (cherry picked from commit 20e95cb7)
      9a47afb1
    • J
      disk: Force usage of parted when checking disk format for "bsd" · a45034e1
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1439132
      
      Add "bsd" to the list of format types to not checked during blkid
      processing even though it supposedly knows the format - for some
      (now unknown) reason it's returning partition table not found. So
      let's just let PARTED handle "bsd" too.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      (cherry picked from commit 98f424d5)
      a45034e1
    • J
      disk: Resolve issues with disk partition build/start checks · facbb1f0
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1439132
      
      Commit id 'a48c674f' added a check for format types "dvh" and "pc98"
      to use the parted print processing instead of using blkid processing
      in order to validate the label on the disk was what is expected for
      disk pool startup. However, commit id 'a4cb4a74' really messed things
      up by missing an else condition causing PARTEDFindLabel to always
      return DIFFERENT.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      (cherry picked from commit f2a12320)
      facbb1f0
    • P
      conf: create new RemovalFailed event using correct class · e495bdef
      Pavel Hrdina 提交于
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit be193c4d)
      e495bdef
    • P
      qemu: fix memory leak and check mdevPath · 6f2b428f
      Pavel Hrdina 提交于
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      (cherry picked from commit d58c146a)
      6f2b428f
    • J
      qemu: Properly reset TLS in qemuProcessRecoverMigrationIn · bca95e75
      Jiri Denemark 提交于
      There is no async job running when a freshly started libvirtd is trying
      to recover from an interrupted incoming migration. While at it, let's
      call qemuMigrationResetTLS every time we don't kill the domain. This is
      not strictly necessary since TLS is not supported when v2 migration
      protocol is used, but doing so makes more sense.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      (cherry picked from commit 59b28eca)
      bca95e75
    • J
      Properly ignore files in build-aux directory · afb435d8
      Jiri Denemark 提交于
      We want to ignore all files except *.pl in build-aux directory, however
      the unignore pattern "!/build-aux/*.pl" doesn't have any effect because
      a previous "/build-aux/" pattern ignores the directory itself rather
      than individual files in it.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1439994Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      (cherry picked from commit f0ad8e7e)
      afb435d8
    • M
      conf: Fix possible memleak in capabilities · 0b6143eb
      Martin Kletzander 提交于
      If formatting NUMA topology fails, the function returns immediatelly,
      but the buffer structure allocated on the stack references lot of
      heap-allocated memory and that would get lost in such case.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 6369ee04)
      0b6143eb
    • J
      Split out -Wframe-larger-than warning from WARN_CLFAGS · b7980800
      Ján Tomko 提交于
      Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
      production code and RELAXED_FRAME_LIMIT_CFLAGS for tests.
      
      Raising the limit for tests allows building them with clang
      with optimizations disabled.
      
      (cherry picked from commit e73889b6)
      b7980800
    • M
      virISCSIGetSession: Don't leak memory · f59163c4
      Michal Privoznik 提交于
      This function runs an iscsi command and parses its output.
      However, due to the nature of things, virISCSIExtractSession()
      callback can be called multiple times. In each run it would
      allocate new memory and overwrite the variable where we keep
      pointer to it and thus leaking old allocations.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 9c037c6c)
      f59163c4
    • M
      virStorageSourceClear: Don't leave dangling pointers behind · 9e8d33ae
      Michal Privoznik 提交于
      Imagine that this function is called twice over the same disk
      source. While in the first run all allocated memory is freed, not
      all pointers are set to NULL (e.g. def->srcpool). So when called
      again, these poitners are freed again resulting in double free.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 349badbf)
      9e8d33ae
    • J
      qemu: Break endless loop if qemuMigrationResetTLS fails · 3feb8fb7
      Jiri Denemark 提交于
      Jumping to "endjob" label from a code after this label is not a very
      good idea.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      (cherry picked from commit d658c859)
      3feb8fb7
    • P
      storage: gluster: Implement 'checkPool' method so that state is restored · 605f21c5
      Peter Krempa 提交于
      After restart of libvirtd the 'checkPool' method is supposed to validate
      that the pool is online. Since libvirt then refreshes the pool contents
      anyways just return whether the pool was supposed to be online so that
      the code can be reached. This is necessary since if a pool does not
      implement the method it's automatically considered as inactive.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1436065
      (cherry picked from commit a200ebbc)
      605f21c5
    • P
      docs: Document limitation of maximum vcpu count used with <topology> · bf23f24b
      Peter Krempa 提交于
      qemu requires that the topology equals to the maximum vcpu count.
      Document this along with the API to set maximum vcpu count and the XML
      element.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426220
      (cherry picked from commit 4661a186)
      bf23f24b
    • J
      qemu: Fix resource leak in qemuDomainAddChardevTLSObjects error path · 30561956
      John Ferlan 提交于
      On any failure, call virJSONValueFree for the *Props.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      (cherry picked from commit 2e8c6095)
      30561956
    • J
      qemu: Initialize 'data' argument · 8eeeb765
      John Ferlan 提交于
      Initialize stack variable to {0}
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      (cherry picked from commit 83c58ea3)
      8eeeb765