This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: LD_LIBRARY_PATH/LD_RUN_PATH


Yes, -rpath is respected by setgid/setuid programs. We use it here in
our product.

Eric Dana
BMC Software Inc.

-----Original Message-----
From: Nathan Myers [mailto:ncm@nospam.cantrip.org]
Sent: Thursday, November 01, 2001 5:28 PM
To: libstdc++@gcc.gnu.org
Subject: Re: LD_LIBRARY_PATH/LD_RUN_PATH


On Thu, Nov 01, 2001 at 04:52:35PM -0500, Phil Edwards wrote:
> On Thu, Nov 01, 2001 at 03:02:23PM -0500, Balaraman S (Bala) wrote:
> > When I turnon setuid bit for an application then
> > LD_LIBRARY_PATH/LD_RUN_PATH are not used to search shared library.
> 
> Of course not.  It's a security feature that has nothing to do with the
> compiler or the C++ library.  Read the man page for ld.so for more.

In particular, look up -rpath option on ld.  To get it from g++, 
you might have to say "-Wl,-rpath -Wl,/usr/local/foo".  I think 
"-Wl,-R/usr/local/foo" might have the same effect, as might setting
"LD_RUN_PATH=/usr/local/foo" in the *build* environment.   But you'll
have to try them.  (You might just be out of luck.  I can't find any
docs to say whether ld.so ignores -rpath options on setgid programs.)

Nathan Myers
ncm at cantrip dot org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]