From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexander Bulekov <alxndr@bu.edu>
Cc: "Christian A. Ehrhardt" <lk@c--e.de>,
qemu-devel@nongnu.org, "Eric DeVolder" <eric.devolder@oracle.com>,
qemu-stable@nongnu.org, "Igor Mammedov" <imammedo@redhat.com>,
"Ani Sinha" <ani@anisinha.ca>,
"Markus Armbruster" <armbru@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH] hw/acpi/erst.c: Fix memset argument order
Date: Mon, 24 Oct 2022 10:04:18 -0400 [thread overview]
Message-ID: <20221024100323-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20221024132040.5dnn45eatygojipe@mozz.bu.edu>
On Mon, Oct 24, 2022 at 09:20:40AM -0400, Alexander Bulekov wrote:
> On 221023 1637, Christian A. Ehrhardt wrote:
> >
> > Hi,
> >
> > On Sat, Oct 22, 2022 at 01:37:27AM -0400, Alexander Bulekov wrote:
> > > On 221021 1505, Alexander Bulekov wrote:
> > > > On 221019 2115, Christian A. Ehrhardt wrote:
> > > > > Fix memset argument order: The second argument is
> > > > > the value, the length goes last.
> > > > >
> > > > > 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>
> > > > > ---
> > > > > hw/acpi/erst.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c
> > > > > index df856b2669..26391f93ca 100644
> > > > > --- a/hw/acpi/erst.c
> > > > > +++ b/hw/acpi/erst.c
> > > > > @@ -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);
> > > >
> > > > Hi,
> > > > I'm running the fuzzer over this code. So far, it hasn't complained
> > > > about this particular memset call, but it has crashed on the memcpy,
> > > > directly preceding it. I think the record_length checks might be
> > > > insufficient. I made an issue/reproducer:
> > > > https://gitlab.com/qemu-project/qemu/-/issues/1268
> > > >
> > > > In that particular case, record_length is ffffff00 and passes the
> > > > checks. I'll keep an eye on the fuzzer to see if it will be able to
> > > > crash the memset.
> > >
> > > Here's a testcase for the memset issue:
> >
> > Looks like this check in {read,write}_erst_record():
> > | if ((s->record_offset + record_length) > exchange_length) {
> > | return STATUS_FAILED;
> > | }
> >
> > has an integer overrun and should be re-written as:
> > | if (record_length > exchange_length - s->record_offset) {
> > | return STATUS_FAILED;
> > | }
> >
> > regards Christian
>
> Hi Christian,
> With this change applied (along with the memset fix), the fuzzer doesn't
> find any crashes.
> Thanks
> -Alex
Thanks!
Christian, are you doing to be sending a combined patch for the whole
issue? If you do pls add Tested-by tags as appropriate. Thanks!
--
MST
next prev parent reply other threads:[~2022-10-24 14:20 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 [this message]
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=20221024100323-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 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.