From owner-svn-src-head@FreeBSD.ORG Fri Jun 6 17:03:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7164F44; Fri, 6 Jun 2014 17:03:23 +0000 (UTC) Received: from mail-lb0-x235.google.com (mail-lb0-x235.google.com [IPv6:2a00:1450:4010:c04::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D18012831; Fri, 6 Jun 2014 17:03:22 +0000 (UTC) Received: by mail-lb0-f181.google.com with SMTP id q8so1724391lbi.12 for ; Fri, 06 Jun 2014 10:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=99wqtcfgAACQIActdbi9sPYJjnusBPRCmINztugfhh8=; b=jOVdvlMhjOi/JANdwGZLfK9c8ilOQPIpHnzbaGNHO7evzXb4V5E2yvq3nXsy9DWF74 uhVWjD3LyY8ZKVPQWRGYAmkcSUzhraVw+8gRTa3PqtQ8AD7I/V4dVUV782sgVrbPZQph PAe6D15nNctMbx8dcwWERQ0Oeg4ndm45eA/6OoBGNyPJTYzdX8cnzbNQeKHeUNc+kVhu 5UG4V5XCf6pYYptDjLD3VhK8jQKxi7wgtOeWN3qYrljLnJEnvl5jgRymEeMV+RNkxku7 3oHjQ5q05w6qoLA2UTT+5U4gypUiW8uiGBdZPDsgDCddvtbgPeQHW9n8NnxqN8TA77n9 DD3g== X-Received: by 10.112.51.37 with SMTP id h5mr4395663lbo.24.1402074200790; Fri, 06 Jun 2014 10:03:20 -0700 (PDT) Received: from dchagin.static.corbina.net (dchagin.static.corbina.ru. [78.107.232.239]) by mx.google.com with ESMTPSA id z1sm8193665lal.6.2014.06.06.10.03.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jun 2014 10:03:19 -0700 (PDT) Sender: Dmitry Chagin Received: from dchagin.static.corbina.net (localhost [127.0.0.1]) by dchagin.static.corbina.net (8.14.9/8.14.8) with ESMTP id s56H3Iwl004086; Fri, 6 Jun 2014 21:03:18 +0400 (MSK) (envelope-from dchagin@dchagin.static.corbina.net) Received: (from dchagin@localhost) by dchagin.static.corbina.net (8.14.9/8.14.8/Submit) id s56H3InR004085; Fri, 6 Jun 2014 21:03:18 +0400 (MSK) (envelope-from dchagin) Date: Fri, 6 Jun 2014 21:03:18 +0400 From: Chagin Dmitry To: Mateusz Guzik Subject: Re: svn commit: r266925 - in head/sys: amd64/linux32 i386/linux kern sys Message-ID: <20140606170318.GA4076@dchagin.static.corbina.net> References: <201405311501.s4VF1pR8062552@svn.freebsd.org> <20140606154701.GA26114@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline In-Reply-To: <20140606154701.GA26114@dft-labs.eu> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 17:03:23 -0000 --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 --=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--