Skip to content

Commit

Permalink
hw/smbios: add assertion to ensure handles of tables 19 and 32 do not…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
ani-sinha authored and mstsirkin committed Mar 4, 2022
1 parent a379d45 commit 63670bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/smbios/smbios.c
Expand Up @@ -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);
Expand Down

0 comments on commit 63670bd

Please sign in to comment.