Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: 3e2e46248722
Choose a base ref
...
head repository: qemu/qemu
compare: 9d52aaa92bd8
Choose a head ref
  • 5 commits
  • 6 files changed
  • 5 contributors

Commits on May 28, 2023

  1. rtl8139: fix large_send_mss divide-by-zero

    If the driver sets large_send_mss to 0 then a divide-by-zero occurs.
    Even if the division wasn't a problem, the for loop that emits MSS-sized
    packets would never terminate.
    
    Solve these issues by skipping offloading when large_send_mss=0.
    
    This issue was found by OSS-Fuzz as part of Alexander Bulekov's device
    fuzzing work. The reproducer is:
    
      $ cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
      512M,slots=1,maxmem=0xffff000000000000 -machine q35 -nodefaults -device \
      rtl8139,netdev=net0 -netdev user,id=net0 -device \
      pc-dimm,id=nv1,memdev=mem1,addr=0xb800a64602800000 -object \
      memory-backend-ram,id=mem1,size=2M  -qtest stdio
      outl 0xcf8 0x80000814
      outl 0xcfc 0xe0000000
      outl 0xcf8 0x80000804
      outw 0xcfc 0x06
      write 0xe0000037 0x1 0x04
      write 0xe00000e0 0x2 0x01
      write 0x1 0x1 0x04
      write 0x3 0x1 0x98
      write 0xa 0x1 0x8c
      write 0xb 0x1 0x02
      write 0xc 0x1 0x46
      write 0xd 0x1 0xa6
      write 0xf 0x1 0xb8
      write 0xb800a646028c000c 0x1 0x08
      write 0xb800a646028c000e 0x1 0x47
      write 0xb800a646028c0010 0x1 0x02
      write 0xb800a646028c0017 0x1 0x06
      write 0xb800a646028c0036 0x1 0x80
      write 0xe00000d9 0x1 0x40
      EOF
    
    Buglink: https://gitlab.com/qemu-project/qemu/-/issues/1582
    Closes: https://gitlab.com/qemu-project/qemu/-/issues/1582
    Cc: qemu-stable@nongnu.org
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Fixes: 6d71357 ("rtl8139: honor large send MSS value")
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Tested-by: Alexander Bulekov <alxndr@bu.edu>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit 792676c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Stefan Hajnoczi authored and Michael Tokarev committed May 28, 2023
    Copy the full SHA
    859759e View commit details
    Browse the repository at this point in the history
  2. util/vfio-helpers: Use g_file_read_link()

    When _FORTIFY_SOURCE=2, glibc version is 2.35, and GCC version is
    12.1.0, the compiler complains as follows:
    
    In file included from /usr/include/features.h:490,
                     from /usr/include/bits/libc-header-start.h:33,
                     from /usr/include/stdint.h:26,
                     from /usr/lib/gcc/aarch64-unknown-linux-gnu/12.1.0/include/stdint.h:9,
                     from /home/alarm/q/var/qemu/include/qemu/osdep.h:94,
                     from ../util/vfio-helpers.c:13:
    In function 'readlink',
        inlined from 'sysfs_find_group_file' at ../util/vfio-helpers.c:116:9,
        inlined from 'qemu_vfio_init_pci' at ../util/vfio-helpers.c:326:18,
        inlined from 'qemu_vfio_open_pci' at ../util/vfio-helpers.c:517:9:
    /usr/include/bits/unistd.h:119:10: error: argument 2 is null but the corresponding size argument 3 value is 4095 [-Werror=nonnull]
      119 |   return __glibc_fortify (readlink, __len, sizeof (char),
          |          ^~~~~~~~~~~~~~~
    
    This error implies the allocated buffer can be NULL. Use
    g_file_read_link(), which allocates buffer automatically to avoid the
    error.
    
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    (cherry picked from commit dbdea0d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    akihikodaki authored and Michael Tokarev committed May 28, 2023
    Copy the full SHA
    12f0e61 View commit details
    Browse the repository at this point in the history
  3. usb/ohci: Set pad to 0 after frame update

    When the OHCI controller's framenumber is incremented, HccaPad1 register
    should be set to zero (Ref OHCI Spec 4.4)
    
    ReactOS uses hccaPad1 to determine if the OHCI hardware is running,
    consequently it fails this check in current qemu master.
    
    Signed-off-by: Ryan Wendland <wendland@live.com.au>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1048
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 6301460)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    bonzini authored and Michael Tokarev committed May 28, 2023
    Copy the full SHA
    49d5fc4 View commit details
    Browse the repository at this point in the history
  4. hw/scsi/lsi53c895a: Fix reentrancy issues in the LSI controller (CVE-…

    …2023-0330)
    
    We cannot use the generic reentrancy guard in the LSI code, so
    we have to manually prevent endless reentrancy here. The problematic
    lsi_execute_script() function has already a way to detect whether
    too many instructions have been executed - we just have to slightly
    change the logic here that it also takes into account if the function
    has been called too often in a reentrant way.
    
    The code in fuzz-lsi53c895a-test.c has been taken from an earlier
    patch by Mauro Matteo Cascella.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1563
    Message-Id: <20230522091011.1082574-1-thuth@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit b987718)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    huth authored and Michael Tokarev committed May 28, 2023
    Copy the full SHA
    9fe6e81 View commit details
    Browse the repository at this point in the history
  5. machine: do not crash if default RAM backend name has been stolen

    QEMU aborts when default RAM backend should be used (i.e. no
    explicit '-machine memory-backend=' specified) but user
    has created an object which 'id' equals to default RAM backend
    name used by board.
    
     $QEMU -machine pc \
           -object memory-backend-ram,id=pc.ram,size=4294967296
    
     Actual results:
     QEMU 7.2.0 monitor - type 'help' for more information
     (qemu) Unexpected error in object_property_try_add() at ../qom/object.c:1239:
     qemu-kvm: attempt to add duplicate property 'pc.ram' to object (type 'container')
     Aborted (core dumped)
    
    Instead of abort, check for the conflicting 'id' and exit with
    an error, suggesting how to remedy the issue.
    
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2207886
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20230522131717.3780533-1-imammedo@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit a37531f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Igor Mammedov authored and Michael Tokarev committed May 28, 2023
    Copy the full SHA
    9d52aaa View commit details
    Browse the repository at this point in the history