From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4817 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: MUSL_LIBRARY_PATH ? Date: Sun, 6 Apr 2014 13:22:54 -0400 Message-ID: <20140406172254.GA26358@brightrain.aerifal.cx> References: <20140406161827.GY26358@brightrain.aerifal.cx> <53418C3B.8060700@skarnet.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1396804996 24239 80.91.229.3 (6 Apr 2014 17:23:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Apr 2014 17:23:16 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4821-gllmg-musl=m.gmane.org@lists.openwall.com Sun Apr 06 19:23:09 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WWqmi-0003gm-P7 for gllmg-musl@plane.gmane.org; Sun, 06 Apr 2014 19:23:08 +0200 Original-Received: (qmail 27727 invoked by uid 550); 6 Apr 2014 17:23:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 27719 invoked from network); 6 Apr 2014 17:23:06 -0000 Content-Disposition: inline In-Reply-To: <53418C3B.8060700@skarnet.org> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4817 Archived-At: On Sun, Apr 06, 2014 at 06:17:47PM +0100, Laurent Bercot wrote: > On 06/04/2014 17:18, Rich Felker wrote: > >The obvious workaround is to put a shell script in place of your > >actual binary, and have it do: > > > > exec "$ldso" -- "foo.bin" "$@" > > > >or similar. Alternatively a minimal static-linked binary could be used > >instead of shell script to make it perform better and eliminate some > >of the risks of shell script processing. > > Shameless plug: this is the perfect use case for execline. > http://skarnet.org/software/execline/ > An execline script will perform better here than a shell script, without > the risks, and still offer the editability of a script. Actually execline is not a solution for this, since the #! line that invokes execline has to contain an absolute pathname to execline, which is exactly the same problem we were trying to solve to begin with: the need to install the program interpreter at a fixed absolute pathname on a system you might not have root on. This can be avoided by using /usr/bin/env if you're willing to trust that the env command is at that location and and the user adds execline to their PATH, but that's fragile and adds yet another level of indirection at program exec time... The idea of the minimal static-linked binary as a solution is that it would not need a program interpreter (dynamic linker or #! type) but instead could do its own search (e.g. relative to its own binary) for the dynamic linker to invoke. Rich