qemu/backends
Gavin Shan 78c8f780d3 hostmem: Apply merge property after the memory region is initialized
The semantic change has been introduced by commit 5becdc0ab0 ("hostmem:
simplify the code for merge and dump properties") even it clarifies that
no senmatic change has been introduced. After the commit, the merge
property can be applied even the corresponding memory region isn't
initialized yet. This leads to crash dump by the following command
lines.

  # /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64  \
    -accel kvm  -machine virt -cpu host                      \
    -object memory-backend-ram,id=mem-memN0,size=4096M,merge=off
    :
    qemu-system-aarch64: ../system/memory.c:2419: memory_region_get_ram_ptr: \
    Assertion `mr->ram_block' failed.

Fix it by applying the merge property only when the memory region is
initialized.

Message-ID: <20240915233117.478169-1-gshan@redhat.com>
Fixes: 5becdc0ab0 ("hostmem: simplify the code for merge and dump properties")
Reported-by: Zhenyu Zhang <zhenyzha@redhat.com>
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
2024-09-24 11:33:35 +02:00
..
tpm
confidential-guest-support.c
cryptodev-builtin.c
cryptodev-hmp-cmds.c
cryptodev-lkcf.c
cryptodev-vhost-user.c
cryptodev-vhost.c
cryptodev.c
dbus-vmstate1.xml
dbus-vmstate.c
host_iommu_device.c
hostmem-epc.c
hostmem-file.c
hostmem-memfd.c
hostmem-ram.c
hostmem-shm.c
hostmem.c hostmem: Apply merge property after the memory region is initialized 2024-09-24 11:33:35 +02:00
iommufd.c
Kconfig
meson.build
rng-builtin.c
rng-egd.c
rng-random.c
rng.c
spdm-socket.c
trace-events
trace.h
vhost-user.c