All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Ani Sinha <ani@anisinha.ca>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v3 3/3] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide
Date: Thu, 17 Feb 2022 09:56:20 +0100	[thread overview]
Message-ID: <20220217095620.259e4c10@redhat.com> (raw)
In-Reply-To: <20220214141237.47946-4-ani@anisinha.ca>

On Mon, 14 Feb 2022 19:42:36 +0530
Ani Sinha <ani@anisinha.ca> wrote:

> Since change b3cddba9c14b034 ("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(+)
> 
> changelog:
> v3: reworded the commit log and comment in code.
> 
> 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);



      reply	other threads:[~2022-02-17  9:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 14:12 [PATCH v3 0/3] hw/smbios: fix table memory corruption with large memory vms Ani Sinha
2022-02-14 14:12 ` [PATCH v3 1/3] hw/smbios: code cleanup - use macro definitions for table header handles Ani Sinha
2022-02-14 14:12 ` [PATCH v3 2/3] hw/smbios: fix table memory corruption with large memory vms Ani Sinha
2022-02-17  8:54   ` Igor Mammedov
2022-02-17 13:32     ` Ani Sinha
2022-02-21  7:12       ` Igor Mammedov
2022-02-14 14:12 ` [PATCH v3 3/3] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide Ani Sinha
2022-02-17  8:56   ` Igor Mammedov [this message]

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=20220217095620.259e4c10@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani@anisinha.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.