1. 17 7月, 2018 16 次提交
  2. 16 7月, 2018 14 次提交
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-07-16' into staging · 102ad0a8
      Peter Maydell 提交于
      Miscellaneous patches for 2018-07-16 (3.0.0-rc1)
      
      # gpg: Signature made Mon 16 Jul 2018 14:50:07 BST
      # gpg:                using RSA key 3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-misc-2018-07-16:
        monitor: Fix tracepoint crash on JSON syntax error
        MAINTAINERS: New section "Incompatible changes", copy libvir-list
        qemu-doc: Move appendix "Deprecated features" to its own file
        cli qmp: Mark --preconfig, exit-preconfig experimental
        qapi: Do not expose "allow-preconfig" in query-qmp-schema
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      102ad0a8
    • M
      monitor: Fix tracepoint crash on JSON syntax error · 8720e63e
      Markus Armbruster 提交于
      When tracepoint handle_qmp_command is enabled, we crash on JSON syntax
      errors.  Broken in commit 1cc37471.  Fix by skipping the tracepoint
      on JSON syntax error.  Before the flawed commit, we skipped it by
      returning early.
      
      Fixes: CID 1394216
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180716091012.29510-1-armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      8720e63e
    • M
      MAINTAINERS: New section "Incompatible changes", copy libvir-list · b02c9bc3
      Markus Armbruster 提交于
      Libvirt developers would like to be copied on patches to qemu-doc
      appendix "Deprecated features".  Do them the favor.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180716073226.21127-3-armbru@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      b02c9bc3
    • M
      qemu-doc: Move appendix "Deprecated features" to its own file · 44c67847
      Markus Armbruster 提交于
      Consumers of QEMU need to track feature deprecation.  Keeping
      deprecation documentation in its own file helps in two small ways:
      
      * You can track changes the easy and obvious way, with git-log.
        Before, you had to resort to more complex gittery like "git-log
        --oneline -L '/@node Deprecated features/,/@node Supported build
        platforms/:qemu-doc.texi'"
      
      * It lets us use MAINTAINERS to copy interested parties on deprecation
        patches, so they can advise or object before they're a done deal.
        The next commit will do that for libvirt.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180716073226.21127-2-armbru@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      44c67847
    • M
      cli qmp: Mark --preconfig, exit-preconfig experimental · 361ac948
      Markus Armbruster 提交于
      Committing to the current --preconfig / exit-preconfig interface
      before it has seen any use is premature.  Mark both as experimental,
      the former in documentation, the latter by renaming it to
      x-exit-preconfig.
      
      See the previous commit for more detailed rationale.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180705091402.26244-3-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Acked-by: NIgor Mammedov <imammedo@redhat.com>
      [Straightforward conflict with commit 514337c1 resolved]
      361ac948
    • M
      qapi: Do not expose "allow-preconfig" in query-qmp-schema · 1f214ee1
      Markus Armbruster 提交于
      According to commit 047f7038, option --preconfig
      
          [...] allows pausing QEMU in the new RUN_STATE_PRECONFIG state,
          allowing the configuration of QEMU from QMP before the machine
          jumps into board initialization code of machine_run_board_init()
      
          The intent is to allow management to query machine state and
          additionally configure it using previous query results within one
          QEMU instance (i.e. eliminate the need to start QEMU twice, 1st to
          query board specific parameters and 2nd for actual VM start using
          query results for additional parameters).
      
      The implementation is a bit of a hack: it splices in an additional
      main loop before machine creation, in special runstate preconfig.  New
      command exit-preconfig exits that main loop.  QEMU continues
      initializing, creates the machine, and runs the good old main loop.
      The replacement of the main loop is transparent to monitors.
      
      Sadly, some commands expect initialization to be complete.  Running
      them in --preconfig's main loop violates their preconditions.  Since
      we don't really know which commands are safe, we use a whitelist.
      This drags the concept of run state into the QMP core.
      
      The whitelist is done as a command flag in the QAPI schema (commit
      d6fe3d02).  Drags the concept of run state further into the QAPI
      language.
      
      The command flag is exposed in query-qmp-schema (also commit
      d6fe3d02).  This makes it ABI.
      
      I consider the whole thing an offensively ugly hack, but sometimes an
      ugly hack is the best we can do to solve a problem people have.
      
      The need described by the commit message quote above is genuine.  The
      proper solution would be a main loop that permits complete
      configuration via QMP.  This is out of reach, thus the hack.
      
      However, even though the need is genuine, it isn't urgent: libvirt is
      not going to use this anytime soon.  Baking a hack into ABI before it
      has any users is a bad idea.
      
      This commit reverts the parts of commit d6fe3d02 that affect ABI
      via query-qmp-schema.  The commit did the following:
      
      (1) Add command flag 'allow-preconfig' to the QAPI schema language
      
      (2) Pass it to code generators
      
      (3) Have the commands.py code generator pass it to the command
          registry (so commit 047f7038 can use it as whitelist)
      
      (4) Add 'allow-preconfig' to SchemaInfoCommand (neglecting to update
          qapi-code-gen.txt section "Client JSON Protocol introspection")
      
      (5) Set 'allow-preconfig': true for commands qmp_capabilities,
          query-commands, query-command-line-options, query-status
      
      Revert exactly (4), plus a bit of documentation added to
      qemu-tech.info in commit 047f7038.
      
      Shrinks query-qmp-schema's output from 126.5KiB to 121.8KiB for me.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180705091402.26244-2-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Acked-by: NIgor Mammedov <imammedo@redhat.com>
      [Straightforward conflict with commit d626b6c1 resolved]
      1f214ee1
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.0-20180716' into staging · 633e8240
      Peter Maydell 提交于
      ppc patch queue 2018-07-16
      
      Here's my first hard freeze pull request for qemu-3.0.  This contains
      an assortment of bugfixes. Several are for regressions, others are for
      bugs that I think are significant enough to address during hard freeze.
      
      # gpg: Signature made Mon 16 Jul 2018 09:28:37 BST
      # gpg:                using RSA key 6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-3.0-20180716:
        sm501: Fix warning about unreachable code
        sam460ex: Correct use after free error
        etsec: fix IRQ (un)masking
        ppc/xics: fix ICP reset path
        spapr: Correct inverted test in spapr_pc_dimm_node()
        sm501: Update screen on frame buffer address change
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      633e8240
    • P
      Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging · b808d200
      Peter Maydell 提交于
      Some fixes for linux-user:
      - workaround for CMSG_NXTHDR bug
      - two patches for ppc64/ppc64le host:
        fix fcntl() with *LK64 commands
        (seen when dpkg wants to lock the DB)
        fix reserved_va alignment (ppc64 needs
        a 64kB alignment)
      - convert a forgotten fcntl() to safe_fcntl()
      
      # gpg: Signature made Sun 15 Jul 2018 20:51:19 BST
      # gpg:                using RSA key F30C38BD3F2FBE3C
      # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
      # gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
      # gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
      # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C
      
      * remotes/vivier2/tags/linux-user-for-3.0-pull-request:
        Zero out the host's `msg_control` buffer
        linux-user: fix mmap_find_vma_reserved()
        linux-user: convert remaining fcntl() to safe_fcntl()
        linux-user: ppc64: use the correct values for F_*LK64s
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      b808d200
    • B
      sm501: Fix warning about unreachable code · 6730df05
      BALATON Zoltan 提交于
      Coverity warned that the false arm of conditional expression is
      unreachable when it is inside an if with the same condition.
      Remove the unreachable code to avoid the warning.
      
      Fixes: CID 1394215
      Reported-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      6730df05
    • B
      sam460ex: Correct use after free error · 3cc702d6
      BALATON Zoltan 提交于
      Commit 51b0d834 changed error handling to report file name in error
      message but forgot to move freeing it after usage. Noticed by Coverity.
      
      Fixes: CID 1394217
      Reported-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3cc702d6
    • M
      etsec: fix IRQ (un)masking · fd8e3381
      Michael Davidsaver 提交于
      Interrupt conditions occurring while masked are not being
      signaled when later unmasked.
      The fix is to raise/lower IRQs when IMASK is changed.
      
      To avoid problems like this in future, consolidate
      IRQ pin update logic in one function.
      
      Also fix probable typo "IEVENT_TXF | IEVENT_TXF",
      and update IRQ pins on reset.
      Signed-off-by: NMichael Davidsaver <mdavidsaver@gmail.com>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      fd8e3381
    • G
      ppc/xics: fix ICP reset path · b585395b
      Greg Kurz 提交于
      Recent cleanup in commit a028dd42 dropped the ICPStateClass::reset
      handler. It is now up to child ICP classes to call the DeviceClass::reset
      handler of the parent class, thanks to device_class_set_parent_reset().
      This is a better object programming pattern, but unfortunately it causes
      QEMU to crash during CPU hotplug:
      
      (qemu) device_add host-spapr-cpu-core,id=core1,core-id=1
      Segmentation fault (core dumped)
      
      When the hotplug path tries to reset the ICP device, we end up calling:
      
      static void icp_kvm_reset(DeviceState *dev)
      {
          ICPStateClass *icpc = ICP_GET_CLASS(dev);
      
          icpc->parent_reset(dev);
      
      but icpc->parent_reset is NULL... This happens because icp_kvm_class_init()
      calls:
      
          device_class_set_parent_reset(dc, icp_kvm_reset,
                                        &icpc->parent_reset);
      
      but dc->reset, ie, DeviceClass::reset for the TYPE_ICP type, is
      itself NULL.
      
      This patch hence sets DeviceClass::reset for the TYPE_ICP type to
      point to icp_reset(). It then registers a reset handler that calls
      DeviceClass::reset. If the ICP subtype has configured its own reset
      handler with device_class_set_parent_reset(), this ensures it will
      be called first and it can then call ICPStateClass::parent_reset
      safely. This fixes the reset path for the TYPE_KVM_ICP type, which
      is the only subtype that defines its own reset function.
      Reported-by: NSatheesh Rajendran <sathnaga@linux.vnet.ibm.com>
      Suggested-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Fixes: a028dd42Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b585395b
    • D
      spapr: Correct inverted test in spapr_pc_dimm_node() · ccc2cef8
      David Gibson 提交于
      This function was introduced between v2.11 and v2.12 to replace obsolete
      ways of specifying the NUMA nodes for DIMMs.  It's used to find the correct
      node for an LMB, by locating which DIMM object it lies within.
      
      Unfortunately, one of the checks is inverted, so we check whether the
      address is less than two different things, rather than actually checking
      a range.  This introduced a regression, meaning that after a reboot qemu
      will advertise incorrect node information for memory to the guest.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      ccc2cef8
    • B
      sm501: Update screen on frame buffer address change · 593a1cdd
      BALATON Zoltan 提交于
      When the guest changes the address of the frame buffer we need to
      refresh the screen to correctly display the new content. This fixes
      display update problems when changing between screens on AmigaOS.
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      593a1cdd
  3. 15 7月, 2018 4 次提交
    • J
      Zero out the host's `msg_control` buffer · 1d3d1b23
      Jonas Schievink 提交于
      If this is not done, qemu would drop any control message after the first
      one.
      
      This is because glibc's `CMSG_NXTHDR` macro accesses the uninitialized
      cmsghdr's length field in order to find out if the message fits into the
      `msg_control` buffer, wrongly assuming that it doesn't because the
      length field contains garbage. Accessing the length field is fine for
      completed messages we receive from the kernel, but is - as far as I know
      - not needed since the kernel won't return such an invalid cmsghdr in
      the first place.
      
      This is tracked as this glibc bug:
      https://sourceware.org/bugzilla/show_bug.cgi?id=13500
      
      It's probably also a good idea to bail with an error if `CMSG_NXTHDR`
      returns NULL but `TARGET_CMSG_NXTHDR` doesn't (ie. we still expect
      cmsgs).
      Signed-off-by: NJonas Schievink <jonasschievink@gmail.com>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Message-Id: <20180711221244.31869-1-jonasschievink@gmail.com>
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      1d3d1b23
    • L
      linux-user: fix mmap_find_vma_reserved() · dc18baae
      Laurent Vivier 提交于
      The value given by mmap_find_vma_reserved() is used with mmap(),
      so it is needed to be aligned with the host page size.
      
      Since commit 18e80c55, reserved_va is only aligned to TARGET_PAGE_SIZE,
      and it works well if this size is greater or equal to the host page size.
      
      But ppc64 hosts have 64kB page size and when we start a 4kiB page size
      guest (like i386), it fails when it tries to mmap the stack:
      
          mmap stack: Invalid argument
      
      Fixes: 18e80c55 (linux-user: Tidy and enforce reserved_va initialization)
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <20180714193553.30846-1-laurent@vivier.eu>
      dc18baae
    • L
      linux-user: convert remaining fcntl() to safe_fcntl() · af8ab2bf
      Laurent Vivier 提交于
      Commit 435da5e7 didn't convert a fcntl() call to safe_fcntl()
      for TARGET_NR_fcntl64 case. There is no reason to not use it
      in this case.
      
      Fixes: 435da5e7 linux-user: Use safe_syscall wrapper for fcntl
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      Message-Id: <20180713125805.10749-1-laurent@vivier.eu>
      af8ab2bf
    • S
      linux-user: ppc64: use the correct values for F_*LK64s · 4a545761
      Shivaprasad G Bhat 提交于
      Qemu includes the glibc headers for the host defines and target headers are
      part of the qemu source themselves. The glibc has the F_GETLK64, F_SETLK64
      and F_SETLKW64 defined to 12, 13 and 14 for all archs in
      sysdeps/unix/sysv/linux/bits/fcntl-linux.h. The linux kernel generic
      definition for F_*LK is 5, 6 & 7 and F_*LK64* is 12,13, and 14 as seen in
      include/uapi/asm-generic/fcntl.h. On 64bit machine, by default the kernel
      assumes all F_*LK to 64bit calls and doesnt support use of F_*LK64* as
      can be seen in include/linux/fcntl.h in linux source.
      
      On x86_64 host, the values for F_*LK64* are set to 5, 6 and 7
      explicitly in /usr/include/x86_64-linux-gnu/bits/fcntl.h by the glibc.
      Whereas, a PPC64 host doesn't have such a definition in
      /usr/include/powerpc64le-linux-gnu/bits/fcntl.h by the glibc. So,
      the sources on PPC64 host sees the default value of F_*LK64*
      as 12, 13 & 14(fcntl-linux.h).
      
      Since the 64bit kernel doesnt support 12, 13 & 14; the glibc fcntl syscall
      implementation(__libc_fcntl*(), __fcntl64_nocancel) does the F_*LK64* value
      convertion back to F_*LK* values on PPC64 as seen in
      sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h with FCNTL_ADJUST_CMD()
      macro. Whereas on x86_64 host the values for F_*LK64* are set to 5, 6 and 7
      and no adjustments are needed.
      
      Since qemu doesnt use the glibc fcntl, but makes the safe_syscall* on its
      own, the PPC64 qemu is calling the syscall with 12, 13, and 14(without
      adjustment) and they all fail. The fcntl calls to F_GETLK/F_SETLK|W all
      fail by all pplications run on PPC64 host user emulation.
      
      The fix here could be to see why on PPC64 the glibc is still keeping
      F_*LK64* different from F_*LK and why adjusting them to 5, 6 and 7 before
      the syscall for PPC only. See if we can make the
      /usr/include/powerpc64le-linux-gnu/bits/fcntl.h to have the values
      5, 6 & 7 just like x86_64 and remove the adjustment code in glibc. That
      way, qemu sources see the kernel supported values in glibc headers.
      
      OR
      
      On PPC64 host, qemu sources see both F_*LK & F_*LK64* as same and set to
      12, 13 and 14 because __USE_FILE_OFFSET64 is defined in qemu
      sources(also refer sysdeps/unix/sysv/linux/bits/fcntl-linux.h).
      Do the value adjustment just like it is done by glibc source by using
      F_GETLK value of 5. That way, we make the syscalls with the actual
      supported values in Qemu. The patch is taking this approach.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Message-Id: <153148521235.87746.14142430397318741182.stgit@lep8c.aus.stglabs.ibm.com>
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      4a545761
  4. 13 7月, 2018 6 次提交
    • V
      docs: Grammar and spelling fixes · 9277d81f
      Ville Skyttä 提交于
      Signed-off-by: NVille Skyttä <ville.skytta@iki.fi>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 20180612065150.21110-1-ville.skytta@iki.fi
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9277d81f
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 68f1b569
      Peter Maydell 提交于
      Block layer patches:
      
      - file-posix: Check correct file type (regular file for 'file',
        character or block device for 'host_device'/'host_cdrom')
      - scsi-disk: Block Device Characteristics emulation fix
      - qemu-img: Consider required alignment for sparse area detection
      - Documentation and test improvements
      
      # gpg: Signature made Thu 12 Jul 2018 17:29:17 BST
      # gpg:                using RSA key 7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream:
        qemu-img: align result of is_allocated_sectors
        scsi-disk: Block Device Characteristics emulation fix
        iotests: add test 226 for file driver types
        file-posix: specify expected filetypes
        qemu-img: Document copy offloading implications with -S and -c
        iotests: nbd: Stop qemu-nbd before remaking image
        iotests: 153: Fix dead code
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      68f1b569
    • P
      qemu-img: align result of is_allocated_sectors · 8dcd3c9b
      Peter Lieven 提交于
      We currently don't enforce that the sparse segments we detect during convert are
      aligned. This leads to unnecessary and costly read-modify-write cycles either
      internally in Qemu or in the background on the storage device as nearly all
      modern filesystems or hardware have a 4k alignment internally.
      
      This patch modifies is_allocated_sectors so that its *pnum result will always
      end at an alignment boundary. This way all requests will end at an alignment
      boundary. The start of all requests will also be aligned as long as the results
      of get_block_status do not lead to an unaligned offset.
      
      The number of RMW cycles when converting an example image [1] to a raw device that
      has 4k sector size is about 4600 4k read requests to perform a total of about 15000
      write requests. With this path the additional 4600 read requests are eliminated while
      the number of total write requests stays constant.
      
      [1] https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.vmdkSigned-off-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      8dcd3c9b
    • D
      scsi-disk: Block Device Characteristics emulation fix · 740842c9
      Daniel Henrique Barboza 提交于
      The current BDC VPD page (page 0xb1) is too short. This can be
      seen running sg_utils:
      
      $ sg_vpd --page=bdc /dev/sda
      Block device characteristics VPD page (SBC):
      Block device characteristics VPD page length too short=8
      
      By the SCSI spec, the expected size of the SBC page is 0x40.
      There is no telling how the guest will behave with a shorter
      message - it can ignore it, or worse, make (wrong)
      assumptions.
      
      This patch fixes the emulation by setting the size to 0x40.
      This is the output of the previous sg_vpd command after
      applying it:
      
      $ sg_vpd --page=bdc /dev/sda -v
          inquiry cdb: 12 01 b1 00 fc 00
      Block device characteristics VPD page (SBC):
         [PQual=0  Peripheral device type: disk]
        Medium rotation rate is not reported
        Product type: Not specified
        WABEREQ=0
        WACEREQ=0
        Nominal form factor not reported
        FUAB=0
        VBULS=0
      
      To improve readability, this patch also adds the VBULS value
      explictly and add comments on the existing fields we're
      setting.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      740842c9
    • J
      iotests: add test 226 for file driver types · 2d4cb49d
      John Snow 提交于
      Test that we're rejecting what we ought to for file,
      host_driver and host_cdrom drivers. Test that we're
      seeing the deprecated message for block and chardevs
      on the file driver.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2d4cb49d
    • J
      file-posix: specify expected filetypes · 230ff739
      John Snow 提交于
      Adjust each caller of raw_open_common to specify if they are expecting
      host and character devices or not. Tighten expectations of file types upon
      open in the common code and refuse types that are not expected.
      
      This has two effects:
      
      (1) Character and block devices are now considered deprecated for the
          'file' driver, which expects only S_IFREG, and
      (2) no file-posix driver (file, host_cdrom, or host_device) can open
          directories now.
      
      I don't think there's a legitimate reason to open directories as if
      they were files. This prevents QEMU from opening and attempting to probe
      a directory inode, which can break in exciting ways. One of those ways
      is lseek on ext4/xfs, which will return 0x7fffffffffffffff as the file
      size instead of EISDIR. This can coax QEMU into responding with a
      confusing "file too big" instead of "Hey, that's not a file".
      
      See: https://bugs.launchpad.net/qemu/+bug/1739304/Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      230ff739