All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Christian A. Ehrhardt" <lk@c--e.de>
Cc: qemu-devel@nongnu.org,  Eric DeVolder <eric.devolder@oracle.com>,
	qemu-stable@nongnu.org,  "Michael S. Tsirkin" <mst@redhat.com>,
	 Igor Mammedov <imammedo@redhat.com>,
	 Ani Sinha <ani@anisinha.ca>
Subject: Re: [PATCH] hw/acpi/erst.c: Fix memset argument order
Date: Fri, 21 Oct 2022 06:22:50 +0200	[thread overview]
Message-ID: <8735bh6c11.fsf@pond.sub.org> (raw)
In-Reply-To: <Y1God1/x+A71ID7+@cae.in-ulm.de> (Christian A. Ehrhardt's message of "Thu, 20 Oct 2022 21:58:47 +0200")

"Christian A. Ehrhardt" <lk@c--e.de> writes:

> Hi Markus,
>
> On Thu, Oct 20, 2022 at 08:14:32AM +0200, Markus Armbruster wrote:
>> "Christian A. Ehrhardt" <lk@c--e.de> writes:
>> 
>> > Fix memset argument order: The second argument is
>> > the value, the length goes last.
>> 
>> Impact of the bug?
>
> Well, this is a memory error, i.e. the potential impact is
> anything from silent data corruption to arbitrary code execution.
> Phillipe described this accurately as "Ouch".
>
>> > Cc: Eric DeVolder <eric.devolder@oracle.com>
>> > Cc: qemu-stable@nongnu.org
>> > Fixes: f7e26ffa590 ("ACPI ERST: support for ACPI ERST feature")
>> > Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
>> >          /* Write the record into the slot */
>
> [ ... ]
>
>> This first copies @record_length bytes into the exchange buffer.
>> 
>> > -        memset(nvram + record_length, exchange_length - record_length, 0xFF);
>> > +        memset(nvram + record_length, 0xFF, exchange_length - record_length);
>> 
>> The new code pads it to the full exchange buffer size.
>> 
>> The old code writes 0xFF bytes.
>> 
>> If 0xFF < exchange_length - record_length, the padding doesn't extend to
>> the end of the buffer.  Impact?
>
> Incorrect and insufficient data is written.
>
>> If 0xFF > exchange_length - record_length, we write beyond the end of
>> the buffer.  Impact?
>
> Buffer overrun with well known potentially catastrophic consequences.
> Additionally, incorrect data is used for the padding.

Is record_length controlled by the guest?



  reply	other threads:[~2022-10-21  4:29 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 [this message]
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

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=8735bh6c11.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=eric.devolder@oracle.com \
    --cc=imammedo@redhat.com \
    --cc=lk@c--e.de \
    --cc=mst@redhat.com \
    --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 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.