From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Cc: serat@ucsd.edu, dlenski@gmail.com, mst@redhat.com
Subject: Re: [PATCH 1/4] acpi: fix QEMU crash when started with SLIC table
Date: Mon, 27 Dec 2021 22:26:43 +0100 [thread overview]
Message-ID: <51e5d715-cf71-24b9-da10-cb539b4da6fc@redhat.com> (raw)
In-Reply-To: <20211227193120.1084176-2-imammedo@redhat.com>
On 12/27/21 20:31, Igor Mammedov wrote:
> if QEMU is started with used provided SLIC table blob,
>
> -acpitable sig=SLIC,oem_id='CRASH ',oem_table_id="ME",oem_rev=00002210,asl_compiler_id="",asl_compiler_rev=00000000,data=/dev/null
> it will assert with:
>
> hw/acpi/aml-build.c:61:build_append_padded_str: assertion failed: (len <= maxlen)
>
> and following backtrace:
>
> ...
> build_append_padded_str (array=0x555556afe320, str=0x555556afdb2e "CRASH ME", maxlen=0x6, pad=0x20) at hw/acpi/aml-build.c:61
> acpi_table_begin (desc=0x7fffffffd1b0, array=0x555556afe320) at hw/acpi/aml-build.c:1727
> build_fadt (tbl=0x555556afe320, linker=0x555557ca3830, f=0x7fffffffd318, oem_id=0x555556afdb2e "CRASH ME", oem_table_id=0x555556afdb34 "ME") at hw/acpi/aml-build.c:2064
> ...
>
> which happens due to acpi_table_begin() expecting NULL terminated
> oem_id and oem_table_id strings, which is normally the case, but
> in case of user provided SLIC table, oem_id points to table's blob
> directly and as result oem_id became longer than expected.
>
> Fix issue by handling oem_id consistently and make acpi_get_slic_oem()
> return NULL terminated strings.
>
> PS:
> After [1] refactoring, oem_id semantics became inconsistent, where
> NULL terminated string was coming from machine and old way pointer
> into byte array coming from -acpitable option. That used to work
> since build_header() wasn't expecting NULL terminated string and
> blindly copied the 1st 6 bytes only.
>
> However commit [2] broke that by replacing build_header() with
> acpi_table_begin(), which was expecting NULL terminated string
> and was checking oem_id size.
>
> 1) 602b45820 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
> 2)
> Fixes: 4b56e1e4eb08 ("acpi: build_fadt: use acpi_table_begin()/acpi_table_end() instead of build_header()")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/786
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/acpi/core.c | 4 ++--
> hw/i386/acpi-build.c | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2021-12-27 21:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-27 19:31 [PATCH 0/4] Fix -acpitable regression Igor Mammedov
2021-12-27 19:31 ` [PATCH 1/4] acpi: fix QEMU crash when started with SLIC table Igor Mammedov
2021-12-27 21:26 ` Philippe Mathieu-Daudé [this message]
2021-12-28 14:25 ` Denis Lisov
2021-12-30 22:30 ` Alexander Tsoy
2022-01-03 7:15 ` Igor Mammedov
2021-12-27 19:31 ` [PATCH 2/4] tests: acpi: whitelist expected blobs before changing them Igor Mammedov
2021-12-27 19:31 ` [PATCH 3/4] tests: acpi: add SLIC table test Igor Mammedov
2021-12-27 19:31 ` [PATCH 4/4] tests: acpi: SLIC: update expected blobs Igor Mammedov
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=51e5d715-cf71-24b9-da10-cb539b4da6fc@redhat.com \
--to=philmd@redhat.com \
--cc=dlenski@gmail.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=serat@ucsd.edu \
/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).