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

--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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
> >=20
> > Log:
> >   To allow to run the interpreter itself add a new ELF branding type.
> >   Allow Linux ABI to run ELF interpreter.
> >  =20
>=20
> [..]
>=20
> > +	/* Some ABI allows to run the interpreter itself. */
> > +	for (i =3D 0; i < MAX_BRANDS; i++) {
> > +		bi =3D elf_brand_list[i];
> > +		if (bi =3D=3D NULL || bi->flags & BI_BRAND_NOTE_MANDATORY)
> > +			continue;
> > +		if (hdr->e_machine !=3D bi->machine ||
> > +		    (bi->flags & BI_CAN_EXEC_INTERP) =3D=3D 0)
> > +			continue;
> > +		/*
> > +		 * Compare the interpreter name not the path to allow run it
> > +		 * from everywhere.
> > +		 */
> > +		interp_brand_name =3D strrchr(bi->interp_path, '/');
> > +		if (interp_brand_name =3D=3D NULL)
> > +			interp_brand_name =3D bi->interp_path;
> > +		interp_len =3D strlen(interp_brand_name);
> > +		fname_name =3D strrchr(imgp->args->fname, '/');
>=20
> Don't know about the rest, but this part looks incorrect.
>=20
> fname is NULL (which will crash in strrchr) when fexecve is executed.
>=20

yes, indeed. will fix, thanks

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

--=20
Have fun!
chd

--VS++wcV0S1rZb1Fb
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

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

--VS++wcV0S1rZb1Fb--



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