[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 55/63] kvm: handle KVM_EXIT_MEMORY_FAULT
|
From: |
Paolo Bonzini |
|
Subject: |
Re: [PULL 55/63] kvm: handle KVM_EXIT_MEMORY_FAULT |
|
Date: |
Tue, 30 Apr 2024 21:06:57 +0200 |
On Fri, Apr 26, 2024 at 3:40 PM Peter Maydell <peter.maydell@linaro.org> wrote:
> > + addr = memory_region_get_ram_ptr(mr) + section.offset_within_region;
> > + rb = qemu_ram_block_from_host(addr, false, &offset);
>
> ...and this call to qemu_ram_block_from_host() will only initialize
> offset if it does not fail (i.e. doesn't return NULL)...
>
> I think this code should either handle the case where
> qemu_ram_block_from_host() fails, or, if it is impossible
> for it to fail in this situation, add an assert() and a
> comment about why we know it can't fail.
The assertion is in memory_region_get_ram_ptr(), but Coverity
understandably cannot see it.
Similar to other code in hw/virtio/virtio-balloon.c, this code is
using memory_region_get_ram_ptr() as a roundabout way to go from
MemoryRegion (in this case MemoryRegionSection) to RAMBlock. The
right fix is to introduce memory_region_get_ram_block() and use it.
Paolo
- [PULL 23/63] target/i386: add guest-phys-bits cpu property, (continued)
- [PULL 23/63] target/i386: add guest-phys-bits cpu property, Paolo Bonzini, 2024/04/23
- [PULL 25/63] i386/kvm: Move architectural CPUID leaf generation to separate helper, Paolo Bonzini, 2024/04/23
- [PULL 30/63] q35: Introduce smm_ranges property for q35-pci-host, Paolo Bonzini, 2024/04/23
- [PULL 39/63] runstate: skip initial CPU reset if reset is not actually possible, Paolo Bonzini, 2024/04/23
- [PULL 48/63] kvm: Introduce support for memory_attributes, Paolo Bonzini, 2024/04/23
- [PULL 38/63] linux-headers: update to current kvm/next, Paolo Bonzini, 2024/04/23
- [PULL 53/63] RAMBlock: make guest_memfd require uncoordinated discard, Paolo Bonzini, 2024/04/23
- [PULL 55/63] kvm: handle KVM_EXIT_MEMORY_FAULT, Paolo Bonzini, 2024/04/23
- [PULL 54/63] physmem: Introduce ram_block_discard_guest_memfd_range(), Paolo Bonzini, 2024/04/23
- [PULL 24/63] kvm: add support for guest physical bits, Paolo Bonzini, 2024/04/23
- [PULL 60/63] target/i386/cpu: Merge the warning and error messages for AMD HT check, Paolo Bonzini, 2024/04/23
- [PULL 63/63] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Paolo Bonzini, 2024/04/23
- [PULL 42/63] target/i386: introduce x86-confidential-guest, Paolo Bonzini, 2024/04/23
- [PULL 15/63] colo: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- Re: [PULL 00/63] First batch of i386 and build system patch for QEMU 9.1, Richard Henderson, 2024/04/24