1. 26 3月, 2020 5 次提交
  2. 25 3月, 2020 18 次提交
  3. 24 3月, 2020 17 次提交
    • P
      Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-03-24' into staging · 62a43e53
      Peter Maydell 提交于
      Block patches for 5.0-rc0:
      - Use-after-free fix
      - Fix for a memleak in an error path
      - Preventative measures against other potential use-after-frees, and
        against NULL deferences at runtime
      - iotest fixes
      
      # gpg: Signature made Tue 24 Mar 2020 12:19:09 GMT
      # gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
      # gpg:                issuer "mreitz@redhat.com"
      # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
      # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40
      
      * remotes/maxreitz/tags/pull-block-2020-03-24:
        iotests/026: Move v3-exclusive test to new file
        iotests: Fix cleanup path in some tests
        block/qcow2: zero data_file child after free
        block: bdrv_set_backing_bs: fix use-after-free
        block: Assert BlockDriver::format_name is not NULL
        block: Avoid memleak on qcow2 image info failure
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      62a43e53
    • M
      iotests/026: Move v3-exclusive test to new file · c264e5d2
      Max Reitz 提交于
      data_file does not work with v2, and we probably want 026 to keep
      working for v2 images.  Thus, open a new file for v3-exclusive error
      path test cases.
      
      Fixes: 81311255
             (“iotests/026: Test EIO on allocation in a data-file”)
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-Id: <20200311140707.1243218-1-mreitz@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Tested-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      c264e5d2
    • M
      iotests: Fix cleanup path in some tests · 801ddbda
      Max Reitz 提交于
      Some iotests leave behind some external data file when run for qcow2
      with -o data_file.  Fix that.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-Id: <20200224171631.384314-1-mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      801ddbda
    • V
      block/qcow2: zero data_file child after free · 808cf3cb
      Vladimir Sementsov-Ogievskiy 提交于
      data_file being NULL doesn't seem to be a correct state, but it's
      better than dead pointer and simpler to debug.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200316060631.30052-3-vsementsov@virtuozzo.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      808cf3cb
    • V
      block: bdrv_set_backing_bs: fix use-after-free · 6e57963a
      Vladimir Sementsov-Ogievskiy 提交于
      There is a use-after-free possible: bdrv_unref_child() leaves
      bs->backing freed but not NULL. bdrv_attach_child may produce nested
      polling loop due to drain, than access of freed pointer is possible.
      
      I've produced the following crash on 30 iotest with modified code. It
      does not reproduce on master, but still seems possible:
      
          #0  __strcmp_avx2 () at /lib64/libc.so.6
          #1  bdrv_backing_overridden (bs=0x55c9d3cc2060) at block.c:6350
          #2  bdrv_refresh_filename (bs=0x55c9d3cc2060) at block.c:6404
          #3  bdrv_backing_attach (c=0x55c9d48e5520) at block.c:1063
          #4  bdrv_replace_child_noperm
              (child=child@entry=0x55c9d48e5520,
              new_bs=new_bs@entry=0x55c9d3cc2060) at block.c:2290
          #5  bdrv_replace_child
              (child=child@entry=0x55c9d48e5520,
              new_bs=new_bs@entry=0x55c9d3cc2060) at block.c:2320
          #6  bdrv_root_attach_child
              (child_bs=child_bs@entry=0x55c9d3cc2060,
              child_name=child_name@entry=0x55c9d241d478 "backing",
              child_role=child_role@entry=0x55c9d26ecee0 <child_backing>,
              ctx=<optimized out>, perm=<optimized out>, shared_perm=21,
              opaque=0x55c9d3c5a3d0, errp=0x7ffd117108e0) at block.c:2424
          #7  bdrv_attach_child
              (parent_bs=parent_bs@entry=0x55c9d3c5a3d0,
              child_bs=child_bs@entry=0x55c9d3cc2060,
              child_name=child_name@entry=0x55c9d241d478 "backing",
              child_role=child_role@entry=0x55c9d26ecee0 <child_backing>,
              errp=errp@entry=0x7ffd117108e0) at block.c:5876
          #8  in bdrv_set_backing_hd
              (bs=bs@entry=0x55c9d3c5a3d0,
              backing_hd=backing_hd@entry=0x55c9d3cc2060,
              errp=errp@entry=0x7ffd117108e0)
              at block.c:2576
          #9  stream_prepare (job=0x55c9d49d84a0) at block/stream.c:150
          #10 job_prepare (job=0x55c9d49d84a0) at job.c:761
          #11 job_txn_apply (txn=<optimized out>, fn=<optimized out>) at
              job.c:145
          #12 job_do_finalize (job=0x55c9d49d84a0) at job.c:778
          #13 job_completed_txn_success (job=0x55c9d49d84a0) at job.c:832
          #14 job_completed (job=0x55c9d49d84a0) at job.c:845
          #15 job_completed (job=0x55c9d49d84a0) at job.c:836
          #16 job_exit (opaque=0x55c9d49d84a0) at job.c:864
          #17 aio_bh_call (bh=0x55c9d471a160) at util/async.c:117
          #18 aio_bh_poll (ctx=ctx@entry=0x55c9d3c46720) at util/async.c:117
          #19 aio_poll (ctx=ctx@entry=0x55c9d3c46720,
              blocking=blocking@entry=true)
              at util/aio-posix.c:728
          #20 bdrv_parent_drained_begin_single (poll=true, c=0x55c9d3d558f0)
              at block/io.c:121
          #21 bdrv_parent_drained_begin_single (c=c@entry=0x55c9d3d558f0,
              poll=poll@entry=true)
              at block/io.c:114
          #22 bdrv_replace_child_noperm
              (child=child@entry=0x55c9d3d558f0,
              new_bs=new_bs@entry=0x55c9d3d27300) at block.c:2258
          #23 bdrv_replace_child
              (child=child@entry=0x55c9d3d558f0,
              new_bs=new_bs@entry=0x55c9d3d27300) at block.c:2320
          #24 bdrv_root_attach_child
              (child_bs=child_bs@entry=0x55c9d3d27300,
              child_name=child_name@entry=0x55c9d241d478 "backing",
              child_role=child_role@entry=0x55c9d26ecee0 <child_backing>,
              ctx=<optimized out>, perm=<optimized out>, shared_perm=21,
              opaque=0x55c9d3cc2060, errp=0x7ffd11710c60) at block.c:2424
          #25 bdrv_attach_child
              (parent_bs=parent_bs@entry=0x55c9d3cc2060,
              child_bs=child_bs@entry=0x55c9d3d27300,
              child_name=child_name@entry=0x55c9d241d478 "backing",
              child_role=child_role@entry=0x55c9d26ecee0 <child_backing>,
              errp=errp@entry=0x7ffd11710c60) at block.c:5876
          #26 bdrv_set_backing_hd
              (bs=bs@entry=0x55c9d3cc2060,
              backing_hd=backing_hd@entry=0x55c9d3d27300,
              errp=errp@entry=0x7ffd11710c60)
              at block.c:2576
          #27 stream_prepare (job=0x55c9d495ead0) at block/stream.c:150
          ...
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200316060631.30052-2-vsementsov@virtuozzo.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      6e57963a
    • P
      block: Assert BlockDriver::format_name is not NULL · a15f08dc
      Philippe Mathieu-Daudé 提交于
      bdrv_do_find_format() calls strcmp() using BlockDriver::format_name
      as argument, which must not be NULL. Assert this field is not null
      when we register a block driver in bdrv_register().
      Reported-by: NMansour Ahmadi <ManSoSec@gmail.com>
      Signed-off-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200318222235.23856-1-philmd@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      a15f08dc
    • E
      block: Avoid memleak on qcow2 image info failure · 71eaec2e
      Eric Blake 提交于
      If we fail to get bitmap info, we must not leak the encryption info.
      
      Fixes: b8968c87
      Fixes: Coverity CID 1421894
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20200320183620.1112123-1-eblake@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: NAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
      Tested-by: NAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      71eaec2e
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-5.0-20200324' into staging · 09a98dd9
      Peter Maydell 提交于
      ppc patch queue for 2020-03-24
      
      Here's a final pull request before the qemu-5.0 hard freeze.
      
      We have an implementation of the POWER9 forms of the slbia
      instruction, a small cleanup and a handful of assorted fixes.
      
      # gpg: Signature made Tue 24 Mar 2020 05:12:30 GMT
      # gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-5.0-20200324:
        ppc/ppc405_boards: Remove unnecessary NULL check
        hw/ppc: Take QEMU lock when calling ppc_dcr_read/write()
        spapr: Fix memory leak in h_client_architecture_support()
        target/ppc: don't byte swap ELFv2 signal handler
        target/ppc: Fix ISA v3.0 (POWER9) slbia implementation
        target/ppc: Fix slbia TLB invalidation gap
        ppc/spapr: Set the effective address provided flag in mc error log.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      09a98dd9
    • P
      ppc/ppc405_boards: Remove unnecessary NULL check · 1583794b
      Philippe Mathieu-Daudé 提交于
      This code is inside the "if (dinfo)" condition, so testing
      again here whether it is NULL is unnecessary.
      
      Fixes: dd59bcae (Don't size flash memory to match backing image)
      Reported-by: Coverity (CID 1421917)
      Suggested-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200320155740.5342-1-philmd@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      1583794b
    • P
      hw/ppc: Take QEMU lock when calling ppc_dcr_read/write() · 235352ee
      Peter Maydell 提交于
      The ppc_dcr_read() and ppc_dcr_write() functions call into callbacks
      in device code, so we need to hold the QEMU iothread lock while
      calling them.  This is the case already for the callsites in
      kvmppc_handle_dcr_read/write(), but we must also take the lock when
      calling the helpers from TCG.
      
      This fixes a bug where attempting to initialise the PPC405EP
      SDRAM will cause an assertion when sdram_map_bcr() attempts
      to remap memory regions.
      Reported-by: NAmit Lazar <abasarlaz@hotmail.com>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-Id: <20200322192258.14039-1-peter.maydell@linaro.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      235352ee
    • G
      spapr: Fix memory leak in h_client_architecture_support() · ce05fa0f
      Greg Kurz 提交于
      This is the only error path that needs to free the previously allocated
      ov1.
      
      Reported-by: Coverity (CID 1421924)
      Fixes: cbd0d7f3 "spapr: Fail CAS if option vector table cannot be parsed"
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <158481206205.336182.16106097429336044843.stgit@bahia.lan>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      ce05fa0f
    • V
      target/ppc: don't byte swap ELFv2 signal handler · feb39b62
      Vincent Fazio 提交于
      Previously, the signal handler would be byte swapped if the target and
      host CPU used different endianness. This would cause a SIGSEGV when
      attempting to translate the opcode pointed to by the swapped address.
      
       Thread 1 "qemu-ppc64" received signal SIGSEGV, Segmentation fault.
       0x00000000600a9257 in ldl_he_p (ptr=0x4c2c061000000000) at qemu/include/qemu/bswap.h:351
       351        __builtin_memcpy(&r, ptr, sizeof(r));
      
       #0  0x00000000600a9257 in ldl_he_p (ptr=0x4c2c061000000000) at qemu/include/qemu/bswap.h:351
       #1  0x00000000600a92fe in ldl_be_p (ptr=0x4c2c061000000000) at qemu/include/qemu/bswap.h:449
       #2  0x00000000600c0790 in translator_ldl_swap at qemu/include/exec/translator.h:201
       #3  0x000000006011c1ab in ppc_tr_translate_insn at qemu/target/ppc/translate.c:7856
       #4  0x000000006005ae70 in translator_loop at qemu/accel/tcg/translator.c:102
      
      The signal handler will be byte swapped as a result of the __get_user()
      call in sigaction() if it is necessary, no additional swap is required.
      Signed-off-by: NVincent Fazio <vfazio@gmail.com>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <20200319133244.8818-1-vfazio@xes-inc.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      feb39b62
    • N
      target/ppc: Fix ISA v3.0 (POWER9) slbia implementation · 0418bf78
      Nicholas Piggin 提交于
      The new ISA v3.0 slbia variants have not been implemented for TCG,
      which can lead to crashing when a POWER9 machine boots Linux using
      the hash MMU, for example ("disable_radix" kernel command line).
      
      Add them.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Message-Id: <20200319064439.1020571-1-npiggin@gmail.com>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      [dwg: Fixed compile error for USER_ONLY builds]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      0418bf78
    • N
      target/ppc: Fix slbia TLB invalidation gap · f9e3e1a3
      Nicholas Piggin 提交于
      slbia must invalidate TLBs even if it does not remove a valid SLB
      entry, because slbmte can overwrite valid entries without removing
      their TLBs.
      
      As the architecture says, slbia invalidates all lookaside information,
      not conditionally based on if it removed valid entries.
      
      It does not seem possible for POWER8 or earlier Linux kernels to hit
      this bug because it never changes its kernel SLB translations, and it
      should always have valid entries if any accesses are made to userspace
      regions. However other operating systems which may modify SLB entry 0
      or do more fancy things with segments might be affected.
      
      When POWER9 slbia support is added in the next patch, this becomes a
      real problem because some new slbia variants don't invalidate all
      non-zero entries.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Message-Id: <20200318044135.851716-1-npiggin@gmail.com>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      f9e3e1a3
    • M
      ppc/spapr: Set the effective address provided flag in mc error log. · cb9fb64d
      Mahesh Salgaonkar 提交于
      Per PAPR, it is expected to set effective address provided flag in
      sub_err_type member of mc extended error log (i.e
      rtas_event_log_v6_mc.sub_err_type). This somehow got missed in original
      fwnmi-mce patch series. The current code just updates the effective address
      but does not set the flag to indicate that it is available. Hence guest
      fails to extract effective address from mce rtas log. This patch fixes
      that.
      
      Without this patch guest MCE logs fails print DAR value:
      
      [   11.933608] Disabling lock debugging due to kernel taint
      [   11.933773] MCE: CPU0: machine check (Severe) Host TLB Multihit [Recovered]
      [   11.933979] MCE: CPU0: NIP: [c000000000090b34] radix__flush_tlb_range_psize+0x194/0xf00
      [   11.934223] MCE: CPU0: Initiator CPU
      [   11.934341] MCE: CPU0: Unknown
      
      After the change:
      
      [   22.454149] Disabling lock debugging due to kernel taint
      [   22.454316] MCE: CPU0: machine check (Severe) Host TLB Multihit DAR: deadbeefdeadbeef [Recovered]
      [   22.454605] MCE: CPU0: NIP: [c0000000003e5804] kmem_cache_alloc+0x84/0x330
      [   22.454820] MCE: CPU0: Initiator CPU
      [   22.454944] MCE: CPU0: Unknown
      Signed-off-by: NMahesh Salgaonkar <mahesh@linux.ibm.com>
      Message-Id: <158451653844.22972.17999316676230071087.stgit@jupiter>
      Reviewed-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      cb9fb64d
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging · f1e748d2
      Peter Maydell 提交于
      Pull request
      
      # gpg: Signature made Mon 23 Mar 2020 19:24:02 GMT
      # gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
      # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8
      
      * remotes/stefanha/tags/block-pull-request:
        aio-posix: fix io_uring with external events
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      f1e748d2
    • P
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200323' into staging · c532b954
      Peter Maydell 提交于
      target-arm queue:
       * target/arm: avoid undefined behaviour shift in watchpoint code
       * target/arm: avoid undefined behaviour shift in handle_simd_dupe()
       * target/arm: add assert that immh != 0 in disas_simd_shift_imm()
       * aspeed/smc: Fix DMA support for AST2600
       * hw/arm/bcm283x: Correct the license text ('and' vs 'or')
      
      # gpg: Signature made Mon 23 Mar 2020 17:38:59 GMT
      # gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
      # gpg:                issuer "peter.maydell@linaro.org"
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20200323:
        target/arm: Move computation of index in handle_simd_dupe
        target/arm: Assert immh != 0 in disas_simd_shift_imm
        target/arm: Rearrange disabled check for watchpoints
        aspeed/smc: Fix DMA support for AST2600
        hw/arm/bcm283x: Correct the license text
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c532b954