1. 03 10月, 2013 2 次提交
    • S
      util: call socket_set_fast_reuse instead of setting SO_REUSEADDR · 04fd1c78
      Sebastian Ottlik 提交于
      SO_REUSEADDR should be avoided on Windows but is desired on other operating
      systems. So instead of setting it we call socket_set_fast_reuse that will result
      in the appropriate behaviour on all operating systems.
      Signed-off-by: NSebastian Ottlik <ottlik@fzi.de>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      04fd1c78
    • S
      util: add socket_set_fast_reuse function which will replace setting SO_REUSEADDR · 606600a1
      Sebastian Ottlik 提交于
      If a socket is closed it remains in TIME_WAIT state for some time. On operating
      systems using BSD sockets the endpoint of the socket may not be reused while in
      this state unless SO_REUSEADDR was set on the socket. On windows on the other
      hand the default behaviour is to allow reuse (i.e. identical to SO_REUSEADDR on
      other operating systems) and setting SO_REUSEADDR on a socket allows it to be
      bound to a endpoint even if the endpoint is already used by another socket
      independently of the other sockets state. This can even result in undefined
      behaviour.
      
      Many sockets used by QEMU should not block the use of their endpoint after being
      closed while they are still in TIME_WAIT state. Currently QEMU sets SO_REUSEADDR
      for such sockets, which can lead to problems on Windows. This patch introduces
      the function socket_set_fast_reuse that should be used instead of setting
      SO_REUSEADDR when fast socket reuse is desired and behaves correctly on all
      operating systems.
      
      As a failure of this function can only be caused by bad QEMU internal errors, an
      assertion handles these situations. The return value is still passed on, to
      minimize changes in client code and prevent unused variable warnings if NDEBUG
      is defined.
      Signed-off-by: NSebastian Ottlik <ottlik@fzi.de>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      606600a1
  2. 21 9月, 2013 1 次提交
  3. 18 9月, 2013 1 次提交
  4. 13 9月, 2013 1 次提交
  5. 10 9月, 2013 1 次提交
  6. 06 9月, 2013 1 次提交
  7. 30 8月, 2013 1 次提交
  8. 12 8月, 2013 1 次提交
    • M
      qemu-option: Guard against qemu_opts_set_defaults() misuse · cb77d192
      Markus Armbruster 提交于
      Commit 6d4cd408 fixed qemu_opts_set_defaults() for an existing corner
      case, but broke it for another one that can't be reached in current
      code.
      
      Quote from its commit message:
      
          I believe [opts_parse()] attempts to do the following:
      
              If options don't yet exist, create new options
              Else, if defaults, modify the existing options
              Else, if list->merge_lists, modify the existing options
              Else, fail
      
      The only caller that passes true for defaults is
      qemu_opts_set_defaults().
      
      The commit message then claims:
      
          A straightforward call of qemu_opts_create() does exactly that.
      
      Wrong.  When !list->merge_lists, and the option string doesn't contain
      id=, and options without ID exist, then we don't actually modify the
      existing options, we create new ones.
      
      Not reachable, because we never pass lists with !list->merge_lists to
      qemu_opts_set_defaults().
      
      Guard against possible (if unlikely) future misuse with assert().
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1375428840-5275-1-git-send-email-armbru@redhat.com
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      cb77d192
  9. 06 8月, 2013 2 次提交
  10. 30 7月, 2013 1 次提交
  11. 27 7月, 2013 2 次提交
  12. 11 7月, 2013 1 次提交
    • S
      add timestamp to error_report() · 5e2ac519
      Seiji Aguchi 提交于
      [Issue]
      When we offer a customer support service and a problem happens
      in a customer's system, we try to understand the problem by
      comparing what the customer reports with message logs of the
      customer's system.
      
      In this case, we often need to know when the problem happens.
      
      But, currently, there is no timestamp in qemu's error messages.
      Therefore, we may not be able to understand the problem based on
      error messages.
      
      [Solution]
      Add a timestamp to qemu's error message logged by
      error_report() with g_time_val_to_iso8601().
      Signed-off-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      5e2ac519
  13. 10 7月, 2013 2 次提交
    • M
      qemu-option: Fix qemu_opts_set_defaults() for corner cases · 6d4cd408
      Markus Armbruster 提交于
      Commit 4f6dd9af changed the initialization of opts in opts_parse() to
      this:
      
          if (defaults) {
              if (!id && !QTAILQ_EMPTY(&list->head)) {
                  opts = qemu_opts_find(list, NULL);
              } else {
                  opts = qemu_opts_create(list, id, 0);
              }
          } else {
              opts = qemu_opts_create(list, id, 1);
          }
      
      Same as before for !defaults.
      
      If defaults is true, and params has no ID, and options exist, we use
      the first assignment.  It sets opts to null if all options have an ID.
      opts_parse() then returns null.  qemu_opts_set_defaults() asserts the
      value is non-null.  It's the only caller that passes true for
      defaults.
      
      To reproduce, try "-M xenpv -machine id=foo" (yes, "id=foo" is silly,
      but it shouldn't crash).
      
      I believe the function attempts to do the following:
      
          If options don't yet exist, create new options
          Else, if defaults, modify the existing options
          Else, if list->merge_lists, modify the existing options
          Else, fail
      
      A straightforward call of qemu_opts_create() does exactly that.
      
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-id: 1372943363-24081-3-git-send-email-armbru@redhat.com
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      6d4cd408
    • M
      qemu-option: Fix qemu_opts_find() for null id arguments · 96bc97eb
      Markus Armbruster 提交于
      Crashes when the first list member has an ID.  Admittedly nonsensical
      reproducer:
      
      $ qemu-system-x86_64 -nodefaults -machine id=foo -machine ""
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1372943363-24081-2-git-send-email-armbru@redhat.com
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      96bc97eb
  14. 29 6月, 2013 4 次提交
  15. 28 6月, 2013 1 次提交
  16. 22 6月, 2013 1 次提交
    • M
      acl: acl_add can't insert before last list element, fix · 4999f3a8
      Markus Armbruster 提交于
      Watch this:
      
          $ upstream-qemu -nodefaults -S -vnc :0,acl,sasl -monitor stdio
          QEMU 1.5.50 monitor - type 'help' for more information
          (qemu) acl_add vnc.username drei allow
          acl: added rule at position 1
          (qemu) acl_show vnc.username
          policy: deny
          1: allow drei
          (qemu) acl_add vnc.username zwei allow 1
          acl: added rule at position 2
          (qemu) acl_show vnc.username
          policy: deny
          1: allow drei
          2: allow zwei
          (qemu) acl_add vnc.username eins allow 1
          acl: added rule at position 1
          (qemu) acl_show vnc.username
          policy: deny
          1: allow eins
          2: allow drei
          3: allow zwei
      
      The second acl_add inserts at position 2 instead of 1.
      
      Root cause is an off-by-one in qemu_acl_insert(): when index ==
      acl->nentries, it appends instead of inserting before the last list
      element.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      4999f3a8
  17. 20 6月, 2013 1 次提交
  18. 18 6月, 2013 1 次提交
  19. 17 6月, 2013 1 次提交
  20. 14 6月, 2013 1 次提交
    • M
      create qemu_openpty_raw() helper function and move it to a separate file · 4efeabbb
      Michael Tokarev 提交于
      In two places qemu uses openpty() which is very system-dependent,
      and in both places the pty is switched to raw mode as well.
      Make a wrapper function which does both steps, and move all the
      system-dependent complexity into a separate file, together
      with static/local implementations of openpty() and cfmakeraw()
      from qemu-char.c.
      
      It is in a separate file, not part of oslib-posix.c, because
      openpty() often resides in -lutil which is not linked to
      every program qemu builds.
      
      This change removes #including of <pty.h>, <termios.h>
      and other rather specific system headers out of qemu-common.h,
      which isn't a place for such specific headers really.
      
      This version has been verified to build correctly on Linux,
      OpenBSD, FreeBSD and OpenIndiana.  On the latter it lets qemu
      to be built with gtk gui which were not possible there due to
      missing openpty() and cfmakeraw().
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      Tested-by: NAndreas Färber <andreas.faerber@web.de>
      4efeabbb
  21. 06 6月, 2013 2 次提交
  22. 31 5月, 2013 1 次提交
  23. 20 5月, 2013 1 次提交
  24. 18 5月, 2013 1 次提交
  25. 14 5月, 2013 2 次提交
  26. 12 5月, 2013 1 次提交
  27. 03 5月, 2013 1 次提交
    • J
      qemu: add castagnoli crc32c checksum algorithm · 8e1b02b8
      Jeff Cody 提交于
      This adds the Castagnoli CRC32C algorithm, using the 0x11EDC6F41
      polynomial.
      
      This is extracted from the linux kernel cryptographic crc32.c module.
      
      The algorithm is based on:
      
      Castagnoli93: Guy Castagnoli and Stefan Braeuer and Martin Herrman
                   "Optimization of Cyclic Redundancy-Check Codes with 24
                    and 32 Parity Bits", IEEE Transactions on Communication,
                    Volume 41, Number 6, June 1993
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      8e1b02b8
  28. 29 4月, 2013 1 次提交
    • P
      win32: add readv/writev emulation · 9adea5f7
      Paolo Bonzini 提交于
      Commit e9d8fbf5 (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27)
      introduced a usage of writev, which mingw32 does not have.  Even though
      qemu_fdopen itself is not used on mingw32, the future-proof solution is
      to add an implementation of it.  This is simple and similar to how we
      emulate sendmsg/recvmsg in util/iov.c.
      
      Some files include osdep.h without qemu-common.h, so move the definition
      of iovec to osdep.h too, and include osdep.h from qemu-common.h
      unconditionally (protection against including files when NEED_CPU_H is
      defined is not needed since the removal of AREG0).
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9adea5f7
  29. 25 4月, 2013 1 次提交
  30. 24 4月, 2013 2 次提交