lkml.org 
[lkml]   [2012]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 5/6] kvm: Re-introduce memslots->nmemslots
From
Date
On Thu, 2012-12-06 at 21:59 -0200, Marcelo Tosatti wrote:
> On Thu, Dec 06, 2012 at 09:58:48PM -0200, Marcelo Tosatti wrote:
> > 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).
>
> WARN_ON. The point is, if its not a valid condition, it should be
> explicitly so.
>
> > Does that make sense??

Yep, I'll add that if we decide to go that route. This patch isn't
necessary with the series I just posted since the array is still static.
Thanks,

Alex




\
 
 \ /
  Last update: 2012-12-07 01:41    [W:0.136 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site