From: Cornelia Huck <cohuck@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v1 1/1] s390x: fix storage attributes migration for non-small guests
Date: Thu, 18 Jan 2018 18:40:27 +0100 [thread overview]
Message-ID: <20180118184027.5ff55338.cohuck@redhat.com> (raw)
In-Reply-To: <20180118183351.2a9c5506@p-imbrenda.boeblingen.de.ibm.com>
On Thu, 18 Jan 2018 18:33:51 +0100
Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> wrote:
> On Thu, 18 Jan 2018 18:25:47 +0100
> Cornelia Huck <cohuck@redhat.com> wrote:
>
> ...
> [snip]
>
> > > > > > > diff --git a/hw/s390x/s390-stattrib-kvm.c
> > > > > > > b/hw/s390x/s390-stattrib-kvm.c index 41770a7..480551c 100644
> > > > > > > --- a/hw/s390x/s390-stattrib-kvm.c
> > > > > > > +++ b/hw/s390x/s390-stattrib-kvm.c
> > > > > > > @@ -116,7 +116,7 @@ static void
> > > > > > > kvm_s390_stattrib_synchronize(S390StAttribState *sa) for
> > > > > > > (cx = 0; cx + len <= max; cx += len) { clog.start_gfn = cx;
> > > > > > > clog.count = len;
> > > > > > > - clog.values = (uint64_t)(sas->incoming_buffer
> > > > > > > + cx
> > > > > > > * len);
> > > > > >
> > > > > > Hm, doesn't that even imply that you reference an area beyond
> > > > > > the buffer, as the <= max check does not catch this?
> > > > >
> > > > > what do you mean?
> > > > >
> > > > > cx + len <= max catches the cases where you would write beyond
> > > > > the end of the buffer. if cx + len == max then we are filling
> > > > > the buffer to the last byte. and we will get out at the next
> > > > > iteration.
> > > >
> > > > Yes, but the problem is that your offset is too long, isn't it?
> > > > (Where cx + len <= max, but you use an offset of cx * len which
> > > > may be > max.)
> > >
> > > which is exactly why I'm removing that line. look at the very
> > > beginning of the line, there is a -
> > >
> > > the replacement line (the one that starts with a +) has only cx
> >
> > Err, yes :) I simply wanted to comment that this looks worse than "not
> > migrated completely".
>
> yeah, that's true :) but the offset ended up big enough to always
> get -EFAULT from the kernel and get ignored by qemu afterwards, which
> then resulted in not all values being migrated.
So the moral is: If you're wrong, be really wrong? :)
>
> should I change the description to explain the issue in more detail?
Just mentioning something like out-of-bounds due to wrong offset or so
would be good.
prev parent reply other threads:[~2018-01-18 17:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 16:52 [Qemu-devel] [PATCH v1 1/1] s390x: fix storage attributes migration for non-small guests Claudio Imbrenda
2018-01-15 18:53 ` Christian Borntraeger
2018-01-18 16:20 ` Cornelia Huck
2018-01-18 16:52 ` Claudio Imbrenda
2018-01-18 17:02 ` Cornelia Huck
2018-01-18 17:23 ` Claudio Imbrenda
2018-01-18 17:25 ` Cornelia Huck
2018-01-18 17:33 ` Claudio Imbrenda
2018-01-18 17:40 ` Cornelia Huck [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=20180118184027.5ff55338.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=imbrenda@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@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).