qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] kvm: Fix crash due to access uninitialized kvm_state


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2] kvm: Fix crash due to access uninitialized kvm_state
Date: Mon, 31 Jul 2023 15:55:49 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 31/7/23 14:59, Gavin Shan wrote:
Runs into core dump on arm64 and the backtrace extracted from the
core dump is shown as below. It's caused by accessing uninitialized
@kvm_state in kvm_flush_coalesced_mmio_buffer() due to commit 176d073029
("hw/arm/virt: Use machine_memory_devices_init()"), where the machine's
memory region is added earlier than before.

     main
     qemu_init
     configure_accelerators
     qemu_opts_foreach
     do_configure_accelerator
     accel_init_machine
     kvm_init
     virt_kvm_type
     virt_set_memmap
     machine_memory_devices_init
     memory_region_add_subregion
     memory_region_add_subregion_common
     memory_region_update_container_subregions
     memory_region_transaction_begin
     qemu_flush_coalesced_mmio_buffer
     kvm_flush_coalesced_mmio_buffer

Fix it by bailing early in kvm_flush_coalesced_mmio_buffer() on the
uninitialized @kvm_state. With this applied, no crash is observed on
arm64.

Fixes: 176d073029 ("hw/arm/virt: Use machine_memory_devices_init()")
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
v2: Bail early in kvm_flush_coalesced_mmio_buffer() on the uninitialized
     @kvm_state and improved changelog        (David/Peter)
---
  accel/kvm/kvm-all.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]