[LFS Trac] #2081: Chapter 5 Glibc looks at /etc/ld.so.preload

Greg Schafer gschafer at zip.com.au
Thu Sep 20 14:55:01 PDT 2007

LFS Trac wrote:

> #2081: Chapter 5 Glibc looks at /etc/ld.so.preload
> --------------------------------------------+-------------------------------
>  Reporter:  alexander at linuxfromscratch.org  |       Owner:  lfs-book at linuxfromscratch.org
>      Type:  defect                          |      Status:  new                          
>  Priority:  normal                          |   Milestone:  7.0                          
> Component:  Book                            |     Version:  6.3                          
>  Severity:  normal                          |    Keywords:                               
> --------------------------------------------+-------------------------------
>  The problem is that Chapter5 glibc looks into the /etc/ld.so.preload file
>  instead of, e.g.,  /tools/etc/ld.so.preload.
>  Suppose that /etc/ld.so.preload contains one line: /usr/lib/libaoss.so.0
>  (I am sick and tired of OSS-only applications that by definition cannot
>  respect the software-only ALSA PCM volume control on my Intel HD audio
>  chip, and too lazy to change the .desktop files each time I upgrade these
>  applications). Then, programs compiled against Chapter 5 glibc will not be
>  able to run - the dynamic linker will attempt to load
>  /usr/lib/libaoss.so.0 and notice that it depends upon libasound.so.2 which
>  is not available in the default library search path.
>  Yes, I know that listing /usr/lib/libaoss.so.0 instead of just
>  libaoss.so.0 is my user error, but it is still easy to change Chapter 5
>  Glibc so that it doesn't look at /etc/ld.so.preload. Just change the
>  static const char preload_file[] initialization in elf/rtld.c.
>  The bug also applies to DIY Linux.


Build method assumes a sane build host. Hosts (ab)using /etc/ld.so.preload
are of questionable sanity. From the Glibc source:

"There usually is no ld.so.preload file, it should only be used for
emergencies and testing. <snip>..since it is not for production use."

Yes, over the years folks have (ab)used it for dubious purposes, but that
doesn't escape the fact its use is undocumented and not supported by
upstream (ld.so man page doesn't count because it's not from Glibc).


More information about the lfs-book mailing list