1. 28 3月, 2019 1 次提交
  2. 04 12月, 2018 3 次提交
  3. 03 12月, 2018 1 次提交
  4. 27 11月, 2018 2 次提交
    • M
      vhost-user-bridge: fix recvmsg iovlen · 8f1d22d9
      Marc-André Lureau 提交于
      After iov_discard_front(), the iov may be smaller than its initial
      size. Fixes the heap-buffer-overflow spotted by ASAN:
      
      ==9036==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000001e0 at pc 0x7fe632eca3f0 bp 0x7ffddc4a05a0 sp 0x7ffddc49fd48
      WRITE of size 32 at 0x6060000001e0 thread T0
          #0 0x7fe632eca3ef  (/lib64/libasan.so.5+0x773ef)
          #1 0x7fe632ecad23 in __interceptor_recvmsg (/lib64/libasan.so.5+0x77d23)
          #2 0x561e7491936b in vubr_backend_recv_cb /home/elmarco/src/qemu/tests/vhost-user-bridge.c:333
          #3 0x561e74917711 in dispatcher_wait /home/elmarco/src/qemu/tests/vhost-user-bridge.c:160
          #4 0x561e7491c3b5 in vubr_run /home/elmarco/src/qemu/tests/vhost-user-bridge.c:725
          #5 0x561e7491c85c in main /home/elmarco/src/qemu/tests/vhost-user-bridge.c:806
          #6 0x7fe631a6c412 in __libc_start_main (/lib64/libc.so.6+0x24412)
          #7 0x561e7491667d in _start (/home/elmarco/src/qemu/build/tests/vhost-user-bridge+0x3967d)
      
      0x6060000001e0 is located 0 bytes to the right of 64-byte region [0x6060000001a0,0x6060000001e0)
      allocated by thread T0 here:
          #0 0x7fe632f42848 in __interceptor_malloc (/lib64/libasan.so.5+0xef848)
          #1 0x561e7493acd8 in virtqueue_alloc_element /home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:1848
          #2 0x561e7493c2a8 in vu_queue_pop /home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:1954
          #3 0x561e749189bf in vubr_backend_recv_cb /home/elmarco/src/qemu/tests/vhost-user-bridge.c:297
          #4 0x561e74917711 in dispatcher_wait /home/elmarco/src/qemu/tests/vhost-user-bridge.c:160
          #5 0x561e7491c3b5 in vubr_run /home/elmarco/src/qemu/tests/vhost-user-bridge.c:725
          #6 0x561e7491c85c in main /home/elmarco/src/qemu/tests/vhost-user-bridge.c:806
          #7 0x7fe631a6c412 in __libc_start_main (/lib64/libc.so.6+0x24412)
      
      SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib64/libasan.so.5+0x773ef)
      Shadow bytes around the buggy address:
        0x0c0c7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c0c7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c0c7fff8000: fa fa fa fa 00 00 00 00 00 00 05 fa fa fa fa fa
        0x0c0c7fff8010: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd
        0x0c0c7fff8020: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
      =>0x0c0c7fff8030: fa fa fa fa 00 00 00 00 00 00 00 00[fa]fa fa fa
        0x0c0c7fff8040: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
        0x0c0c7fff8050: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
        0x0c0c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c0c7fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c0c7fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20181109173028.3372-1-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo BOnzini <pbonzini@redhat.com>
      8f1d22d9
    • K
      iotests: Test migration with -blockdev · 330ca111
      Kevin Wolf 提交于
      Check that block node activation and inactivation works with a block
      graph that is built with individually created nodes.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      330ca111
  5. 23 11月, 2018 3 次提交
    • A
      block: Update BlockDriverState.inherits_from on bdrv_drop_intermediate() · 6bd858b3
      Alberto Garcia 提交于
      The previous patch fixed the inherits_from pointer after block-stream,
      and this one does the same for block-commit.
      
      When block-commit finishes and the 'top' node is not the topmost one
      from the backing chain then all nodes above 'base' up to and including
      'top' are removed from the chain.
      
      The bdrv_drop_intermediate() call converts a chain like this one:
      
          base <- intermediate <- top <- active
      
      into this one:
      
          base <- active
      
      In a simple scenario each backing file from the first chain has the
      inherits_from attribute pointing to its parent. This means that
      reopening 'active' will recursively reopen all its children, whose
      options can be changed in the process.
      
      However after the 'block-commit' call base.inherits_from is NULL and
      the chain is broken, so 'base' does not inherit from 'active' and will
      not be reopened automatically:
      
         $ qemu-img create -f qcow2 hd0.qcow2 1M
         $ qemu-img create -f qcow2 -b hd0.qcow2 hd1.qcow2
         $ qemu-img create -f qcow2 -b hd1.qcow2 hd2.qcow2
         $ $QEMU -drive if=none,file=hd2.qcow2
      
         { 'execute': 'block-commit',
           'arguments': {
             'device': 'none0',
             'top': 'hd1.qcow2' } }
      
         { 'execute': 'human-monitor-command',
           'arguments': {
              'command-line':
                'qemu-io none0 "reopen -o backing.l2-cache-size=2M"' } }
      
         { "return": "Cannot change the option 'backing.l2-cache-size'\r\n"}
      
      This patch updates base.inherits_from in this scenario, and adds a
      test case.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6bd858b3
    • A
      block: Update BlockDriverState.inherits_from on bdrv_set_backing_hd() · 0065c455
      Alberto Garcia 提交于
      When a BlockDriverState's child is opened (be it a backing file, the
      protocol layer, or any other) inherits_from is set to point to the
      parent node. Children opened separately and then attached to a parent
      don't have this pointer set.
      
      bdrv_reopen_queue_child() uses this to determine whether a node's
      children must also be reopened inheriting the options from the parent
      or not. If inherits_from points to the parent then the child is
      reopened and its options can be changed, like in this example:
      
         $ qemu-img create -f qcow2 hd0.qcow2 1M
         $ qemu-img create -f qcow2 hd1.qcow2 1M
         $ $QEMU -drive if=none,node-name=hd0,file=hd0.qcow2,\
                        backing.driver=qcow2,backing.file.filename=hd1.qcow2
         (qemu) qemu-io hd0 "reopen -o backing.l2-cache-size=2M"
      
      If the child does not inherit from the parent then it does not get
      reopened and its options cannot be changed:
      
         $ $QEMU -drive if=none,node-name=hd1,file=hd1.qcow2
                 -drive if=none,node-name=hd0,file=hd0.qcow2,backing=hd1
         (qemu) qemu-io hd0 "reopen -o backing.l2-cache-size=2M"
         Cannot change the option 'backing.l2-cache-size'
      
      If a disk image has a chain of backing files then all of them are also
      connected through their inherits_from pointers (i.e. it's possible to
      walk the chain in reverse order from base to top).
      
      However this is broken if the intermediate nodes are removed using
      e.g. block-stream because the inherits_from pointer from the base node
      becomes NULL:
      
         $ qemu-img create -f qcow2 hd0.qcow2 1M
         $ qemu-img create -f qcow2 -b hd0.qcow2 hd1.qcow2
         $ qemu-img create -f qcow2 -b hd1.qcow2 hd2.qcow2
         $ $QEMU -drive if=none,file=hd2.qcow2
         (qemu) qemu-io none0 "reopen -o backing.l2-cache-size=2M"
         (qemu) block_stream none0 0 hd0.qcow2
         (qemu) qemu-io none0 "reopen -o backing.l2-cache-size=2M"
         Cannot change the option 'backing.l2-cache-size'
      
      This patch updates the inherits_from pointer if the intermediate nodes
      of a backing chain are removed using bdrv_set_backing_hd(), and adds a
      test case for this scenario.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0065c455
    • E
      iotests: Enhance 223 to cover multiple bitmap granularities · a237dea3
      Eric Blake 提交于
      Testing granularity at the same size as the cluster isn't quite
      as fun as what happens when it is larger or smaller.  This
      enhancement also shows that qemu's nbd server can serve the
      same disk over multiple exports simultaneously.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Tested-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a237dea3
  6. 22 11月, 2018 2 次提交
  7. 21 11月, 2018 3 次提交
  8. 20 11月, 2018 12 次提交
  9. 19 11月, 2018 2 次提交
  10. 15 11月, 2018 1 次提交
  11. 14 11月, 2018 1 次提交
  12. 13 11月, 2018 2 次提交
  13. 12 11月, 2018 1 次提交
  14. 06 11月, 2018 5 次提交
    • E
      tests: Fix Python 3 detection on older GNU make versions · 0ca70f19
      Eduardo Habkost 提交于
      The $(SHELLSTATUS) variable requires GNU make >= 4.2, but Travis
      seems to provide an older version.  Change the existing rules to
      use command output instead of exit code, to make it compatible
      with older GNU make versions.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      0ca70f19
    • L
      tests/bios-tables-test: add 64-bit PCI MMIO aperture round-up test on Q35 · 0259e966
      Laszlo Ersek 提交于
      In commit 9fa99d25 ("hw/pci-host: Fix x86 Host Bridges 64bit PCI
      hole", 2017-11-16), we meant to expose such a 64-bit PCI MMIO aperture in
      the ACPI DSDT that would be at least as large as the new "pci-hole64-size"
      property (2GB on i440fx, 32GB on q35). The goal was to offer "enough"
      64-bit MMIO aperture to the guest OS for hotplug purposes.
      
      Previous patch fixed the issue that the aperture is extended relative to
      a possibly incorrect base.  This may result in an aperture size that is
      smaller than the intent of commit 9fa99d25.
      
      This patch adds a test to make sure it won't happen again.
      
      In the test case being added:
      - use 128 MB initial RAM size,
      - ask for one DIMM hotplug slot,
      - ask for 2 GB maximum RAM size,
      - use a pci-testdev with a 64-bit BAR of 2 GB size.
      
      Consequences:
      
      (1) In pc_memory_init() [hw/i386/pc.c], the DIMM hotplug area size is
          initially set to 2048-128 = 1920 MB. (Maximum RAM size minus initial
          RAM size.)
      
      (2) The DIMM area base is set to 4096 MB (because the initial RAM is only
          128 MB -- there is no initial "high RAM").
      
      (3) Due to commit 085f8e88 ("pc: count in 1Gb hugepage alignment when
          sizing hotplug-memory container", 2014-11-24), we add 1 GB for the one
          DIMM hotplug slot that was specified. This sets the DIMM area size to
          1920+1024 = 2944 MB.
      
      (4) The reserved-memory-end address (exclusive) is set to 4096 + 2944 =
          7040 MB (DIMM area base plus DIMM area size).
      
      (5) The reserved-memory-end address is rounded up to GB alignment,
          yielding 7 GB (7168 MB).
      
      (6) Given the 2 GB BAR size of pci-testdev, SeaBIOS allocates said 64-bit
          BAR in 64-bit address space.
      
      (7) Because reserved-memory-end is at 7 GB, it is unaligned for the 2 GB
          BAR. Therefore SeaBIOS allocates the BAR at 8 GB. QEMU then
          (correctly) assigns the root bridge aperture base this BAR address, to
          be exposed in \_SB.PCI0._CRS.
      
      (8) The intent of commit 9fa99d25 dictates that QEMU extend the
          aperture size to 32 GB, implying a 40 GB end address. However, QEMU
          performs the extension relative to reserved-memory-end (7 GB), not
          relative to the bridge aperture base that was correctly deduced from
          SeaBIOS's BAR programming (8 GB). Therefore we see 39 GB as the
          aperture end address in \_SB.PCI0._CRS:
      
      > QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
      >     0x0000000000000000, // Granularity
      >     0x0000000200000000, // Range Minimum
      >     0x00000009BFFFFFFF, // Range Maximum
      >     0x0000000000000000, // Translation Offset
      >     0x00000007C0000000, // Length
      >     ,, , AddressRangeMemory, TypeStatic)
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      0259e966
    • M
      bios-tables-test: prepare expected files for mmio64 · f5f4002d
      Michael S. Tsirkin 提交于
      test will be added by follow-up patch.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      f5f4002d
    • P
      tests: Move tests/hex-loader-check-data/ to tests/data/hex-loader/ · 4b2ff65a
      Peter Maydell 提交于
      Currently tests/hex-loader-check-data contains data files used
      by the hexloader-test, and configure individually symlinks those
      data files into the build directory using a wildcard.
      
      Using a wildcard like this is a bad idea, because if a new
      data file is added, nothing causes configure to be rerun,
      and so no symlink is added for the new file. This can cause
      tests to spuriously fail when they can't find their data.
      Instead, it's better to symlink an entire directory of
      data files. We already have such a directory: tests/data.
      
      Move the data files from tests/hex-loader-check-data/ to
      tests/data/hex-loader/, and remove the unnecessary symlinking.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      4b2ff65a
    • P
      tests: Move tests/acpi-test-data/ to tests/data/acpi/ · 438c78da
      Peter Maydell 提交于
      Currently tests/acpi-test-data contains data files used by the
      bios-tables-test, and configure individually symlinks those
      data files into the build directory using a wildcard.
      
      Using a wildcard like this is a bad idea, because if a new
      data file is added, nothing causes configure to be rerun,
      and so no symlink is added for the new file. This can cause
      tests to spuriously fail when they can't find their data.
      Instead, it's better to symlink an entire directory of
      data files. We already have such a directory: tests/data.
      
      Move the data files from tests/acpi-test-data/ to
      tests/data/acpi/, and remove the unnecessary symlinking.
      
      We can remove entirely the note in rebuild-expected-aml.sh
      about copying any new data files, because now they will
      be in the source directory, not the build directory, and
      no copying is required.
      
      (We can't just change the existing tests/acpi-test-data/
      to being a symlinked directory, because if we did that and
      a developer switched git branches from one after that change
      to one before it then configure would end up trashing all
      the test files by making them symlinks to themselves.
      Changing their path avoids this annoyance.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      438c78da
  15. 05 11月, 2018 1 次提交
    • M
      option: Make option help nicer to read · 63898712
      Max Reitz 提交于
      This adds some whitespace into the option help (including indentation)
      and puts angle brackets around the type names.  Furthermore, the list
      name is no longer printed as part of every line, but only once in
      advance, and only if the caller did not print a caption already.
      
      This patch also restores the description alignment we had before commit
      9cbef9d6, just at 24 instead of 16 characters like we used to.
      This increase is because now we have the type and two spaces of
      indentation before the description, and with a usual type name length of
      three chracters, this sums up to eight additional characters -- which
      means that we now need 24 characters to get the same amount of padding
      for most options.  Also, 24 is a third of 80, which makes it kind of a
      round number in terminal terms.
      
      Finally, this patch amends the reference output of iotest 082 to match
      the changes (and thus makes it pass again).
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      63898712