From owner-svn-src-all@FreeBSD.ORG Fri Jun 6 15:47:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA9E5647; Fri, 6 Jun 2014 15:47:06 +0000 (UTC) Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [IPv6:2a00:1450:400c:c03::22a]) (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 E87FD208D; Fri, 6 Jun 2014 15:47:05 +0000 (UTC) Received: by mail-we0-f170.google.com with SMTP id u57so3109299wes.1 for ; Fri, 06 Jun 2014 08:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=AFZq6ZM9MyYJZ+DCgr1Scz3ZcLEhj0T61XijrjLeONs=; b=SEfCkkS//02UvJ96NJZ4URlZz3goE8sgrHj9IzlML/KrxeUBwCdig8lAk/UHtaTy79 +38vYtphFmwxlbOAh501VAPNOP0oczvrGVILKjOap8gsIZ8dY5uL5xkiVjZhDCUEPBJ2 JsJcr60rnUdADBrPS80TzBsX6FzwQ4Eo4jsnY8g4DZBKS4+81jdJ7SHo9zitUeKyn9z1 c9Y+VeNUoBPUfaylcSYXu3D/M52xzGAPDthA9dzzvDFP5+siPt7h2FyCiLGJQrJ7nBZO rfNPwg49xeb+o0xMa8WZJle5BOcWt0v4aHoApRv7UVBirFjmaBqzCsgkC+hmebPndItM Vgsw== X-Received: by 10.180.94.163 with SMTP id dd3mr6631485wib.26.1402069624164; Fri, 06 Jun 2014 08:47:04 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id b19sm22023404wic.5.2014.06.06.08.47.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 06 Jun 2014 08:47:03 -0700 (PDT) Date: Fri, 6 Jun 2014 17:47:01 +0200 From: Mateusz Guzik To: Dmitry Chagin Subject: Re: svn commit: r266925 - in head/sys: amd64/linux32 i386/linux kern sys Message-ID: <20140606154701.GA26114@dft-labs.eu> References: <201405311501.s4VF1pR8062552@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201405311501.s4VF1pR8062552@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 15:47:06 -0000 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. > + 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