1. 09 5月, 2017 1 次提交
  2. 04 5月, 2017 4 次提交
    • M
      virPerfEventIsEnabled: Accept NULL @perf · 033369c7
      Michal Privoznik 提交于
      After bdcf6e48 there is a crasher in libvirt. The commit assumes
      that priv->perf is always set. That is not true. For inactive
      domains, the priv->perf is not allocated as it is set in
      qemuProcessLaunch(). Now, usually we differentiate between
      accesses to inactive and active definition and it works just
      fine. Except for 'domstats'. There priv->perf is accessed without
      prior check for domain inactivity. While we could check for that,
      more robust solution is to make virPerfEventIsEnabled() accept
      NULL.
      
      How to reproduce:
      1) ensure you have at least one inactive domain
      2) virsh domstats
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      033369c7
    • E
      mdev: Fix mingw build by adding a check for non-NULL pointer · 574718d3
      Erik Skultety 提交于
      This patch fixes the following MinGW error (although actually being a
      false positive):
      
      ../../src/util/virmdev.c: In function 'virMediatedDeviceListMarkDevices':
      ../../src/util/virmdev.c:453:21: error: potential null pointer
      dereference [-Werror=null-dereference]
                const char *mdev_path = mdev->path;
                            ^~~~~~~~~
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      574718d3
    • E
      mdev: Fix daemon crash on domain shutdown after reconnect · 92e30a4d
      Erik Skultety 提交于
      The problem resides in virHostdevUpdateActiveMediatedDevices which gets
      called during qemuProcessReconnect. The issue here is that
      virMediatedDeviceListAdd takes a pointer to the item to be added to the
      list to which VIR_APPEND_ELEMENT is used, which also clears the pointer.
      However, in this case only the local copy of the pointer got cleared,
      leaving the original pointing to valid memory. To sum it up, during
      cleanup phase, the original pointer is freed and the daemon crashes
      basically any time it would access it.
      
      Backtrace:
      0x00007ffff3ccdeba in __strcmp_sse2_unaligned
      0x00007ffff72a444a in virMediatedDeviceListFindIndex
      0x00007ffff7241446 in virHostdevReAttachMediatedDevices
      0x00007fffc60215d9 in qemuHostdevReAttachMediatedDevices
      0x00007fffc60216dc in qemuHostdevReAttachDomainDevices
      0x00007fffc6046e6f in qemuProcessStop
      0x00007fffc6091596 in processMonitorEOFEvent
      0x00007fffc6091793 in qemuProcessEventHandler
      0x00007ffff7294bf5 in virThreadPoolWorker
      0x00007ffff7294184 in virThreadHelper
      0x00007ffff3fdc3c4 in start_thread () from /lib64/libpthread.so.0
      0x00007ffff3d269cf in clone () from /lib64/libc.so.6
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1446455Signed-off-by: NErik Skultety <eskultet@redhat.com>
      Reviewed-by: NLaine Stump <laine@laine.org>
      92e30a4d
    • E
      util: mdev: Use a local variable instead of a direct pointer access · 2739a983
      Erik Skultety 提交于
      Use a local variable to hold data, rather than accessing the pointer
      after calling virMediatedDeviceListAdd (therefore VIR_APPEND_ELEMENT).
      Although not causing an issue at the moment, this change is a necessary
      prerequisite for tweaking virMediatedDeviceListAdd in a separate patch,
      which will take a reference for the source pointer (instead of pointer
      value) and will clear it along the way.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      Reviewed-by: NLaine Stump <laine@laine.org>
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      2739a983
  3. 03 5月, 2017 1 次提交
    • D
      Fix padding of encrypted data · 71890992
      Daniel P. Berrange 提交于
      If we are encoding a block of data that is 16 bytes in length,
      we cannot leave it as 16 bytes, we must pad it out to the next
      block boundary, 32 bytes. Without this padding, the decoder will
      incorrectly treat the last byte of plain text as the padding
      length, as it can't distinguish padded from non-padded data.
      
      The problem exhibited itself when using a 16 byte passphrase
      for a LUKS volume
      
        $ virsh secret-set-value 55806c7d-8e93-456f-829b-607d8c198367 \
             $(echo -n 1234567812345678 | base64)
        Secret value set
      
        $ virsh start demo
        error: Failed to start domain demo
        error: internal error: process exited while connecting to monitor: >>>>>>>>>>Len 16
        2017-05-02T10:35:40.016390Z qemu-system-x86_64: -object \
          secret,id=virtio-disk1-luks-secret0,data=SEtNi5vDUeyseMKHwc1c1Q==,\
          keyid=masterKey0,iv=zm7apUB1A6dPcH53VW960Q==,format=base64: \
          Incorrect number of padding bytes (56) found on decrypted data
      
      Notice how the padding '56' corresponds to the ordinal value of
      the character '8'.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      71890992
  4. 28 4月, 2017 6 次提交
  5. 27 4月, 2017 3 次提交
  6. 26 4月, 2017 1 次提交
    • D
      util: switch over to use keycodemapdb GIT submodule · 02fb15fb
      Daniel P. Berrange 提交于
      A long time ago we imported the keymaps.csv file from GTK-VNC so we
      can do conversions between keycode sets. Meanwhile lots of bug fixes
      have gone into this CSV file and libvirt hasn't kept in sync. The
      keymaps.csv file and associated generator script has been pulled out
      of GTK-VNC into a dedicated GIT repo for use as a submodule. This
      allows GTK-VNC, SPICE-GTK, QEMU and libvirt to share the same master
      database and tools and pushing updates merely requires a submodule
      commit update as with gnulib.
      
      The test suite is updated to cover some extra boundary conditions.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      02fb15fb
  7. 24 4月, 2017 1 次提交
    • R
      util: relax virNetDevSetCoalesce() stub · 5e010605
      Roman Bogorodskiy 提交于
      Currently, virNetDevSetCoalesce() stub is always returning error. As
      it's used by virNetDevTapCreateInBridgePort(), it essentially breaks
      bridged networking if coalesce is not supported.
      
      To make it work, relax the stub to trigger error only when its
      coalesce argument is not NULL, otherwise report success.
      5e010605
  8. 21 4月, 2017 5 次提交
    • L
      util: allow ignoring SIOCSIFHWADDR when errno is EPERM · 997134fb
      Laine Stump 提交于
      Commit f4ef3a71 made a variation of virNetDevSetMAC that would return
      without logging an error message if errno was set to
      EADDRNOTAVAIL. This errno is set by some SRIOV VF drivers (in
      particular igbvf) when they fail to set the device's MAC address due
      to the PF driver refusing the request. This is useful if we want to
      try a different method of setting the VF MAC address before giving up
      (Commit 86556e16 actually does this, setting the desired MAC address
      to the "admin MAC in the PF, then detaching and reattaching the VF
      netdev driver to force a reinit of the MAC address).
      
      During testing of Bug 1442040 t was discovered that the ixgbe driver
      returns EPERM in this situation, so this patch changes the exception
      case for silent+non-terminal failure to account for this difference.
      
      Completes resolution to: https://bugzilla.redhat.com/1415609 (RHEL 7.4)
                               https://bugzilla.redhat.com/1442040 (RHEL 7.3.z)
      997134fb
    • D
      util: fix virNetDevSetCoalesce fallback on Win32/FreeBSD · e6625ed4
      Daniel P. Berrange 提交于
      The current fallback stub for virNetDevSetCoalesce is inside an
      earlier conditional block. This deals with the feature being
      missing on older Linux platforms. We need a second fallback stub
      though, outside the top level conditional, to ensure builds work
      on Win32/FreeBSD platforms too.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e6625ed4
    • M
      Set coalesce settings for domain interfaces · fcef4472
      Martin Kletzander 提交于
      This patch makes use of the virNetDevSetCoalesce() function to make
      appropriate settings effective for devices that support them.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1414627Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      fcef4472
    • M
      util: Add virNetDevSetCoalesce function · 652ef9bc
      Martin Kletzander 提交于
      That function is able to configure coalesce settings for an interface,
      similarly to 'ethtool -C'.  This function also updates back the
      structure so that it contains actual data on the device (if the device
      doesn't support some settings kernel might just return 0 and not set
      whatever is not supported), so this way we'll have up-to-date
      information in the live domain XML.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      652ef9bc
    • P
      util: check ifa_addr pointer before accessing its elements · 42000bf7
      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>
      42000bf7
  9. 19 4月, 2017 1 次提交
    • D
      annotate all mocked functions with noinline · 728cacc8
      Daniel P. Berrange 提交于
      CLang's optimizer is more aggressive at inlining functions than
      gcc and so will often inline functions that our tests want to
      mock-override. This causes the test to fail in bizarre ways.
      
      We don't want to disable inlining completely, but we must at
      least prevent inlining of mocked functions. Fortunately there
      is a 'noinline' attribute that lets us control this per function.
      
      A syntax check rule is added that parses tests/*mock.c to extract
      the list of functions that are mocked (restricted to names starting
      with 'vir' prefix). It then checks that src/*.h header file to
      ensure it has a 'ATTRIBUTE_NOINLINE' annotation. This should prevent
      use from bit-rotting in future.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      728cacc8
  10. 14 4月, 2017 2 次提交
    • S
      pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link speed · 8e09663f
      Shivaprasad G Bhat 提交于
      Without this added enum value, nodedev-dumpxml of a GEN4 (PCIe 4.0)
      card will fail (due to the unrecognized link speed), and since
      nodedev-detach and nodedev-reattach internally do a dumpxml+parse,
      they will also fail. With this patch, all those operations succeed.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      8e09663f
    • W
      virConfSaveValue: protect against a NULL pointer reference · ae5d7582
      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>
      ae5d7582
  11. 13 4月, 2017 2 次提交
    • W
      util: Fix resource leak · 123770cd
      Wang King 提交于
      The virRotatingFileWriterAppend method leaks the file->entry
      on the virRotatingFileWriterEntryNew failing path.
      123770cd
    • J
      util: add missing equal sign in initialization · b80b0c45
      Ján Tomko 提交于
      Fix the build with clang:
      util/virperf.c:86:27: error: use of GNU 'missing =' extension
          in designator [-Werror,-Wgnu-designator]
          [VIR_PERF_EVENT_MBML] {
                                ^
                                =
      b80b0c45
  12. 12 4月, 2017 3 次提交
  13. 11 4月, 2017 1 次提交
  14. 07 4月, 2017 2 次提交
  15. 05 4月, 2017 2 次提交
  16. 04 4月, 2017 3 次提交
    • J
      util: ignore -Wcast-align in virNetlinkDumpCommand · 04be4111
      Ján Tomko 提交于
      Similar to commit b202c39a ignore the warning that breaks the build
      with clang:
      util/virnetlink.c:365:52: error: cast from 'char *' to 'struct nlmsghdr *'
       increases required alignment from 1 to 4 [-Werror,-Wcast-align]
              for (msg = resp; NLMSG_OK(msg, len); msg = NLMSG_NEXT(msg, len)) {
                                                         ^~~~~~~~~~~~~~~~~~~~
      /usr/include/linux/netlink.h:87:7: note: expanded from macro 'NLMSG_NEXT'
               (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      04be4111
    • J
      storage: Fix capacity value for LUKS encrypted volumes · b7d44f45
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1371892
      
      The 'capacity' value (e.g. guest logical size) for a LUKS volume is
      smaller than the 'physical' value of the file in the file system, so
      we need to account for that.
      
      When peeking at the encryption information about the volume add a fetch
      of the payload_offset which is described as the offset to the start of
      the volume data (in 512 byte sectors) in QEMU's QCryptoBlockLUKSHeader.
      
      Then adjust the ->capacity appropriately when we determine that the
      volume target encryption has a payload_offset value.
      b7d44f45
    • C
      virNetDevIPCheckIPv6ForwardingCallback fixes · b202c39a
      Cédric Bosdonnat 提交于
      Add check for more than one RTA_OIF, even though this is rather
      unlikely.
      
      Get rid of the buggy switch / break as this code won't need to
      handle more attributes.
      
      Use VIR_WARNINGS_NO_CAST_ALIGN to fix impossible to fix
      util/virnetdevip.c:560:17: error: cast increases required alignment of target type [-Werror=cast-align]
      b202c39a
  17. 31 3月, 2017 1 次提交
  18. 28 3月, 2017 1 次提交