Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jun 2014 21:03:18 +0400
From:      Chagin Dmitry <dchagin@freebsd.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r266925 - in head/sys: amd64/linux32 i386/linux kern sys
Message-ID:  <20140606170318.GA4076@dchagin.static.corbina.net>
In-Reply-To: <20140606154701.GA26114@dft-labs.eu>
References:  <201405311501.s4VF1pR8062552@svn.freebsd.org> <20140606154701.GA26114@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlOR9FYACgkQ0t2Tb3OO/O0epgCgv3ULNBtfdx1CHNCcV+4gPped
RVkAniithXjQPp868zNReeI3DWYzcUWK
=7K9X
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140606170318.GA4076>