From: Ani Sinha <ani@anisinha.ca>
To: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>
Subject: [PATCH v2 3/3] hw/smbios: add an assertion to ensure tables 19 and 32 do not collide
Date: Mon, 7 Feb 2022 17:01:29 +0530 [thread overview]
Message-ID: <20220207113129.2701722-4-ani@anisinha.ca> (raw)
In-Reply-To: <20220207113129.2701722-1-ani@anisinha.ca>
Since change b3cddba9c14b034 ("hw/smbios: fix table memory corruption with large memory vms")
we reserve additional memory space between tables 17 and 19 for large VMs.
This may cause table 19 to collide with table 32 for those VMs. This change
adds an assertion to make sure table 19 does not extend into the memory used
by table 32.
Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
hw/smbios/smbios.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d7de740363..800a35e9a5 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1048,6 +1048,9 @@ void smbios_get_tables(MachineState *ms,
mem_array[i].length);
}
+ /* we need to make sure table 19 and table 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
next prev parent reply other threads:[~2022-02-07 11:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 11:31 [PATCH v2 0/3] hw/smbios: fix table memory corruption with large memory vms Ani Sinha
2022-02-07 11:31 ` [PATCH v2 1/3] hw/smbios: code cleanup - use macro definitions for table base addresses Ani Sinha
2022-02-11 8:43 ` Igor Mammedov
2022-02-07 11:31 ` [PATCH v2 2/3] hw/smbios: fix table memory corruption with large memory vms Ani Sinha
2022-02-14 12:50 ` Igor Mammedov
2022-02-18 5:18 ` Ani Sinha
2022-02-07 11:31 ` Ani Sinha [this message]
2022-02-14 12:53 ` [PATCH v2 3/3] hw/smbios: add an assertion to ensure tables 19 and 32 do not collide Igor Mammedov
2022-02-14 14:34 ` [PATCH v2 0/3] hw/smbios: fix table memory corruption with large memory vms Michael S. Tsirkin
2022-02-14 14:53 ` Ani Sinha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220207113129.2701722-4-ani@anisinha.ca \
--to=ani@anisinha.ca \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).