svn commit: r266925 - in head/sys: amd64/linux32 i386/linux kern sys

Chagin Dmitry dchagin at freebsd.org
Fri Jun 6 17:03:23 UTC 2014


On Fri, Jun 06, 2014 at 05:47:01PM +0200, Mateusz Guzik wrote:
> On Sat, May 31, 2014 at 03:01:51PM +0000, Dmitry Chagin wrote:
> > Author: dchagin
> > Date: Sat May 31 15:01:51 2014
> > New Revision: 266925
> > URL: http://svnweb.freebsd.org/changeset/base/266925
> > 
> > Log:
> >   To allow to run the interpreter itself add a new ELF branding type.
> >   Allow Linux ABI to run ELF interpreter.
> >   
> 
> [..]
> 
> > +	/* Some ABI allows to run the interpreter itself. */
> > +	for (i = 0; i < MAX_BRANDS; i++) {
> > +		bi = elf_brand_list[i];
> > +		if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY)
> > +			continue;
> > +		if (hdr->e_machine != bi->machine ||
> > +		    (bi->flags & BI_CAN_EXEC_INTERP) == 0)
> > +			continue;
> > +		/*
> > +		 * Compare the interpreter name not the path to allow run it
> > +		 * from everywhere.
> > +		 */
> > +		interp_brand_name = strrchr(bi->interp_path, '/');
> > +		if (interp_brand_name == NULL)
> > +			interp_brand_name = bi->interp_path;
> > +		interp_len = strlen(interp_brand_name);
> > +		fname_name = strrchr(imgp->args->fname, '/');
> 
> Don't know about the rest, but this part looks incorrect.
> 
> fname is NULL (which will crash in strrchr) when fexecve is executed.
> 

yes, indeed. will fix, thanks

> > +		if (fname_name == NULL)
> > +			fname_name = imgp->args->fname;
> > +		fname_len = strlen(fname_name);
> > +		if (fname_len < interp_len)
> > +			continue;
> > +		ret = strncmp(fname_name, interp_brand_name, interp_len);
> > +		if (ret == 0)
> > +			return (bi);
> > +	}
> > +
> 
> 
> -- 
> Mateusz Guzik <mjguzik gmail.com>

-- 
Have fun!
chd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20140606/55053231/attachment.sig>


More information about the svn-src-head mailing list