From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Christian A. Ehrhardt" <lk@c--e.de>
Cc: qemu-devel@nongnu.org, "Alexander Bulekov" <alxndr@bu.edu>,
qemu-stable@nongnu.org, "Igor Mammedov" <imammedo@redhat.com>,
"Ani Sinha" <ani@anisinha.ca>,
"Eric DeVolder" <eric.devolder@oracle.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2] hw/acpi/erst.c: Fix memory handling issues
Date: Mon, 24 Oct 2022 16:37:13 -0400 [thread overview]
Message-ID: <20221024163701-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20221024154233.1043347-1-lk@c--e.de>
On Mon, Oct 24, 2022 at 05:42:33PM +0200, Christian A. Ehrhardt wrote:
> - Fix memset argument order: The second argument is
> the value, the length goes last.
> - Fix an integer overflow reported by Alexander Bulekov.
>
> Both issues allow the guest to overrun the host buffer
> allocated for the ERST memory device.
>
> Cc: Eric DeVolder <eric.devolder@oracle.com
> Cc: Alexander Bulekov <alxndr@bu.edu>
> Cc: qemu-stable@nongnu.org
> Fixes: f7e26ffa590 ("ACPI ERST: support for ACPI ERST feature")
> Tested-by: Alexander Bulekov <alxndr@bu.edu>
> Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
queued, thanks!
> ---
> hw/acpi/erst.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c
> index df856b2669..aefcc03ad6 100644
> --- a/hw/acpi/erst.c
> +++ b/hw/acpi/erst.c
> @@ -635,7 +635,7 @@ static unsigned read_erst_record(ERSTDeviceState *s)
> if (record_length < UEFI_CPER_RECORD_MIN_SIZE) {
> rc = STATUS_FAILED;
> }
> - if ((s->record_offset + record_length) > exchange_length) {
> + if (record_length > exchange_length - s->record_offset) {
> rc = STATUS_FAILED;
> }
> /* If all is ok, copy the record to the exchange buffer */
> @@ -684,7 +684,7 @@ static unsigned write_erst_record(ERSTDeviceState *s)
> if (record_length < UEFI_CPER_RECORD_MIN_SIZE) {
> return STATUS_FAILED;
> }
> - if ((s->record_offset + record_length) > exchange_length) {
> + if (record_length > exchange_length - s->record_offset) {
> return STATUS_FAILED;
> }
>
> @@ -716,7 +716,7 @@ static unsigned write_erst_record(ERSTDeviceState *s)
> if (nvram) {
> /* Write the record into the slot */
> memcpy(nvram, exchange, record_length);
> - memset(nvram + record_length, exchange_length - record_length, 0xFF);
> + memset(nvram + record_length, 0xFF, exchange_length - record_length);
> /* If a new record, increment the record_count */
> if (!record_found) {
> uint32_t record_count;
> --
> 2.34.1
prev parent reply other threads:[~2022-10-24 20:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 19:15 [PATCH] hw/acpi/erst.c: Fix memset argument order Christian A. Ehrhardt
2022-10-19 19:37 ` Philippe Mathieu-Daudé
2022-10-19 19:45 ` Eric DeVolder
2022-10-20 6:14 ` Markus Armbruster
2022-10-20 19:58 ` Christian A. Ehrhardt
2022-10-21 4:22 ` Markus Armbruster
2022-10-21 6:42 ` Christian A. Ehrhardt
2022-10-21 15:29 ` Eric DeVolder
2022-10-21 19:05 ` Alexander Bulekov
2022-10-22 5:37 ` Alexander Bulekov
2022-10-23 14:37 ` Christian A. Ehrhardt
2022-10-24 13:20 ` Alexander Bulekov
2022-10-24 14:04 ` Michael S. Tsirkin
2022-10-24 15:42 ` [PATCH v2] hw/acpi/erst.c: Fix memory handling issues Christian A. Ehrhardt
2022-10-24 16:24 ` Alexander Bulekov
2022-10-25 0:24 ` Alexander Bulekov
2022-10-24 20:34 ` Eric DeVolder
2022-10-24 20:37 ` Michael S. Tsirkin [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=20221024163701-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alxndr@bu.edu \
--cc=ani@anisinha.ca \
--cc=armbru@redhat.com \
--cc=eric.devolder@oracle.com \
--cc=imammedo@redhat.com \
--cc=lk@c--e.de \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).