[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 2/4] xen: introduce grant_map_exists



On Mon, 6 Oct 2014, Jan Beulich wrote:
> >>> On 03.10.14 at 16:50, <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > --- a/xen/common/grant_table.c
> > +++ b/xen/common/grant_table.c
> > @@ -484,6 +484,36 @@ static int _set_status(unsigned gt_version,
> >          return _set_status_v2(domid, readonly, mapflag, shah, act, status);
> >  }
> >  
> > +static bool_t grant_map_exists(struct domain *ld,
> > +                        struct grant_table *rgt,
> 
> Please constify these if possible.
> 
> > +                        unsigned long mfn)
> > +{
> > +    struct active_grant_entry *act;
> 
> And this one too.
> 
> > +    grant_ref_t ref;
> > +    bool_t ret = 0;
> > +
> > +    ASSERT(&rgt->lock);
> > +
> > +    for ( ref = 0; ref != nr_grant_entries(rgt); ref++ )
> 
> This loop's worst case iteration count is controlled solely by the
> "gnttab_max_nr_frames=" command line option afaict, i.e. for a
> large enough specified value this is going to become a security
> issue.

I am not sure what I could do about this.
Any suggestions?



> > +    {
> > +        act = &active_entry(rgt, ref);
> > +
> > +        if ( !act->pin )
> > +            continue;
> > +
> > +        if ( act->domid != ld->domain_id )
> > +            continue;
> > +
> > +        if ( act->frame != mfn )
> > +            continue;
> > +        
> > +        ret = 1;
> > +        break;
> > +    }
> > +
> > +    return ret;
> > +}
> 
> Apart from it not being very useful to introduce a static function
> without consumer, I very much expect this patch on its own to
> also cause a build error (unused static function). Please fold this
> into the patch adding a consumer of the function.
> 
> Jan
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.