|
发表于 2003-5-4 07:17:24
|
显示全部楼层
it is not so easy. c&p from web.
You can have multiple version of any shared libraries under Linux. When they have different version numbers then the dynamic loader (ld.so) will find the one that a given binary is linked against. That's why there are symlinks under /lib pointing from major versions to the most recent minor versions. (Study the links under there to see what I mean).
However, as you say, there can sometimes be problems with this automatic loading mechanism. Sometimes the author of a package needs to specify a a more tight binding to some shared libraries. However, that involves recompiling it.
There is another way. You can use LD_PRELOAD_PATH and/or LD_LIBRARY_PATH environment variable to over-ride the normal library loading mechanism of normal (non-SUID) programs. (The loader over-ride is disabled when EUID doesn't match RUID, as is the case while running SUID programs. If this wasn't true it would be trivially easy to bypase system security with custom libraries and access to any dynamically linked SUID binary).
They way to use the LD_*_PATH variables is to sequester your special libraries in their own directory, and write small wrapper script to set and export the LD_*_PATH environment variable, then execute the necessary program. You do this with each program that needs the special library version.
Read the ld.so man page for more details. |
|