[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/45] hw/smbios: add assertion to ensure handles of tables 19 and
From: |
Michael S. Tsirkin |
Subject: |
[PULL 08/45] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide |
Date: |
Fri, 4 Mar 2022 08:38:12 -0500 |
From: Ani Sinha <ani@anisinha.ca>
Since change dcf359832eec02 ("hw/smbios: fix table memory corruption with large
memory vms")
we reserve additional space between handle numbers of tables 17 and 19 for
large VMs. This may cause table 19 to collide with table 32 in their handle
numbers for those large VMs. This change adds an assertion to ensure numbers
do not collide. If they do, qemu crashes with useful debug information for
taking additional steps.
Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220223143322.927136-8-ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/smbios/smbios.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 44c53797a4..1f8d5c252f 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1048,6 +1048,12 @@ void smbios_get_tables(MachineState *ms,
mem_array[i].length);
}
+ /*
+ * make sure 16 bit handle numbers in the headers of tables 19
+ * and 32 do not overlap.
+ */
+ assert((mem_array_size + offset) < (T32_BASE - T19_BASE));
+
smbios_build_type_32_table();
smbios_build_type_38_table();
smbios_build_type_41_table(errp);
--
MST
- [PULL 00/45] virtio,pc,pci: features, cleanups, fixes, Michael S. Tsirkin, 2022/03/04
- [PULL 01/45] qom: assert integer does not overflow, Michael S. Tsirkin, 2022/03/04
- [PULL 02/45] ACPI ERST: specification for ERST support, Michael S. Tsirkin, 2022/03/04
- [PULL 03/45] MAINTAINERS: no need to add my name explicitly as a reviewer for VIOT tables, Michael S. Tsirkin, 2022/03/04
- [PULL 04/45] docs/acpi/erst: add device id for ACPI ERST device in pci-ids.txt, Michael S. Tsirkin, 2022/03/04
- [PULL 05/45] hw/acpi/erst: clean up unused IS_UEFI_CPER_RECORD macro, Michael S. Tsirkin, 2022/03/04
- [PULL 06/45] hw/smbios: code cleanup - use macro definitions for table header handles, Michael S. Tsirkin, 2022/03/04
- [PULL 08/45] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide,
Michael S. Tsirkin <=
- [PULL 07/45] hw/smbios: fix overlapping table handle numbers with large memory vms, Michael S. Tsirkin, 2022/03/04
- [PULL 09/45] vhost-user: remove VirtQ notifier restore, Michael S. Tsirkin, 2022/03/04
- [PULL 10/45] vhost-user: fix VirtQ notifier cleanup, Michael S. Tsirkin, 2022/03/04
- [PULL 11/45] virtio: fix the condition for iommu_platform not supported, Michael S. Tsirkin, 2022/03/04
- [PULL 12/45] hw/vhost-user-i2c: Add support for VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, Michael S. Tsirkin, 2022/03/04
- [PULL 13/45] tests/qtest/libqos/pci: Introduce pio_limit, Michael S. Tsirkin, 2022/03/04
- [PULL 14/45] tests/qtest/libqos: Skip hotplug tests if pci root bus is not hotpluggable, Michael S. Tsirkin, 2022/03/04
- [PULL 15/45] tests/qtest/vhost-user-blk-test: Temporary hack to get tests passing on aarch64, Michael S. Tsirkin, 2022/03/04
- [PULL 16/45] tests/qtest/libqos: Add generic pci host bridge in arm-virt machine, Michael S. Tsirkin, 2022/03/04