1. 17 6月, 2016 3 次提交
  2. 18 5月, 2016 1 次提交
  3. 15 4月, 2016 1 次提交
    • E
      nbd: Don't fail handshake on NBD_OPT_LIST descriptions · 200650d4
      Eric Blake 提交于
      The NBD Protocol states that NBD_REP_SERVER may set
      'length > sizeof(namelen) + namelen'; in which case the rest
      of the packet is a UTF-8 description of the export.  While we
      don't know of any NBD servers that send this description yet,
      we had better consume the data so we don't choke when we start
      to talk to such a server.
      
      Also, a (buggy/malicious) server that replies with length <
      sizeof(namelen) would cause us to block waiting for bytes that
      the server is not sending, and one that replies with super-huge
      lengths could cause us to temporarily allocate up to 4G memory.
      Sanity check things before blindly reading incorrectly.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 1460077777-31004-1-git-send-email-eblake@redhat.com
      Reviewed-by: NAlex Bligh <alex@alex.org.uk>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      200650d4
  4. 08 4月, 2016 2 次提交
    • A
      nbd: Fix NBD unsupported options · 6ff58164
      Alex Bligh 提交于
      nbd-client.c currently fails to handle unsupported options properly.
      If during option haggling the server finds an option that is
      unsupported, it returns an NBD_REP_ERR_UNSUP reply.
      
      According to nbd's proto.md, the format for such a reply
      should be:
      
        S: 64 bits, 0x3e889045565a9 (magic number for replies)
        S: 32 bits, the option as sent by the client to which this is a reply
        S: 32 bits, reply type (e.g., NBD_REP_ACK for successful completion,
           or NBD_REP_ERR_UNSUP to mark use of an option not known by this server
        S: 32 bits, length of the reply. This may be zero for some replies,
           in which case the next field is not sent
        S: any data as required by the reply (e.g., an export name in the case
           of NBD_REP_SERVER, or optional UTF-8 message for NBD_REP_ERR_*)
      
      However, in nbd-client.c, the reply type was being read, and if it
      contained an error, it was bailing out and issuing the next option
      request without first reading the length. This meant that the
      next option / handshake read had an extra 4 or more bytes of data in it.
      In practice, this makes Qemu incompatible with servers that do not
      support NBD_OPT_LIST.
      
      To verify this isn't an error in the specification or my reading of
      it, replies are sent by the reference implementation here:
       https://github.com/yoe/nbd/blob/66dfb35/nbd-server.c#L1232
      and as is evident it always sends a 'datasize' (aka length) 32 bit
      word. Unsupported elements are replied to here:
       https://github.com/yoe/nbd/blob/66dfb35/nbd-server.c#L1371Signed-off-by: NAlex Bligh <alex@alex.org.uk>
      Message-Id: <1459882500-24316-1-git-send-email-alex@alex.org.uk>
      [rework to ALWAYS consume an optional UTF-8 message from the server]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1459961962-18771-1-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6ff58164
    • E
      nbd: Improve debug traces on little-endian · 7548fe31
      Eric Blake 提交于
      Print debug tracing messages while data is still in native
      ordering, rather than after we've potentially swapped it into
      network order for transmission.  Also, it's nice if the server
      mentions what it is replying, to correlate it to with what the
      client says it is receiving.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1459913704-19949-4-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7548fe31
  5. 05 4月, 2016 1 次提交
  6. 23 3月, 2016 1 次提交
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  7. 17 2月, 2016 6 次提交
  8. 05 2月, 2016 1 次提交
    • P
      all: Clean up includes · d38ea87a
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
      d38ea87a
  9. 16 1月, 2016 1 次提交
    • F
      nbd: Split nbd.c · 798bfe00
      Fam Zheng 提交于
      We have NBD server code and client code, all mixed in a file. Now split
      them into separate files under nbd/, and update MAINTAINERS.
      
      filter_nbd for iotest 083 is updated to keep the log filtered out.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-Id: <1452760863-25350-3-git-send-email-famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      798bfe00