This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to set a system-wide library path policy?


On 6/7/19 10:53 AM, Jeffrey Walton wrote:
I'm having trouble figuring out how to setup library path policy on Fedora 29.

The system loader is in glibc. Adding libc-help to the CC.

I need to articulate to the system loader:

1. programs in /bin must only link to libs in /lib64
2. programs in /usr/bin must only link to libs in /usr/lib64
3. programs in /usr/local/bin may use libraries in /usr/local/lib64 or
/usr/lib64

OK.

As far as I know, the distro supplies (1) and (2). They know nothing
about my libraries in /usr/local. When the distro is ready, it will
push updated programs and libraries as needed. The distro binaries
should not use my libraries.

Why would your distro binaries use your libraries? Such libraries are
not present at static link time when they are built in the Feodra builders.

The only reason your distro libraries would be used is if you used
LD_LIBRARY_PATH that pointed to them, in which case you would be altering
the global search order.

The reason I need it is, the libs in /usr/local have various
compatibility problems. I've had bash, grep and sed from /usr and
/usr/bin die because I built a library in /usr/local with a sanitizer,
and the program or another library had undefined behavior or a memory
error that surfaced. It basically makes the system unusable.

How did your system binaries end up using libraries from /usr/local/lib64?

Did you use LD_LIBRARY_PATH?

Additional problems I have managed to side-step so far include
removing unaligned access in /usr/local programs and libraries.
Sometimes that involves modifying a struct. Different stuct
definitions are surely going to cause problems.

It will cause problems.

How do I tell the system loader to only use distro libraries for
distro binaries?

Don't run them with options that cause the dynamic lodaer to search
for libraries in alternate locations?

Alternative, and this is a heavy hammer option, you use the LD_AUDIT
mechanism and write an audit module that rewrites the lookup paths
for system binaries to *never* look in /usr/local-anything.

See `man rtld-audit`, and la_objsearch().

--
Cheers,
Carlos.


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