[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/7] hw/smbios: add assertion to ensure handles of tables 19 and
From: |
Ani Sinha |
Subject: |
[PATCH 7/7] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide |
Date: |
Wed, 23 Feb 2022 20:03:22 +0530 |
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>
---
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);
--
2.25.1
- [PATCH 0/7] Queued patches for the next pull request, Ani Sinha, 2022/02/23
- [PATCH 1/7] ACPI ERST: specification for ERST support, Ani Sinha, 2022/02/23
- [PATCH 2/7] MAINTAINERS: no need to add my name explicitly as a reviewer for VIOT tables, Ani Sinha, 2022/02/23
- [PATCH 3/7] docs/acpi/erst: add device id for ACPI ERST device in pci-ids.txt, Ani Sinha, 2022/02/23
- [PATCH 4/7] hw/acpi/erst: clean up unused IS_UEFI_CPER_RECORD macro, Ani Sinha, 2022/02/23
- [PATCH 5/7] hw/smbios: code cleanup - use macro definitions for table header handles, Ani Sinha, 2022/02/23
- [PATCH 6/7] hw/smbios: fix overlapping table handle numbers with large memory vms, Ani Sinha, 2022/02/23
- [PATCH 7/7] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide,
Ani Sinha <=