From: Tomas Bortoli <tomasbortoli@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.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: Tue, 8 Jan 2019 17:28:05 +0100 [thread overview]
Message-ID: <8418f6c8-0fc8-e22c-c39a-bfcaee7471e2@gmail.com> (raw)
In-Reply-To: <99de332c-d4e3-0628-8ad1-982032e67690@redhat.com>
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 ||
> 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 :)
Tomas
next prev parent reply other threads:[~2019-01-08 16:28 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 [this message]
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=8418f6c8-0fc8-e22c-c39a-bfcaee7471e2@gmail.com \
--to=tomasbortoli@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=syzkaller@googlegroups.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