Skip to content
Snippets Groups Projects
  1. May 28, 2022
  2. May 26, 2022
  3. May 25, 2022
  4. May 23, 2022
  5. May 19, 2022
    • Peter Maydell's avatar
      ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY · 9598c1bb
      Peter Maydell authored
      
      The traditional ptimer behaviour includes a collection of weird edge
      case behaviours.  In 2016 we improved the ptimer implementation to
      fix these and generally make the behaviour more flexible, with
      ptimers opting in to the new behaviour by passing an appropriate set
      of policy flags to ptimer_init().  For backwards-compatibility, we
      defined PTIMER_POLICY_DEFAULT (which sets no flags) to give the old
      weird behaviour.
      
      This turns out to be a poor choice of name, because people writing
      new devices which use ptimers are misled into thinking that the
      default is probably a sensible choice of flags, when in fact it is
      almost always not what you want.  Rename PTIMER_POLICY_DEFAULT to
      PTIMER_POLICY_LEGACY and beef up the comment to more clearly say that
      new devices should not be using it.
      
      The code-change part of this commit was produced by
        sed -i -e 's/PTIMER_POLICY_DEFAULT/PTIMER_POLICY_LEGACY/g' $(git grep -l PTIMER_POLICY_DEFAULT)
      with the exception of a test name string change in
      tests/unit/ptimer-test.c which was added manually.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarFrancisco Iglesias <francisco.iglesias@amd.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20220516103058.162280-1-peter.maydell@linaro.org
      9598c1bb
  6. May 18, 2022
  7. May 16, 2022
  8. May 13, 2022
  9. May 12, 2022
    • Paolo Bonzini's avatar
      qemu-iotests: inline common.config into common.rc · f7062529
      Paolo Bonzini authored
      
      common.rc has some complicated logic to find the common.config that
      dates back to xfstests and is completely unnecessary now.  Just include
      the contents of the file.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20220505094723.732116-1-pbonzini@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      f7062529
    • Eric Blake's avatar
      nbd/server: Allow MULTI_CONN for shared writable exports · 58a6fdcc
      Eric Blake authored
      
      According to the NBD spec, a server that advertises
      NBD_FLAG_CAN_MULTI_CONN promises that multiple client connections will
      not see any cache inconsistencies: when properly separated by a single
      flush, actions performed by one client will be visible to another
      client, regardless of which client did the flush.
      
      We always satisfy these conditions in qemu - even when we support
      multiple clients, ALL clients go through a single point of reference
      into the block layer, with no local caching.  The effect of one client
      is instantly visible to the next client.  Even if our backend were a
      network device, we argue that any multi-path caching effects that
      would cause inconsistencies in back-to-back actions not seeing the
      effect of previous actions would be a bug in that backend, and not the
      fault of caching in qemu.  As such, it is safe to unconditionally
      advertise CAN_MULTI_CONN for any qemu NBD server situation that
      supports parallel clients.
      
      Note, however, that we don't want to advertise CAN_MULTI_CONN when we
      know that a second client cannot connect (for historical reasons,
      qemu-nbd defaults to a single connection while nbd-server-add and QMP
      commands default to unlimited connections; but we already have
      existing means to let either style of NBD server creation alter those
      defaults).  This is visible by no longer advertising MULTI_CONN for
      'qemu-nbd -r' without -e, as in the iotest nbd-qemu-allocation.
      
      The harder part of this patch is setting up an iotest to demonstrate
      behavior of multiple NBD clients to a single server.  It might be
      possible with parallel qemu-io processes, but I found it easier to do
      in python with the help of libnbd, and help from Nir and Vladimir in
      writing the test.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Suggested-by: default avatarNir Soffer <nsoffer@redhat.com>
      Suggested-by: default avatarVladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
      Message-Id: <20220512004924.417153-3-eblake@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      58a6fdcc
    • Philippe Mathieu-Daudé's avatar
      tests/qtest/fdc-test: Add a regression test for CVE-2021-3507 · 46609b90
      Philippe Mathieu-Daudé authored
      Add the reproducer from https://gitlab.com/qemu-project/qemu/-/issues/339
      
      
      
      Without the previous commit, when running 'make check-qtest-i386'
      with QEMU configured with '--enable-sanitizers' we get:
      
        ==4028352==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x619000062a00 at pc 0x5626d03c491a bp 0x7ffdb4199410 sp 0x7ffdb4198bc0
        READ of size 786432 at 0x619000062a00 thread T0
            #0 0x5626d03c4919 in __asan_memcpy (qemu-system-i386+0x1e65919)
            #1 0x5626d1c023cc in flatview_write_continue softmmu/physmem.c:2787:13
            #2 0x5626d1bf0c0f in flatview_write softmmu/physmem.c:2822:14
            #3 0x5626d1bf0798 in address_space_write softmmu/physmem.c:2914:18
            #4 0x5626d1bf0f37 in address_space_rw softmmu/physmem.c:2924:16
            #5 0x5626d1bf14c8 in cpu_physical_memory_rw softmmu/physmem.c:2933:5
            #6 0x5626d0bd5649 in cpu_physical_memory_write include/exec/cpu-common.h:82:5
            #7 0x5626d0bd0a07 in i8257_dma_write_memory hw/dma/i8257.c:452:9
            #8 0x5626d09f825d in fdctrl_transfer_handler hw/block/fdc.c:1616:13
            #9 0x5626d0a048b4 in fdctrl_start_transfer hw/block/fdc.c:1539:13
            #10 0x5626d09f4c3e in fdctrl_write_data hw/block/fdc.c:2266:13
            #11 0x5626d09f22f7 in fdctrl_write hw/block/fdc.c:829:9
            #12 0x5626d1c20bc5 in portio_write softmmu/ioport.c:207:17
      
        0x619000062a00 is located 0 bytes to the right of 512-byte region [0x619000062800,0x619000062a00)
        allocated by thread T0 here:
            #0 0x5626d03c66ec in posix_memalign (qemu-system-i386+0x1e676ec)
            #1 0x5626d2b988d4 in qemu_try_memalign util/oslib-posix.c:210:11
            #2 0x5626d2b98b0c in qemu_memalign util/oslib-posix.c:226:27
            #3 0x5626d09fbaf0 in fdctrl_realize_common hw/block/fdc.c:2341:20
            #4 0x5626d0a150ed in isabus_fdc_realize hw/block/fdc-isa.c:113:5
            #5 0x5626d2367935 in device_set_realized hw/core/qdev.c:531:13
      
        SUMMARY: AddressSanitizer: heap-buffer-overflow (qemu-system-i386+0x1e65919) in __asan_memcpy
        Shadow bytes around the buggy address:
          0x0c32800044f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
          0x0c3280004500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
          0x0c3280004510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
          0x0c3280004520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
          0x0c3280004530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        =>0x0c3280004540:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
          0x0c3280004550: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
          0x0c3280004560: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
          0x0c3280004570: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
          0x0c3280004580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
          0x0c3280004590: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        Shadow byte legend (one shadow byte represents 8 application bytes):
          Addressable:           00
          Heap left redzone:       fa
          Freed heap region:       fd
        ==4028352==ABORTING
      
      [ kwolf: Added snapshot=on to prevent write file lock failure ]
      
      Reported-by: default avatarAlexander Bulekov <alxndr@bu.edu>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarAlexander Bulekov <alxndr@bu.edu>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      46609b90
    • Daniel P. Berrangé's avatar
      tests/qemu-iotests: print intent to run a test in TAP mode · 5e781c70
      Daniel P. Berrangé authored
      
      When running I/O tests using TAP output mode, we get a single TAP test
      with a sub-test reported for each I/O test that is run. The output looks
      something like this:
      
       1..123
       ok qcow2 011
       ok qcow2 012
       ok qcow2 013
       ok qcow2 217
       ...
      
      If everything runs or fails normally this is fine, but periodically we
      have been seeing the test harness abort early before all 123 tests have
      been run, just leaving a fairly useless message like
      
        TAP parsing error: Too few tests run (expected 123, got 107)
      
      we have no idea which tests were running at the time the test harness
      abruptly exited. This change causes us to print a message about our
      intent to run each test, so we have a record of what is active at the
      time the harness exits abnormally.
      
       1..123
       # running qcow2 011
       ok qcow2 011
       # running qcow2 012
       ok qcow2 012
       # running qcow2 013
       ok qcow2 013
       # running qcow2 217
       ok qcow2 217
       ...
      
      Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-Id: <20220509124134.867431-2-berrange@redhat.com>
      Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      5e781c70
    • Hanna Reitz's avatar
      iotests/testrunner: Flush after run_test() · 22d92e71
      Hanna Reitz authored
      
      When stdout is not a terminal, the buffer may not be flushed at each end
      of line, so we should flush after each test is done.  This is especially
      apparent when run by check-block, in two ways:
      
      First, when running make check-block -jX with X > 1, progress indication
      was missing, even though testrunner.py does theoretically print each
      test's status once it has been run, even in multi-processing mode.
      Flushing after each test restores this progress indication.
      
      Second, sometimes make check-block failed altogether, with an error
      message that "too few tests [were] run".  I presume that's because one
      worker process in the job pool did not get to flush its stdout before
      the main process exited, and so meson did not get to see that worker's
      test results.  In any case, by flushing at the end of run_test(), the
      problem has disappeared for me.
      
      Signed-off-by: default avatarHanna Reitz <hreitz@redhat.com>
      Message-Id: <20220506134215.10086-1-hreitz@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      22d92e71
    • Eric Auger's avatar
      tests/qtest/libqos: Add generic pci host bridge in arm-virt machine · 70be1d93
      Eric Auger authored
      
      Up to now the virt-machine node contains a virtio-mmio node.
      However no driver produces any PCI interface node. Hence, PCI
      tests cannot be run with aarch64 binary.
      
      Add a GPEX driver node that produces a pci interface node. This latter
      then can be consumed by all the pci tests. One of the first motivation
      was to be able to run the virtio-iommu-pci tests.
      
      We still face an issue with pci hotplug tests as hotplug cannot happen
      on the pcie root bus and require a generic root port. This will be
      addressed later on.
      
      We force cpu=max along with aarch64/virt machine as some PCI tests
      require high MMIO regions to be available.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      
      Message-Id: <20220504152025.1785704-4-eric.auger@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      70be1d93
    • Eric Auger's avatar
      tests/qtest/libqos: Skip hotplug tests if pci root bus is not hotpluggable · 02ee7a8a
      Eric Auger authored
      
      ARM does not not support hotplug on pcie.0. Add a flag on the bus
      which tells if devices can be hotplugged and skip hotplug tests
      if the bus cannot be hotplugged. This is a temporary solution to
      enable the other pci tests on aarch64.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Acked-by: default avatarThomas Huth <thuth@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      
      Message-Id: <20220504152025.1785704-3-eric.auger@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      02ee7a8a
    • Eric Auger's avatar
      tests/qtest/libqos/pci: Introduce pio_limit · 3df72d1c
      Eric Auger authored
      
      At the moment the IO space limit is hardcoded to
      QPCI_PIO_LIMIT = 0x10000. When accesses are performed to a bar,
      the base address of this latter is compared against the limit
      to decide whether we perform an IO or a memory access.
      
      On ARM, we cannot keep this PIO limit as the arm-virt machine
      uses [0x3eff0000, 0x3f000000 ] for the IO space map and we
      are mandated to allocate at 0x0.
      
      Add a new flag in QPCIBar indicating whether it is an IO bar
      or a memory bar. This flag is set on QPCIBar allocation and
      provisionned based on the BAR configuration. Then the new flag
      is used in access functions and in iomap() function.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20220504152025.1785704-2-eric.auger@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3df72d1c
  10. May 11, 2022
Loading