1. 08 3月, 2016 1 次提交
  2. 05 3月, 2016 1 次提交
    • E
      util: Shorten references into SocketAddress · 0399293e
      Eric Blake 提交于
      An upcoming patch will alter how simple unions, like SocketAddress,
      are laid out, which will impact all lines of the form 'addr->u.XXX'
      (expanding it to the longer 'addr->u.XXX.data').  For better
      legibility in that patch, and less need for line wrapping, it's better
      to use a temporary variable to reduce the effect of a layout change to
      just the variable initializations, rather than every reference within
      a SocketAddress.  Also, take advantage of some C99 initialization where
      it makes sense (simplifying g_new0() to g_new()).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1457021813-10704-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      0399293e
  3. 01 3月, 2016 2 次提交
  4. 05 2月, 2016 1 次提交
    • P
      ui: Clean up includes · e16f4c87
      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-2-git-send-email-peter.maydell@linaro.org
      e16f4c87
  5. 19 1月, 2016 1 次提交
    • D
      vnc: distiguish between ipv4/ipv6 omitted vs set to off · 3f0230e9
      Daniel P. Berrange 提交于
      The VNC code for interpreting QemuOpts does not currently
      distinguish between ipv4/ipv6 being omitted, and being
      set to 'off', because historically the 'ipv4' and 'ipv6'
      options were just flags which did not accept a value.
      
      The upshot is that if someone runs
      
        $QEMU -vnc localhost:1,ipv6=off
      
      QEMU still uses PF_UNSPEC and thus may still bind to IPv6,
      when it should use PF_INET.
      
      This is another instance of the problem previously fixed
      for chardevs in
      
        commit b77e7c8e
        Author: Paolo Bonzini <pbonzini@redhat.com>
        Date:   Mon Oct 12 15:35:16 2015 +0200
      
          qemu-sockets: fix conversion of ipv4/ipv6 JSON to QemuOpts
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1452518225-11751-6-git-send-email-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      3f0230e9
  6. 18 1月, 2016 2 次提交
  7. 13 1月, 2016 1 次提交
    • M
      error: Use error_reportf_err() where it makes obvious sense · c29b77f9
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch
      
          @@
          expression FMT, E, S;
          expression list ARGS;
          @@
          -    error_report(FMT, ARGS, error_get_pretty(E));
          +    error_reportf_err(E, FMT/*@@@*/, ARGS);
          (
          -    error_free(E);
          |
      	 exit(S);
          |
      	 abort();
          )
      
      followed by a replace of '%s"/*@@@*/' by '"' and some line rewrapping,
      because I can't figure out how to make Coccinelle transform strings.
      
      We now use the error whole instead of just its message obtained with
      error_get_pretty().  This avoids suppressing its hint (see commit
      50b7b000), but I can't see how the errors touched in this commit could
      come with hints.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1450452927-8346-12-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c29b77f9
  8. 18 12月, 2015 3 次提交
  9. 17 12月, 2015 2 次提交
    • E
      qapi: Change munging of CamelCase enum values · d20a580b
      Eric Blake 提交于
      When munging enum values, the fact that we were passing the entire
      prefix + value through camel_to_upper() meant that enum values
      spelled with CamelCase could be turned into CAMEL_CASE.  However,
      this provides a potential collision (both OneTwo and One-Two would
      munge into ONE_TWO) for enum types, when the same two names are
      valid side-by-side as QAPI member names.  By changing the generation
      of enum constants to always be prefix + '_' + c_name(value,
      False).upper(), and ensuring that there are no case collisions (in
      the next patches), we no longer have to worry about names that
      would be distinct as QAPI members but collide as variant tag names,
      without having to think about what munging the heuristics in
      camel_to_upper() will actually perform on an enum value.
      
      Making the change will affect enums that did not follow coding
      conventions, using 'CamelCase' rather than desired 'lower-case'.
      
      Thankfully, there are only two culprits: InputButton and ErrorClass.
      We already tweaked ErrorClass to make it an alias of QapiErrorClass,
      where only the alias needs changing rather than the whole tree.  So
      the bulk of this change is modifying INPUT_BUTTON_WHEEL_UP to the
      new INPUT_BUTTON_WHEELUP (and likewise for WHEELDOWN).  That part
      of this commit may later need reverting if we rename the enum
      constants from 'WheelUp' to 'wheel-up' as part of moving
      x-input-send-event to a stable interface; but at least we have
      documentation bread crumbs in place to remind us (commit 513e7cdb),
      and it matches the fact that SDL constants are also spelled
      SDL_BUTTON_WHEELUP.
      
      Suggested by: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-27-git-send-email-eblake@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d20a580b
    • E
      qapi: Don't let implicit enum MAX member collide · 7fb1cf16
      Eric Blake 提交于
      Now that we guarantee the user doesn't have any enum values
      beginning with a single underscore, we can use that for our
      own purposes.  Renaming ENUM_MAX to ENUM__MAX makes it obvious
      that the sentinel is generated.
      
      This patch was mostly generated by applying a temporary patch:
      
      |diff --git a/scripts/qapi.py b/scripts/qapi.py
      |index e6d014b..b862ec9 100644
      |--- a/scripts/qapi.py
      |+++ b/scripts/qapi.py
      |@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = {
      |     max_index = c_enum_const(name, 'MAX', prefix)
      |     ret += mcgen('''
      |     [%(max_index)s] = NULL,
      |+// %(max_index)s
      | };
      | ''',
      |                max_index=max_index)
      
      then running:
      
      $ cat qapi-{types,event}.c tests/test-qapi-types.c |
          sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list
      $ git grep -l _MAX | xargs sed -i -f list
      
      The only things not generated are the changes in scripts/qapi.py.
      
      Rejecting enum members named 'MAX' is now useless, and will be dropped
      in the next patch.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      [Rebased to current master, commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7fb1cf16
  10. 03 12月, 2015 1 次提交
  11. 26 11月, 2015 1 次提交
  12. 06 11月, 2015 1 次提交
  13. 05 11月, 2015 7 次提交
  14. 03 11月, 2015 2 次提交
  15. 02 11月, 2015 3 次提交
    • E
      sockets: Convert to new qapi union layout · 2d32adda
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for socket-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-17-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      2d32adda
    • E
      qapi: Unbox base members · ddf21908
      Eric Blake 提交于
      Rather than storing a base class as a pointer to a box, just
      store the fields of that base class in the same order, so that
      a child struct can be directly cast to its parent.  This gives
      less malloc overhead, less pointer dereferencing, and even less
      generated code.  Compare to the earlier commit 1e6c1616 "qapi:
      Generate a nicer struct for flat unions" (although that patch
      had fewer places to change, as less of qemu was directly using
      qapi structs for flat unions).  It also allows us to turn on
      automatic type-safe wrappers for upcasting to the base class
      of a struct.
      
      Changes to the generated code look like this in qapi-types.h:
      
      | struct SpiceChannel {
      |-    SpiceBasicInfo *base;
      |+    /* Members inherited from SpiceBasicInfo: */
      |+    char *host;
      |+    char *port;
      |+    NetworkAddressFamily family;
      |+    /* Own members: */
      |     int64_t connection_id;
      
      as well as additional upcast functions like qapi_SpiceChannel_base().
      Meanwhile, changes to qapi-visit.c look like:
      
      | static void visit_type_SpiceChannel_fields(Visitor *v, SpiceChannel **obj, Error **errp)
      | {
      |     Error *err = NULL;
      |
      |-    visit_type_implicit_SpiceBasicInfo(v, &(*obj)->base, &err);
      |+    visit_type_SpiceBasicInfo_fields(v, (SpiceBasicInfo **)obj, &err);
      |     if (err) {
      
      (the cast is necessary, since our upcast wrappers only deal with a
      single pointer, not pointer-to-pointer); plus the wholesale
      elimination of some now-unused visit_type_implicit_FOO() functions.
      
      Without boxing, the corner case of one empty struct having
      another empty struct as its base type now requires inserting a
      dummy member (previously, the 'Base *base' member sufficed).
      
      And now that we no longer consume a 'base' member in the generated
      C struct, we can delete the former negative struct-base-clash-base
      test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-11-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ddf21908
    • E
      vnc: Hoist allocation of VncBasicInfo to callers · 98481bfc
      Eric Blake 提交于
      A future qapi patch will rework generated structs with a base
      class to be unboxed.  In preparation for that, change the code
      that allocates then populates an info struct to instead merely
      populate the fields of an info field passed in as a parameter
      (renaming vnc_basic_info_get* to vnc_init_basic_info*). Add
      rudimentary Error handling at the lowest levels for cases
      where the old code returned NULL; but rather than plumb Error
      all the way through the stack, the callers drop the error and
      return NULL as before.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      98481bfc
  16. 20 10月, 2015 2 次提交
  17. 15 9月, 2015 2 次提交
    • D
      ui: convert VNC server to use QCryptoTLSSession · 3e305e4a
      Daniel P. Berrange 提交于
      Switch VNC server over to using the QCryptoTLSSession object
      for the TLS session. This removes the direct use of gnutls
      from the VNC server code. It also removes most knowledge
      about TLS certificate handling from the VNC server code.
      This has the nice effect that all the CONFIG_VNC_TLS
      conditionals go away and the user gets an actual error
      message when requesting TLS instead of it being silently
      ignored.
      
      With this change, the existing configuration options for
      enabling TLS with -vnc are deprecated.
      
      Old syntax for anon-DH credentials:
      
        -vnc hostname:0,tls
      
      New syntax:
      
        -object tls-creds-anon,id=tls0,endpoint=server \
        -vnc hostname:0,tls-creds=tls0
      
      Old syntax for x509 credentials, no client certs:
      
        -vnc hostname:0,tls,x509=/path/to/certs
      
      New syntax:
      
        -object tls-creds-x509,id=tls0,dir=/path/to/certs,endpoint=server,verify-peer=no \
        -vnc hostname:0,tls-creds=tls0
      
      Old syntax for x509 credentials, requiring client certs:
      
        -vnc hostname:0,tls,x509verify=/path/to/certs
      
      New syntax:
      
        -object tls-creds-x509,id=tls0,dir=/path/to/certs,endpoint=server,verify-peer=yes \
        -vnc hostname:0,tls-creds=tls0
      
      This aligns VNC with the way TLS credentials are to be
      configured in the future for chardev, nbd and migration
      backends. It also has the benefit that the same TLS
      credentials can be shared across multiple VNC server
      instances, if desired.
      
      If someone uses the deprecated syntax, it will internally
      result in the creation of a 'tls-creds' object with an ID
      based on the VNC server ID. This allows backwards compat
      with the CLI syntax, while still deleting all the original
      TLS code from the VNC server.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3e305e4a
    • D
      ui: fix return type for VNC I/O functions to be ssize_t · fdd1ab6a
      Daniel P. Berrange 提交于
      Various VNC server I/O functions return 'long' and then
      also pass this to a method accepting 'int'. All these
      should be ssize_t to match the signature of read/write
      APIs and thus avoid potential for integer truncation /
      wraparound.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      fdd1ab6a
  18. 26 8月, 2015 1 次提交
    • G
      vnc: fix memory corruption (CVE-2015-5225) · eb8934b0
      Gerd Hoffmann 提交于
      The _cmp_bytes variable added by commit "bea60dd7 ui/vnc: fix potential
      memory corruption issues" can become negative.  Result is (possibly
      exploitable) memory corruption.  Reason for that is it uses the stride
      instead of bytes per scanline to apply limits.
      
      For the server surface is is actually fine.  vnc creates that itself,
      there is never any padding and thus scanline length always equals stride.
      
      For the guest surface scanline length and stride are typically identical
      too, but it doesn't has to be that way.  So add and use a new variable
      (guest_ll) for the guest scanline length.  Also rename min_stride to
      line_bytes to make more clear what it actually is.  Finally sprinkle
      in an assert() to make sure we never use a negative _cmp_bytes again.
      Reported-by: N范祚至(库特) <zuozhi.fzz@alibaba-inc.com>
      Reviewed-by: NP J P <ppandit@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      eb8934b0
  19. 24 7月, 2015 1 次提交
  20. 14 7月, 2015 1 次提交
  21. 08 7月, 2015 2 次提交
  22. 07 7月, 2015 1 次提交
    • D
      crypto: move built-in D3DES implementation into crypto/ · 9fd72468
      Daniel P. Berrange 提交于
      To prepare for a generic internal cipher API, move the
      built-in D3DES implementation into the crypto/ directory.
      
      This is not in fact a normal D3DES implementation, it is
      D3DES with double & triple length modes removed, and the
      key bytes in reversed bit order. IOW it is crippled
      specifically for the "benefit" of RFB, so call the new
      files desrfb.c instead of d3des.c to make it clear that
      it isn't a generally useful impl.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1435770638-25715-4-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9fd72468
  23. 23 6月, 2015 1 次提交