From: Paolo Bonzini <pbonzini@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>,
"Tomas Bortoli" <tomasbortoli@gmail.com>
Cc: 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: Mon, 14 Jan 2019 10:10:45 +0100 [thread overview]
Message-ID: <b32262e6-f20f-d7b4-da59-e5fdecbee150@redhat.com> (raw)
In-Reply-To: <20190111134955.GE14852@flask>
On 11/01/19 14:49, Radim Krčmář wrote:
> 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->first_page == memslot->npages is technically okay if log->num_pages
is zero.
Paolo
>>> 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.
>
prev parent reply other threads:[~2019-01-14 9:10 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ář
2019-01-14 9:10 ` Paolo Bonzini [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=b32262e6-f20f-d7b4-da59-e5fdecbee150@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).