diff options
author | Ani Sinha <ani@anisinha.ca> | 2022-02-23 20:03:22 +0530 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-03-04 08:30:52 -0500 |
commit | 63670bd3fce3d0c033d939d1b2b7a5f6834d0cf3 (patch) | |
tree | ce299d54ef39f165e79f9e011334db959d04c25a | |
parent | a379d4550c4a949bb1ca51bc5272d68b4a619b18 (diff) | |
download | qemu-63670bd3fce3d0c033d939d1b2b7a5f6834d0cf3.zip qemu-63670bd3fce3d0c033d939d1b2b7a5f6834d0cf3.tar.gz qemu-63670bd3fce3d0c033d939d1b2b7a5f6834d0cf3.tar.bz2 |
hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide
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>
-rw-r--r-- | hw/smbios/smbios.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 44c5379..1f8d5c2 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); |