- hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/display/virtio-gpu: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/virtio: Introduce virtio_bh_new_guarded() helper - hw: replace most qemu_bh_new calls with qemu_bh_new_guarded - checkpatch: add qemu_bh_new/aio_bh_new checks - async: avoid use-after-free on re-entrancy guard - async: Add an optional reentrancy guard to the BH API - hw/sd/sdhci: Do not update TRNMOD when Command Inhibit (DAT) is set(CVE-2024-3447) - rtl8139: Remove unused variable - tulip: Remove unused variable - virtio-mem: Fix the bitmap index of the section offset - virtio-mem: Fix the iterator variable in a vmem->rdl_list loop - system/memory: use ldn_he_p/stn_he_p - block: Fix crash when loading snapshot on inactive node - smmu: Clear SMMUPciBus pointer cache when system reset - block/mirror: Fix NULL s->job in active writes - amd_iommu: Fix APIC address check - virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_reques - libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick cherry-pick from 66e411885a23c96ff73742d06b793fec3ceaebb7 - ivshmem-test.c: enable test_ivshmem_server for ppc64 arch - ivshmem.c: change endianness to LITTLE_ENDIAN - hw/ppc/mac.h: Remove MAX_CPUS macro - configure: remove dead variables - virtio-gpu: do not byteswap padding - hw/intc: clean-up error reporting for failed ITS cmd - qemu-iotests: Discard stderr when probing devices - linux-user: un-parent OBJECT(cpu) when closing thread - hw/net/rocker: Avoid undefined shifts with more than 31 ports - contrib/vhost-user-blk: Clean up deallocation of VuVirtqElement - scsi-disk: fix overflow when block size is not a multiple of BDRV_SECTOR_SIZE Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit bf54b48c2963c869dfdc89977c57be4bd9e772aa)
57 lines
2.4 KiB
Diff
57 lines
2.4 KiB
Diff
From b2120f0a316470369451103d9d1b50b2d13cd68b Mon Sep 17 00:00:00 2001
|
|
From: Luo Yifan <luoyifan_yewu@cmss.chinamobile.com>
|
|
Date: Thu, 28 Mar 2024 13:58:20 +0800
|
|
Subject: [PATCH] ivshmem.c: change endianness to LITTLE_ENDIAN
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
cherry picked from commit ef80a708b57ddc8f605d9982bfaa0536e720ed9f
|
|
|
|
The ivshmem device, as with most PCI devices, uses little endian byte
|
|
order. However, the endianness of its mmio_ops is marked as
|
|
DEVICE_NATIVE_ENDIAN. This presents not only the usual problems with big
|
|
endian hosts but also with PowerPC little endian hosts as well, since
|
|
the Power architecture in QEMU uses big endian hardware (XIVE controller,
|
|
PCI Host Bridges, etc) even if the host is in little endian byte order.
|
|
|
|
As it is today, the IVPosition of the device will be byte swapped when
|
|
running in Power BE and LE. This can be seen by changing the existing
|
|
qtest 'ivshmem-test' to run in ppc64 hosts and printing the IVPOSITION
|
|
regs in test_ivshmem_server() right after the VM ids assert. For x86_64
|
|
the VM id values read are '0' and '1', for ppc64 (tested in a Power8
|
|
RHEL 7.9 BE server) and ppc64le (tested in a Power9 RHEL 8.6 LE server)
|
|
the ids will be '0' and '0x1000000'.
|
|
|
|
Change this device to LITTLE_ENDIAN fixes the issue for Power hosts of
|
|
both endianness, and every other big-endian architecture that might use
|
|
this device, without impacting x86 users.
|
|
|
|
Fixes: cb06608e17f8 ("ivshmem: convert to memory API")
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/168
|
|
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
Message-Id: <20211124092948.335389-2-danielhb413@gmail.com>
|
|
Signed-off-by: Cédric Le Goater <clg@kaod.org>
|
|
Signed-off-by: Luo Yifan <luoyifan_yewu@cmss.chinamobile.com>
|
|
---
|
|
hw/misc/ivshmem.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
|
|
index 05f06ed6cf..4093c59079 100644
|
|
--- a/hw/misc/ivshmem.c
|
|
+++ b/hw/misc/ivshmem.c
|
|
@@ -243,7 +243,7 @@ static uint64_t ivshmem_io_read(void *opaque, hwaddr addr,
|
|
static const MemoryRegionOps ivshmem_mmio_ops = {
|
|
.read = ivshmem_io_read,
|
|
.write = ivshmem_io_write,
|
|
- .endianness = DEVICE_NATIVE_ENDIAN,
|
|
+ .endianness = DEVICE_LITTLE_ENDIAN,
|
|
.impl = {
|
|
.min_access_size = 4,
|
|
.max_access_size = 4,
|
|
--
|
|
2.27.0
|
|
|