public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: noloader@gmail.com
Cc: Binutils <binutils@sourceware.org>, libc-help <libc-help@sourceware.org>
Subject: Re: How to set a system-wide library path policy?
Date: Fri, 07 Jun 2019 20:46:00 -0000	[thread overview]
Message-ID: <d81a96d4-7896-bab7-1396-5c39a7be881a@redhat.com> (raw)
In-Reply-To: <CAH8yC8mpfEFmu8G3XHfuG=6mMHJt6-QOFaD6b2ONkZWyZJ00dA@mail.gmail.com>

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.

       reply	other threads:[~2019-06-07 20:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAH8yC8mpfEFmu8G3XHfuG=6mMHJt6-QOFaD6b2ONkZWyZJ00dA@mail.gmail.com>
2019-06-07 20:46 ` Carlos O'Donell [this message]
2019-06-09 21:34   ` Jeffrey Walton
2019-06-11 19:57     ` Jeffrey Walton
2019-06-11 20:34       ` Carlos O'Donell
2019-06-11 20:56         ` Florian Weimer

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=d81a96d4-7896-bab7-1396-5c39a7be881a@redhat.com \
    --to=carlos@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=libc-help@sourceware.org \
    --cc=noloader@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).