python stripping LD_LIBRARY_PATH?

Mitch Chapman Mitch.Chapman at bioreason.com
Tue Feb 26 16:11:47 EST 2002


Jeff Shipman - SysProg wrote:
> 
> I never got a response to this and I really don't
> understand why it's happening. I would appreciate
> any help anyone can give me. If there's another place
> I should be posting this, please let me know.
> 
> -------- Original Message --------
> 
> I've got a wrapper so I can run a SUID python script [...]

> The problem I'm having is that the LD_LIBRARY_PATH
> is not showing up in os.environ. 
> [...]
> Why is python stripping out this environment variable?
> 
> I'm using:
> 
> ActivePython 2.1, build 211 (ActiveState)
> based on Python 2.1 (#1, Jun 15 2001, 02:52:41)
> [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2


Hi Jeff,

Python is not removing LD_LIBRARY_PATH.  The runtime loader 
ld.so is doing so.  I think this is for security reasons, 
i.e. to prevent someone from slipping a bogus shared library
implementation into the runtime environment of a privileged Unix
executable.  Or something like that :)

See the ld.so(8) man page.  Here's an online copy turned up 
by Google:
	http://www.cwi.nl/~aeb/linux/man2html/man8/ld.so.8.html

The relevant excerpts:
	The shared libraries needed by the program are searched 
	for in various places:
	...
	o Using the environment variable LD_LIBRARY_PATH. Except 
	  if the executable is a setuid/setgid binary, in which 
	  case it is ignored. 

-- 
Mitch Chapman
Mitch.Chapman at bioreason.com



More information about the Python-list mailing list