qemu/target/i386/kvm
David Woodhouse 93c76555d8 hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make
space for a new entry. However, fw_cfg_arch_create() just uses the
existing e820_table pointer. This leads to a use-after-free if anything
adds a new entry after fw_cfg is set up.

Shift the addition of the etc/e820 file to the machine done notifier, via
a new fw_cfg_add_e820() function.

Also make e820_table private and use an e820_get_table() accessor function
for it, which sets a flag that will trigger an assert() for any *later*
attempts to add to the table.

Make e820_add_entry() return void, as most callers don't check for error
anyway.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-03 18:14:06 -04:00
..
hyperv-proto.h i386: Hyper-V Direct TLB flush hypercall 2022-05-25 21:26:35 +02:00
hyperv-stub.c vmbus: Print a warning when enabled without the recommended set of features 2024-03-08 14:18:56 +01:00
hyperv.c target-i386: hyper-v: Correct kvm_hv_handle_exit return value 2024-05-22 19:56:28 +02:00
hyperv.h vmbus: Print a warning when enabled without the recommended set of features 2024-03-08 14:18:56 +01:00
kvm_i386.h i386/kvm: Add KVM_EXIT_HYPERCALL handling for KVM_HC_MAP_GPA_RANGE 2024-06-05 11:01:06 +02:00
kvm-cpu.c target/i386: Advertise MWAIT iff host supports 2024-06-30 19:51:44 +03:00
kvm.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
meson.build i386/sev: Switch to use confidential_guest_kvm_init() 2024-04-23 17:35:25 +02:00
trace-events i386/kvm: Add KVM_EXIT_HYPERCALL handling for KVM_HC_MAP_GPA_RANGE 2024-06-05 11:01:06 +02:00
trace.h
xen-compat.h i386/xen: Implement HYPERVISOR_physdev_op 2023-03-01 09:08:26 +00:00
xen-emu.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
xen-emu.h hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback 2023-03-01 09:06:44 +00:00