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

Re: [Xen-devel] [PATCH v3 05/23] xsplice: Add helper elf routines (v4)



> > +struct xsplice_elf_sec *xsplice_elf_sec_by_name(const struct xsplice_elf 
> > *elf,
> > +                                                const char *name)
> > +{
> > +    unsigned int i;
> > +
> > +    for ( i = 0; i < elf->hdr->e_shnum; i++ )
> > +    {
> > +        if ( !strcmp(name, elf->sec[i].name) )
> > +            return &elf->sec[i];
> > +    }
> > +
> > +    return NULL;
> > +}
> > +
> > +static int elf_resolve_sections(struct xsplice_elf *elf, uint8_t *data)
> > +{
> > +    struct xsplice_elf_sec *sec;
> > +    unsigned int i;
> > +
> > +    sec = xmalloc_array(struct xsplice_elf_sec, elf->hdr->e_shnum);
> 
> Presumably there will be some sanity checks done somewhere between the
> hypercall and here?

There are checks on it but not the value itself. As in the payload could
have e_shnum be some astronomical value because of many .sections in the
file (even the ones we do not use). We could combat that by having
an whitelist of sections - and:
 - If the payload has them return -EINVAL.
 - If the payload has them - ignore them and continue on but instead of
   using e_shnum use the counted value of the sections we expect?

Preferences?

_______________________________________________
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®.