kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 5/6] kvm: Re-introduce memslots->nmemslots
Date: Thu, 6 Dec 2012 21:58:48 -0200	[thread overview]
Message-ID: <20121206235848.GA30582@amt.cnet> (raw)
In-Reply-To: <1354765897.3224.71.camel@bling.home>

On Wed, Dec 05, 2012 at 08:51:37PM -0700, Alex Williamson wrote:
> > > id_to_memslot seems like a good place to catch all the users since
> > > that's the only way to get a slot from a slot id after the array is
> > > sorted.  We need to check both is the slot in bounds (EINVAL), but also
> > > is it allocated (ENOENT).  id_to_memslot could both of these if we
> > > wanted to switch it to ERR_PTR.  Thanks,
> > > 
> > > Alex
> > 
> > There should never be a reference to a slot out of bounds by KVM itself
> > (BUG_ON). Only userspace can attempt a reference to such slot.
> 
> If I understand correctly, you're saying this last chunk is unique
> because kvm_get_dirty_log() is an internal interface and the test should
> be restricted to callers from userspace interfaces, namely
> kvm_vm_ioctl_get_dirty_log().  That sounds reasonable; book3s_pr seems
> to be the only caller that relies on kvm_get_dirty_log() validating the
> slot.  Thanks,
> 
> Alex

Yep - so you can move the check to such userspace interfaces, and bug on 
on WARN otherwise (in id_to_memslot).

Does that make sense??

  reply	other threads:[~2012-12-06 23:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 23:39 [RFC PATCH 0/6] kvm: Growable memory slot array Alex Williamson
2012-12-03 23:39 ` [RFC PATCH 1/6] kvm: Rename KVM_MEMORY_SLOTS -> KVM_USER_MEM_SLOTS Alex Williamson
2012-12-03 23:39 ` [RFC PATCH 2/6] kvm: Make KVM_PRIVATE_MEM_SLOTS optional Alex Williamson
2012-12-03 23:39 ` [RFC PATCH 3/6] kvm: Merge id_to_index into memslots Alex Williamson
2012-12-05 21:22   ` Marcelo Tosatti
2012-12-05 22:58     ` Alex Williamson
2012-12-03 23:39 ` [RFC PATCH 4/6] kvm: Move private memory slots to start of memslots array Alex Williamson
2012-12-05 21:24   ` Marcelo Tosatti
2012-12-05 22:58     ` Alex Williamson
2012-12-03 23:39 ` [RFC PATCH 5/6] kvm: Re-introduce memslots->nmemslots Alex Williamson
2012-12-05 21:26   ` Marcelo Tosatti
2012-12-05 23:02     ` Alex Williamson
2012-12-06  1:45       ` Marcelo Tosatti
2012-12-06  3:51         ` Alex Williamson
2012-12-06 23:58           ` Marcelo Tosatti [this message]
2012-12-06 23:59             ` Marcelo Tosatti
2012-12-07  0:07               ` Alex Williamson
2012-12-03 23:39 ` [RFC PATCH 6/6] kvm: Allow memory slots to grow Alex Williamson
2012-12-04 11:48 ` [RFC PATCH 0/6] kvm: Growable memory slot array Gleb Natapov
2012-12-04 15:21   ` Alex Williamson
2012-12-04 15:30     ` Gleb Natapov
2012-12-04 15:39       ` Alex Williamson
2012-12-04 16:42         ` Gleb Natapov
2012-12-04 17:56           ` Alex Williamson
2012-12-04 14:48 ` Takuya Yoshikawa
2012-12-04 15:26   ` Alex Williamson
2012-12-05 21:32 ` Marcelo Tosatti
2012-12-05 22:57   ` Alex Williamson

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=20121206235848.GA30582@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).