1. 07 2月, 2015 5 次提交
  2. 24 1月, 2015 1 次提交
    • J
      block: update string sizes for filename,backing_file,exact_filename · 9a29e18f
      Jeff Cody 提交于
      The string field entries 'filename', 'backing_file', and
      'exact_filename' in the BlockDriverState struct are defined as 1024
      bytes.
      
      However, many places that use these values accept a maximum of PATH_MAX
      bytes, so we have a mixture of 1024 byte and PATH_MAX byte allocations.
      This patch makes the BlockDriverStruct field string sizes match usage.
      
      This patch also does a few fixes related to the size that needs to
      happen now:
      
          * the block qapi driver is updated to use PATH_MAX bytes
          * the qcow and qcow2 drivers have an additional safety check
          * the block vvfat driver is updated to use PATH_MAX bytes
            for the size of backing_file, for systems where PATH_MAX is < 1024
            bytes.
          * qemu-img uses PATH_MAX rather than 1024.  These instances were not
            changed to be dynamically allocated, however, as the extra
            temporary 3K in stack usage for qemu-img does not seem worrisome.
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9a29e18f
  3. 14 1月, 2015 1 次提交
  4. 13 1月, 2015 5 次提交
  5. 13 12月, 2014 1 次提交
  6. 12 12月, 2014 1 次提交
    • M
      vmdk: Fix error for JSON descriptor file names · 5c98415b
      Max Reitz 提交于
      If vmdk blindly tries to use path_combine() using bs->file->filename as
      the base file name, this will result in a bad error message for JSON
      file names when calling bdrv_open(). It is better to only try
      bs->file->exact_filename; if that is empty, bs->file->filename will be
      useless for path_combine() and an error should be emitted (containing
      bs->file->filename because desc_file_path (which is
      bs->file->exact_filename) is empty).
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 1417615043-26174-2-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      5c98415b
  7. 10 12月, 2014 6 次提交
    • M
      block: Make essential BlockDriver objects public · 5f535a94
      Max Reitz 提交于
      There are some block drivers which are essential to QEMU and may not be
      removed: These are raw, file and qcow2 (as the default non-raw format).
      Make their BlockDriver objects public so they can be directly referenced
      throughout the block layer without needing to call bdrv_find_format()
      and having to deal with an error at runtime, while the real problem
      occurred during linking (where raw, file or qcow2 were not linked into
      qemu).
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5f535a94
    • K
      raw: Prohibit dangerous writes for probed images · 38f3ef57
      Kevin Wolf 提交于
      If the user neglects to specify the image format, QEMU probes the
      image to guess it automatically, for convenience.
      
      Relying on format probing is insecure for raw images (CVE-2008-2004).
      If the guest writes a suitable header to the device, the next probe
      will recognize a format chosen by the guest.  A malicious guest can
      abuse this to gain access to host files, e.g. by crafting a QCOW2
      header with backing file /etc/shadow.
      
      Commit 1e72d3b7 (April 2008) provided -drive parameter format to let
      users disable probing.  Commit f965509c (March 2009) extended QCOW2 to
      optionally store the backing file format, to let users disable backing
      file probing.  QED has had a flag to suppress probing since the
      beginning (2010), set whenever a raw backing file is assigned.
      
      All of these additions that allow to avoid format probing have to be
      specified explicitly. The default still allows the attack.
      
      In order to fix this, commit 79368c81 (July 2010) put probed raw images
      in a restricted mode, in which they wouldn't be able to overwrite the
      first few bytes of the image so that they would identify as a different
      image. If a write to the first sector would write one of the signatures
      of another driver, qemu would instead zero out the first four bytes.
      This patch was later reverted in commit 8b33d9ee (September 2010) because
      it didn't get the handling of unaligned qiov members right.
      
      Today's block layer that is based on coroutines and has qiov utility
      functions makes it much easier to get this functionality right, so this
      patch implements it.
      
      The other differences of this patch to the old one are that it doesn't
      silently write something different than the guest requested by zeroing
      out some bytes (it fails the request instead) and that it doesn't
      maintain a list of signatures in the raw driver (it calls the usual
      probe function instead).
      
      Note that this change doesn't introduce new breakage for false positive
      cases where the guest legitimately writes data into the first sector
      that matches the signatures of an image format (e.g. for nested virt):
      These cases were broken before, only the failure mode changes from
      corruption after the next restart (when the wrong format is probed) to
      failing the problematic write request.
      
      Also note that like in the original patch, the restrictions only apply
      if the image format has been guessed by probing. Explicitly specifying a
      format allows guests to write anything they like.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1416497234-29880-8-git-send-email-kwolf@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      38f3ef57
    • K
      block: Read only one sector for format probing · 7cddd372
      Kevin Wolf 提交于
      The only image format driver that even potentially accesses anything
      after 512 bytes in its bdrv_probe() implementation is VMDK, which reads
      a plain-text descriptor file. In practice, the field it's looking for
      seems to come first and will be well within the first 512 bytes, too.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1416497234-29880-7-git-send-email-kwolf@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      7cddd372
    • M
      nbd: Change external interface to BlockBackend · e140177d
      Max Reitz 提交于
      Substitute BlockDriverState by BlockBackend in every globally visible
      function provided by nbd.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1416309679-333-5-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e140177d
    • F
      block: Add bdrv_get_node_name · 20a9e77d
      Fam Zheng 提交于
      This returns the node name of a BDS. Remove the TODO comment and expect
      the callers to be explicit.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      20a9e77d
    • F
      block: Add bdrv_next_node · 04df765a
      Fam Zheng 提交于
      Similar to bdrv_next, this traverses through graph_bdrv_states. Will be
      useful to enumerate all the named nodes.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      04df765a
  8. 11 11月, 2014 1 次提交
  9. 03 11月, 2014 7 次提交
  10. 23 10月, 2014 1 次提交
  11. 20 10月, 2014 9 次提交
  12. 22 9月, 2014 2 次提交