From: Paolo Bonzini <pbonzini@redhat.com>
To: Tomas Bortoli <tomasbortoli@gmail.com>,
rkrcmar@redhat.com, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com
Subject: Re: [PATCH] KVM: validate userspace input in kvm_clear_dirty_log_protect()
Date: Mon, 7 Jan 2019 23:42:20 +0100 [thread overview]
Message-ID: <99de332c-d4e3-0628-8ad1-982032e67690@redhat.com> (raw)
In-Reply-To: <20190102172937.28741-1-tomasbortoli@gmail.com>
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 ||
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.
Paolo
next prev parent reply other threads:[~2019-01-07 22:42 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 [this message]
2019-01-08 16:28 ` Tomas Bortoli
2019-01-11 13:49 ` Radim Krčmář
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=99de332c-d4e3-0628-8ad1-982032e67690@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@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).