1. 16 9月, 2015 3 次提交
  2. 15 9月, 2015 25 次提交
    • P
      Merge remote-tracking branch 'remotes/berrange/tags/vnc-crypto-v9-for-upstream' into staging · 61962242
      Peter Maydell 提交于
      Merge vnc-crypto-v9
      
      # gpg: Signature made Tue 15 Sep 2015 15:32:38 BST using RSA key ID 15104FDF
      # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
      # gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"
      
      * remotes/berrange/tags/vnc-crypto-v9-for-upstream:
        ui: convert VNC server to use QCryptoTLSSession
        ui: fix return type for VNC I/O functions to be ssize_t
        crypto: introduce new module for handling TLS sessions
        crypto: add sanity checking of TLS x509 credentials
        crypto: introduce new module for TLS x509 credentials
        crypto: introduce new module for TLS anonymous credentials
        crypto: introduce new base module for TLS credentials
        qom: allow QOM to be linked into tools binaries
        crypto: move crypto objects out of libqemuutil.la
        tests: remove repetition in unit test object deps
        qapi: allow override of default enum prefix naming
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      61962242
    • 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
    • D
      crypto: introduce new module for handling TLS sessions · d321e1e5
      Daniel P. Berrange 提交于
      Introduce a QCryptoTLSSession object that will encapsulate
      all the code for setting up and using a client/sever TLS
      session. This isolates the code which depends on the gnutls
      library, avoiding #ifdefs in the rest of the codebase, as
      well as facilitating any possible future port to other TLS
      libraries, if desired. It makes use of the previously
      defined QCryptoTLSCreds object to access credentials to
      use with the session. It also includes further unit tests
      to validate the correctness of the TLS session handshake
      and certificate validation. This is functionally equivalent
      to the current TLS session handling code embedded in the
      VNC server, and will obsolete it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d321e1e5
    • D
      crypto: add sanity checking of TLS x509 credentials · 9a2fd434
      Daniel P. Berrange 提交于
      If the administrator incorrectly sets up their x509 certificates,
      the errors seen at runtime during connection attempts are very
      obscure and difficult to diagnose. This has been a particular
      problem for people using openssl to generate their certificates
      instead of the gnutls certtool, because the openssl tools don't
      turn on the various x509 extensions that gnutls expects to be
      present by default.
      
      This change thus adds support in the TLS credentials object to
      sanity check the certificates when QEMU first loads them. This
      gives the administrator immediate feedback for the majority of
      common configuration mistakes, reducing the pain involved in
      setting up TLS. The code is derived from equivalent code that
      has been part of libvirt's TLS support and has been seen to be
      valuable in assisting admins.
      
      It is possible to disable the sanity checking, however, via
      the new 'sanity-check' property on the tls-creds object type,
      with a value of 'no'.
      
      Unit tests are included in this change to verify the correctness
      of the sanity checking code in all the key scenarios it is
      intended to cope with. As part of the test suite, the pkix_asn1_tab.c
      from gnutls is imported. This file is intentionally copied from the
      (long since obsolete) gnutls 1.6.3 source tree, since that version
      was still under GPLv2+, rather than the GPLv3+ of gnutls >= 2.0.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      9a2fd434
    • D
      crypto: introduce new module for TLS x509 credentials · 85bcbc78
      Daniel P. Berrange 提交于
      Introduce a QCryptoTLSCredsX509 class which is used to
      manage x509 certificate TLS credentials. This will be
      the preferred credential type offering strong security
      characteristics
      
      Example CLI configuration:
      
       $QEMU -object tls-creds-x509,id=tls0,endpoint=server,\
                     dir=/path/to/creds/dir,verify-peer=yes
      
      The 'id' value in the -object args will be used to associate the
      credentials with the network services. For example, when the VNC
      server is later converted it would use
      
       $QEMU -object tls-creds-x509,id=tls0,.... \
             -vnc 127.0.0.1:1,tls-creds=tls0
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      85bcbc78
    • D
      crypto: introduce new module for TLS anonymous credentials · e00adf6c
      Daniel P. Berrange 提交于
      Introduce a QCryptoTLSCredsAnon class which is used to
      manage anonymous TLS credentials. Use of this class is
      generally discouraged since it does not offer strong
      security, but it is required for backwards compatibility
      with the current VNC server implementation.
      
      Simple example CLI configuration:
      
       $QEMU -object tls-creds-anon,id=tls0,endpoint=server
      
      Example using pre-created diffie-hellman parameters
      
       $QEMU -object tls-creds-anon,id=tls0,endpoint=server,\
                     dir=/path/to/creds/dir
      
      The 'id' value in the -object args will be used to associate the
      credentials with the network services. For example, when the VNC
      server is later converted it would use
      
       $QEMU -object tls-creds-anon,id=tls0,.... \
             -vnc 127.0.0.1:1,tls-creds=tls0
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      e00adf6c
    • D
      crypto: introduce new base module for TLS credentials · a090187d
      Daniel P. Berrange 提交于
      Introduce a QCryptoTLSCreds class to act as the base class for
      storing TLS credentials. This will be later subclassed to provide
      handling of anonymous and x509 credential types. The subclasses
      will be user creatable objects, so instances can be created &
      deleted via 'object-add' and 'object-del' QMP commands respectively,
      or via the -object command line arg.
      
      If the credentials cannot be initialized an error will be reported
      as a QMP reply, or on stderr respectively.
      
      The idea is to make it possible to represent and manage TLS
      credentials independently of the network service that is using
      them. This will enable multiple services to use the same set of
      credentials and minimize code duplication. A later patch will
      convert the current VNC server TLS code over to use this object.
      
      The representation of credentials will be functionally equivalent
      to that currently implemented in the VNC server with one exception.
      The new code has the ability to (optionally) load a pre-generated
      set of diffie-hellman parameters, if the file dh-params.pem exists,
      whereas the current VNC server will always generate them on startup.
      This is beneficial for admins who wish to avoid the (small) time
      sink of generating DH parameters at startup and/or avoid depleting
      entropy.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a090187d
    • D
      qom: allow QOM to be linked into tools binaries · 0c7012e0
      Daniel P. Berrange 提交于
      The qom objects are currently added to common-obj-y
      which is only linked into the system emulators. The
      later crypto patches will depend on QOM infrastructure
      and will also be used from tools binaries. Thus the QOM
      objects are moved into a new qom-obj-y variable which
      can be referenced when linking tools, system emulators
      and tests.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0c7012e0
    • D
      crypto: move crypto objects out of libqemuutil.la · fb37726d
      Daniel P. Berrange 提交于
      Future patches will be adding more crypto related APIs which
      rely on QOM infrastructure. This creates a problem, because
      QOM relies on library constructors to register objects. When
      you have a file in a static .a library though which is only
      referenced by a constructor the linker is dumb and will drop
      that file when linking to the final executable :-( The only
      workaround for this is to link the .a library to the executable
      using the -Wl,--whole-archive flag, but this creates its own
      set of problems because QEMU is relying on lazy linking for
      libqemuutil.a. Using --whole-archive majorly increases the
      size of final executables as they now contain a bunch of
      object code they don't actually use.
      
      The least bad option is to thus not include the crypto objects
      in libqemuutil.la, and instead define a crypto-obj-y variable
      that is referenced directly by all the executables that need
      this code (tools + softmmu, but not qemu-ga). We avoid pulling
      entire of crypto-obj-y into the userspace emulators as that
      would force them to link to gnutls too, which is not required.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      fb37726d
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150915-1' into staging · 1078f5db
      Peter Maydell 提交于
      gtk: misc grab tweaks, locale fix.
      
      # gpg: Signature made Tue 15 Sep 2015 11:35:36 BST using RSA key ID D3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      
      * remotes/kraxel/tags/pull-gtk-20150915-1:
        gtk: use setlocale() for LC_MESSAGES only
        gtk: don't grab input when entering fullscreen.
        gtk: set free_scale when setting zoom_fit
        gtk: trace input grab reason
        gtk: move gd_update_caption calls to gd_{grab,ungrab}_{pointer,keyboard}
        gtk: check for existing grabs in gd_grab_{pointer,keyboard}
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      1078f5db
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging · b76a0d5d
      Peter Maydell 提交于
      This net pull request contains security fixes for qemu.git/master.  The patches
      should also be applied to stable trees.
      
      The ne2000 NIC model has QEMU memory corruption issue.  Both ne2000 and e1000
      have an infinite loop.
      
      Please see the patches for CVE numbers and details on the bugs.
      
      # gpg: Signature made Tue 15 Sep 2015 13:02:21 BST using RSA key ID 81AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      
      * remotes/stefanha/tags/net-pull-request:
        net: avoid infinite loop when receiving packets(CVE-2015-5278)
        net: add checks to validate ring buffer pointers(CVE-2015-5279)
        e1000: Avoid infinite loop in processing transmit descriptor (CVE-2015-6815)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      b76a0d5d
    • P
      net: avoid infinite loop when receiving packets(CVE-2015-5278) · 737d2b3c
      P J P 提交于
      Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152)
      bytes to process network packets. While receiving packets
      via ne2000_receive() routine, a local 'index' variable
      could exceed the ring buffer size, leading to an infinite
      loop situation.
      Reported-by: NQinghao Tang <luodalongde@gmail.com>
      Signed-off-by: NP J P <pjp@fedoraproject.org>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      737d2b3c
    • P
      net: add checks to validate ring buffer pointers(CVE-2015-5279) · 9bbdbc66
      P J P 提交于
      Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152)
      bytes to process network packets. While receiving packets
      via ne2000_receive() routine, a local 'index' variable
      could exceed the ring buffer size, which could lead to a
      memory buffer overflow. Added other checks at initialisation.
      Reported-by: NQinghao Tang <luodalongde@gmail.com>
      Signed-off-by: NP J P <pjp@fedoraproject.org>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      9bbdbc66
    • P
      e1000: Avoid infinite loop in processing transmit descriptor (CVE-2015-6815) · b947ac2b
      P J P 提交于
      While processing transmit descriptors, it could lead to an infinite
      loop if 'bytes' was to become zero; Add a check to avoid it.
      
      [The guest can force 'bytes' to 0 by setting the hdr_len and mss
      descriptor fields to 0.
      --Stefan]
      Signed-off-by: NP J P <pjp@fedoraproject.org>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 1441383666-6590-1-git-send-email-stefanha@redhat.com
      b947ac2b
    • A
      gtk: use setlocale() for LC_MESSAGES only · 2cb5d2a4
      Alberto Garcia 提交于
      The QEMU code is not internationalized and assumes that it runs under
      the C locale, but if we use the GTK+ UI we'll end up importing the
      locale settings from the environment. This can break things, such as
      the JSON generator and iotest 120 in locales that use a decimal comma.
      
      We do however have translations for a few simple strings for the GTK+
      menu items, so in order to run QEMU using the C locale, and yet have a
      translated UI let's use setlocale() for LC_MESSAGES only.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      2cb5d2a4
    • G
      gtk: don't grab input when entering fullscreen. · 78aee081
      Gerd Hoffmann 提交于
      Kick off all grabbing logic from fullscreen mode.  In the current state
      it seems to create more problems than it solves.  Try running qemu/gtk
      fullscreen on one head of a multihead host for example ...
      
      There probably was a reason the grab-on-fullscreen logic was added in
      the first place.  So please test and report any issues so we can try to
      find a sane way to handle it.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      78aee081
    • G
      gtk: set free_scale when setting zoom_fit · 1d73cd78
      Gerd Hoffmann 提交于
      free_scale field tracks zoom-fit menu toggle state,
      so we should keep them in sync ...
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      1d73cd78
    • G
      gtk: trace input grab reason · d531deef
      Gerd Hoffmann 提交于
      Add a reason to grab calls and trace points,
      so it is easier to debug grab related ui issues.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      d531deef
    • G
      gtk: move gd_update_caption calls to gd_{grab,ungrab}_{pointer,keyboard} · 695cc59d
      Gerd Hoffmann 提交于
      Then we don't have to pair the grab/ungrab calls with update_caption
      calls any more because things happen automatically ;)
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      695cc59d
    • G
      gtk: check for existing grabs in gd_grab_{pointer,keyboard} · aa4f4058
      Gerd Hoffmann 提交于
      If a grab is already active for our window, do nothing.
      If a grab is already active for another window, release it.
      
      Cleanup some checks and ungrab calls in the code which are
      not needed any more.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      aa4f4058
    • D
      tests: remove repetition in unit test object deps · b124533e
      Daniel P. Berrange 提交于
      Most of the unit tests have identical sets of object deps.
      For example all block unit tests need to depend on
      
       $(block-obj-y) libqemuutil.a libqemustub.a
      
      Currently each unit test repeats this list of test deps.
      This list of deps will grow as future patches add more
      modules to the build, so define some common variables
      that can be used by all unit tests to remove the
      repetition.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b124533e
    • D
      qapi: allow override of default enum prefix naming · 351d36e4
      Daniel P. Berrange 提交于
      The camel_to_upper() method applies some heuristics to turn
      a mixed case type name into an all-uppercase name. This is
      used for example, to generate enum constant name prefixes.
      
      The heuristics don't also generate a satisfactory name
      though. eg
      
        { 'enum': 'QCryptoTLSCredsEndpoint',
          'data': ['client', 'server']}
      
      Results in Q_CRYPTOTLS_CREDS_ENDPOINT_CLIENT. This has
      an undesirable _ after the initial Q and is missing an
      _ between the CRYPTO & TLS strings.
      
      Rather than try to add more and more heuristics to try
      to cope with this, simply allow the QAPI schema to
      specify the desired enum constant prefix explicitly.
      
      eg
      
        { 'enum': 'QCryptoTLSCredsEndpoint',
          'prefix': 'QCRYPTO_TLS_CREDS_ENDPOINT',
          'data': ['client', 'server']}
      
      Now gives the QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT name.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      351d36e4
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 007e620a
      Peter Maydell 提交于
      Block layer patches (v2)
      
      # gpg: Signature made Mon 14 Sep 2015 15:56:54 BST using RSA key ID C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      
      * remotes/kevin/tags/for-upstream: (23 commits)
        qcow2: Make qcow2_alloc_bytes() more explicit
        vmdk: Fix next_cluster_sector for compressed write
        iotests: Add test for checking large image files
        qcow2: Make size_to_clusters() return uint64_t
        qemu-iotests: More qcow2 reopen tests
        qemu-iotests: Reopen qcow2 with lazy-refcounts change
        qcow2: Support updating driver-specific options in reopen
        qcow2: Make qcow2_update_options() suitable for transactions
        qcow2: Fix memory leak in qcow2_update_options() error path
        qcow2: Leave s unchanged on qcow2_update_options() failure
        qcow2: Move rest of option handling to qcow2_update_options()
        qcow2: Move qcow2_update_options() call up
        qcow2: Factor out qcow2_update_options()
        qcow2: Improve error message
        qemu-io: Add command 'reopen'
        qemu-io: Remove duplicate 'open' error message
        block: Allow specifying driver-specific options to reopen
        qcow2: Rename BDRVQcowState to BDRVQcow2State
        block: Drop bdrv_find_whitelisted_format()
        block: Drop drv parameter from bdrv_fill_options()
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      007e620a
    • M
      qapi: Fix cgen() for Python older than 2.7 · 2752e5be
      Markus Armbruster 提交于
      A feature new in Python 2.7 crept into commit 77e703b8: re.subn()'s
      fifth argument.  Avoid that, use re.compile().
      Reported-by: NLaurent Desnogues <laurent.desnogues@gmail.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Tested-by: NLaurent Desnogues <laurent.desnogues@gmail.com>
      Message-id: 1441640755-23902-1-git-send-email-armbru@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      2752e5be
  3. 14 9月, 2015 12 次提交