Skip to content
Snippets Groups Projects
  1. Jul 05, 2021
    • Feng Lin's avatar
      migration: fix the memory overwriting risk in add_to_iovec · c00d434a
      Feng Lin authored
      
      When testing migration, a Segmentation fault qemu core is generated.
      0  error_free (err=0x1)
      1  0x00007f8b862df647 in qemu_fclose (f=f@entry=0x55e06c247640)
      2  0x00007f8b8516d59a in migrate_fd_cleanup (s=s@entry=0x55e06c0e1ef0)
      3  0x00007f8b8516d66c in migrate_fd_cleanup_bh (opaque=0x55e06c0e1ef0)
      4  0x00007f8b8626a47f in aio_bh_poll (ctx=ctx@entry=0x55e06b5a16d0)
      5  0x00007f8b8626e71f in aio_dispatch (ctx=0x55e06b5a16d0)
      6  0x00007f8b8626a33d in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>)
      7  0x00007f8b866bdba4 in g_main_context_dispatch ()
      8  0x00007f8b8626cde9 in glib_pollfds_poll ()
      9  0x00007f8b8626ce62 in os_host_main_loop_wait (timeout=<optimized out>)
      10 0x00007f8b8626cffd in main_loop_wait (nonblocking=nonblocking@entry=0)
      11 0x00007f8b862ef01f in main_loop ()
      Using gdb print the struct QEMUFile f = {
        ...,
        iovcnt = 65, last_error = 21984,
        last_error_obj = 0x1, shutdown = true
      }
      Well iovcnt is overflow, because the max size of MAX_IOV_SIZE is 64.
      struct QEMUFile {
          ...;
          struct iovec iov[MAX_IOV_SIZE];
          unsigned int iovcnt;
          int last_error;
          Error *last_error_obj;
          bool shutdown;
      };
      iovcnt and last_error is overwrited by add_to_iovec().
      Right now, add_to_iovec() increase iovcnt before check the limit.
      And it seems that add_to_iovec() assumes that iovcnt will set to zero
      in qemu_fflush(). But qemu_fflush() will directly return when f->shutdown
      is true.
      
      The situation may occur when libvirtd restart during migration, after
      f->shutdown is set, before calling qemu_file_set_error() in
      qemu_file_shutdown().
      
      So the safiest way is checking the iovcnt before increasing it.
      
      Signed-off-by: default avatarFeng Lin <linfeng23@huawei.com>
      Message-Id: <20210625062138.1899-1-linfeng23@huawei.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
        Fix typo in 'writeable' which is actually misnamed 'writable'
      c00d434a
    • Peter Xu's avatar
      tests: migration-test: Add dirty ring test · 1f546b70
      Peter Xu authored
      
      Add dirty ring test if kernel supports it.  Add the dirty ring parameter on
      source should be mostly enough, but let's change the dest too to make them
      match always.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20210615175523.439830-3-peterx@redhat.com>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      1f546b70
  2. Jul 04, 2021
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/philmd/tags/mips-20210702' into staging · 711c0418
      Peter Maydell authored
      
      MIPS patches queue
      
      - Extract nanoMIPS, microMIPS, Code Compaction from translate.c
      - Allow PCI config accesses smaller than 32-bit on Bonito64 device
      - Fix migration of g364fb device on Jazz Magnum
      - Fix dp8393x PROM checksum on Jazz Magnum and Quadra 800
      - Map the UART devices unconditionally on Jazz Magnum
      - Add functional test booting Linux on the Fuloong 2E
      
      # gpg: Signature made Fri 02 Jul 2021 16:36:19 BST
      # gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
      # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
      # Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE
      
      * remotes/philmd/tags/mips-20210702:
        hw/mips/jazz: Map the UART devices unconditionally
        hw/mips/jazz: specify correct endian for dp8393x device
        hw/m68k/q800: fix PROM checksum and MAC address storage
        qemu/bitops.h: add bitrev8 implementation
        dp8393x: remove onboard PROM containing MAC address and checksum
        hw/m68k/q800: move PROM and checksum calculation from dp8393x device to board
        hw/mips/jazz: move PROM and checksum calculation from dp8393x device to board
        dp8393x: convert to trace-events
        dp8393x: checkpatch fixes
        g364fb: add VMStateDescription for G364SysBusState
        g364fb: use RAM memory region for framebuffer
        tests/acceptance: Test Linux on the Fuloong 2E machine
        hw/pci-host/bonito: Allow PCI config accesses smaller than 32-bit
        hw/pci-host/bonito: Trace PCI config accesses smaller than 32-bit
        target/mips: Extract nanoMIPS ISA translation routines
        target/mips: Extract the microMIPS ISA translation routines
        target/mips: Extract Code Compaction ASE translation routines
        target/mips: Add declarations for generic TCG helpers
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      711c0418
  3. Jul 03, 2021
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210702' into staging · 73c8bf4c
      Peter Maydell authored
      
      target-arm queue:
       * more MVE instructions
       * hw/gpio/gpio_pwr: use shutdown function for reboot
       * target/arm: Check NaN mode before silencing NaN
       * tests: Boot and halt a Linux guest on the Raspberry Pi 2 machine
       * hw/arm: Add basic power management to raspi.
       * docs/system/arm: Add quanta-gbs-bmc, quanta-q7l1-bmc
      
      # gpg: Signature made Fri 02 Jul 2021 13:59:19 BST
      # 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-20210702: (24 commits)
        target/arm: Implement MVE shifts by register
        target/arm: Implement MVE shifts by immediate
        target/arm: Implement MVE long shifts by register
        target/arm: Implement MVE long shifts by immediate
        target/arm: Implement MVE VADDLV
        target/arm: Implement MVE VSHLC
        target/arm: Implement MVE saturating narrowing shifts
        target/arm: Implement MVE VSHRN, VRSHRN
        target/arm: Implement MVE VSRI, VSLI
        target/arm: Implement MVE VSHLL
        target/arm: Implement MVE vector shift right by immediate insns
        target/arm: Implement MVE vector shift left by immediate insns
        target/arm: Implement MVE logical immediate insns
        target/arm: Use dup_const() instead of bitfield_replicate()
        target/arm: Use asimd_imm_const for A64 decode
        target/arm: Make asimd_imm_const() public
        target/arm: Fix bugs in MVE VRMLALDAVH, VRMLSLDAVH
        target/arm: Fix MVE widening/narrowing VLDR/VSTR offset calculation
        hw/gpio/gpio_pwr: use shutdown function for reboot
        target/arm: Check NaN mode before silencing NaN
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      73c8bf4c
  4. Jul 02, 2021
Loading