public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael B. Trausch" <mike-cRPrJ27hGUicqzYg7KEe8g@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Apparent bug in dlopen(3) documentation
Date: Tue, 21 Oct 2008 16:53:34 -0400	[thread overview]
Message-ID: <20081021165334.02caa540@zest> (raw)

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

The documentation says:

       o   If  the  environment  variable  LD_LIBRARY_PATH  is
           defined to contain a colon-separated list of direc‐
           tories, then these are searched.   (As  a  security
           measure  this  variable  is ignored for set-user-ID
           and set-group-ID programs.)

However, this is not (completely) the case, as demonstrable by:

Tuesday, 2008-Oct-21 at 16:50:55 - mbt@zest - Linux v2.6.27
Ubuntu Intrepid:[1-59/7133-0]:dl-test> ./dlc dl1.so
LD_LIBRARY_PATH=(null)
LD_LIBRARY_PATH=.
dlc: dl-caller.c:46: main: Assertion `module != ((void *)0)' failed.
zsh: abort (core dumped)  ./dlc dl1.so

Tuesday, 2008-Oct-21 at 16:50:57 - mbt@zest - Linux v2.6.27
Ubuntu Intrepid:[1-60/7134-134]:dl-test> LD_LIBRARY_PATH=. ./dlc dl1.so
LD_LIBRARY_PATH=.
LD_LIBRARY_PATH=.
entrypoint_1() has been called.
entrypoint_2() has been called.
1

It would appear that dlopen(3) only considers LD_LIBRARY_PATH at the
time the executable was run, not after the executable alters its own
environment.  Either that, or it uses the LD_LIBRARY_PATH from the
process' parent, not its own environment.  Not sure which, but the
documentation should probably be updated to reflect this fact.  The way
it is written now would indicate that you could modify LD_LIBRARY_PATH
from within the program and load libraries in different locations.  I
suspect this is done for reasons of security, but it'd still be good to
be documented.

	Thanks,
	Mike

-- 
My sigfile ran away and is on hiatus.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2008-10-21 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 20:53 Michael B. Trausch [this message]
2008-10-27 15:40 ` Apparent bug in dlopen(3) documentation Michael Kerrisk

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=20081021165334.02caa540@zest \
    --to=mike-crprj27hguicqzyg7kee8g@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox