From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Tomas Bortoli <tomasbortoli@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller@googlegroups.com
Subject: Re: [PATCH] KVM: validate userspace input in kvm_clear_dirty_log_protect()
Date: Fri, 11 Jan 2019 14:49:56 +0100 [thread overview]
Message-ID: <20190111134955.GE14852@flask> (raw)
In-Reply-To: <8418f6c8-0fc8-e22c-c39a-bfcaee7471e2@gmail.com>
2019-01-08 17:28+0100, Tomas Bortoli:
> Hi Paolo,
>
> On 1/7/19 11:42 PM, Paolo Bonzini wrote:
> > On 02/01/19 18:29, Tomas Bortoli wrote:
> >> n = kvm_dirty_bitmap_bytes(memslot);
> >> +
> >> + if (n << 3 < log->num_pages || log->first_page > log->num_pages)
> >> + return -EINVAL;
> >> +
> >
> > This should be
> >
> > if (log->first_page > memslot->npages ||
(Wouldn't this be clearer with a >= instead?)
> > log->num_pages > memslot->npages - log->first_page)
> > return -EINVAL;
> >
> > i.e. the comparison should check the last page in the range, not the
> > number of pages. In addition, using "n" is unnecessary since we do have
> > the memslot. I'll do the changes myself if you prefer, but an ack would
> > be nice.
> >
> >
>
>
> Yeah, I agree. Thanks for the reply and sure you can do the changes, np :)
Done that and applied, thanks.
next prev parent reply other threads:[~2019-01-11 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-02 17:29 [PATCH] KVM: validate userspace input in kvm_clear_dirty_log_protect() Tomas Bortoli
2019-01-07 22:42 ` Paolo Bonzini
2019-01-08 16:28 ` Tomas Bortoli
2019-01-11 13:49 ` Radim Krčmář [this message]
2019-01-14 9:10 ` Paolo Bonzini
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=20190111134955.GE14852@flask \
--to=rkrcmar@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=syzkaller@googlegroups.com \
--cc=tomasbortoli@gmail.com \
/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).