mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: be able to break inheritance of LD_LIBRARY_PATH
Date: Fri, 28 Mar 2014 14:17:19 +0100	[thread overview]
Message-ID: <20140328131718.GH27448@port70.net> (raw)
In-Reply-To: <20140328104208.GZ8221@example.net>

* u-igbb@aetey.se <u-igbb@aetey.se> [2014-03-28 10:42:08 +0000]:
> For our software setup it is crucial (quite useful otherwise in general)
> to be able to specify the location of the dynamic libraries per binary/run
> _without_ the unconditional inheritance imposed by LD_LIBRARY_PATH.

why do you use LD_LIBRARY_PATH then?

> A very nice solution would be the ability to explicitely run a standalone
> dynamic loader, as implemented in both glibc and uclibc. We are heavily
> relying on this functionality.

what is a standalone dynamic loader and how does it solve the lib path?

if you mean a separate binary from libc.so, that does not matter much
(the loader and libc.so are interdependent on each other's internals
anyway, they are one logical unit even if in two separate files)

if you mean you can run '/lib/ld-linux.so.2 binary' then musl can do the same

> As a simpler approach I might suggest simply being able to drop
> LD_LIBRARY_PATH as soon as it has been read. An extra environment
> variable as a flag would do.

if you dont control the environment you will have other issues
(eg with LD_PRELOAD)

if you do control the env then just unset LD_LIBRARY_PATH

> Compared to a standalone loader this lacks the ability to run
> a binary with a different version of the loader/musl but at least
> makes it straightforward and safe to freely specify where to find other
> libraries.

the loader is whatever the PT_INTERP says in the elf header of the
binary, so you can set it per binary, but in general you want it to
be the same everywhere so binaries are portable
(there ar no "different versions of the loader" in musl)

in case you do a lot of lib path hacks note that the path lookup is
different in glibc than in musl:

glibc:
	1) DT_RPATH if no DT_RUNPATH is present (transitive)
	2) LD_LIBRARY_PATH
	3) DT_RUNPATH (eg set with --enable-new-dtags) (non-transitive)
	4) /etc/ld.so.cache (except with -z nodefaultlib)
	5) /lib:/usr/lib (except with -z nodefaultlib)

musl:
	1) LD_LIBRARY_PATH
	2) DT_RPATH (transitive)
	3) {interp}/../etc/ld-musl-arch.path or /lib:/usr/local/lib:/usr/lib


  parent reply	other threads:[~2014-03-28 13:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 10:42 u-igbb
2014-03-28 12:18 ` orc
2014-03-28 12:52   ` u-igbb
2014-03-28 12:27 ` Alexander Monakov
2014-03-28 13:04   ` u-igbb
2014-03-28 13:17 ` Szabolcs Nagy [this message]
2014-03-28 14:00   ` u-igbb
2014-03-28 15:25     ` Szabolcs Nagy
2014-03-28 15:34       ` Alexander Monakov
2014-03-28 16:02     ` PATCH (Re: [musl] be able to break inheritance of LD_LIBRARY_PATH) u-igbb
2014-03-28 16:34 ` be able to break inheritance of LD_LIBRARY_PATH Daniel Cegiełka
2014-03-28 17:50   ` u-igbb
2014-03-28 18:03     ` Daniel Cegiełka
2014-03-28 18:21       ` u-igbb
2014-03-28 19:46 ` Rich Felker
2014-03-28 21:07   ` u-igbb
2014-03-28 21:48     ` Rich Felker
2014-03-29  7:25       ` u-igbb

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=20140328131718.GH27448@port70.net \
    --to=nsz@port70.net \
    --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).