mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Re: MUSL_LIBRARY_PATH ?
Date: Sun, 6 Apr 2014 12:18:27 -0400	[thread overview]
Message-ID: <20140406161827.GY26358@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAGDMk9FBqRUm_gejSYT2VgLpqqpwcSv0v+bO+GpBEtGOVo0_=g@mail.gmail.com>

On Sun, Apr 06, 2014 at 10:38:53AM -0400, John Mudd wrote:
> Thanks for the replies! I now have a proper ld-musl-i386.path file
> containing the paths for my libraries. I've unset LD_LIBRARY_PATH and my
> musl built Python works well.
> 
> I'm still configuring musl with --syslibdir=/tmp/musl/lib/. I agree /tmp is
> a poor choice. But I use three different logins on my dev, test and prod
> machines and it's not practical to get root access on the test or prod PCs.
> So /tmp is a good place to at least run experiments.
> 
> Any chance I can specify multiple (colon separated?) paths with
> the --syslibdir option? Or can I make it relative to the current user's
> home path by starting with "~"?

No, this is a kernel limitation. Processing the PT_INTERP header and
loading the dynamic linker from the pathname stored there is performed
by the kernel, and only absolute pathnames are supported. It would be
really nice if $ORIGIN expansion were supported by the kernel, but
it's not.

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.

Another alternative (much more advanced) would be removing the
PT_INTERP header entirely from dynamic programs and instead static
linking into them some minimal loader code that would find and mmap
the dynamic linker and transfer control to it. IIRC this is actually
how a.out dynamic linking worked long, long ago.

Rich


  reply	other threads:[~2014-04-06 16:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 14:11 John Mudd
2014-04-01 16:19 ` u-igbb
2014-04-01 16:21   ` Justin Cormack
2014-04-01 16:27 ` writeonce
2014-04-01 16:40 ` Rich Felker
2014-04-06 14:38 ` John Mudd
2014-04-06 16:18   ` Rich Felker [this message]
2014-04-06 17:17     ` Laurent Bercot
2014-04-06 17:22       ` Rich Felker
2014-04-06 20:27         ` Laurent Bercot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140406161827.GY26358@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).