Bug 24913 - /etc/ld.so.preload.d drop-in configuration folder support
Summary: /etc/ld.so.preload.d drop-in configuration folder support
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-17 11:26 UTC by adrelanos
Modified: 2019-08-19 14:07 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2019-08-19 00:00:00
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description adrelanos 2019-08-17 11:26:02 UTC
File /etc/ld.so.preload can be used to preload shard objects but there is no /etc/ld.so.preload.d drop-in configuration folder supported yet.

Modifying /etc/ld.so.preload directly is appropriate for system administrators but not for linux distributions. A configuration file can only be owned by one package at the same time. A package that shipped a /etc/ld.so.preload file might overwrite the local system administator's changes.

Therefore as you may know many applications support configuration drop-in folders. Examples are /etc/default/grub.d /etc/grub.d /etc/profile.d /etc/X11/Xsession.d and many more.

Could you please add a new feature to parse /etc/ld.so.preload.d for configuration snippets?
Comment 1 Carlos O'Donell 2019-08-19 13:52:46 UTC
(In reply to adrelanos from comment #0)
> File /etc/ld.so.preload can be used to preload shard objects but there is no
> /etc/ld.so.preload.d drop-in configuration folder supported yet.

Yes there is.

You just use "include ld.so.conf.d/*.conf" in the top-level configuration.
 
> Modifying /etc/ld.so.preload directly is appropriate for system
> administrators but not for linux distributions. A configuration file can
> only be owned by one package at the same time. A package that shipped a
> /etc/ld.so.preload file might overwrite the local system administator's
> changes.

This is not correct.

Distributions can and should modify /etc/ld.so.preload to provide the semantics they expect, including adding "include ld.so.conf.d/*.conf" at the top of the configuration file.

System administrators should read their distribution instructions, and on distributions that use "/etc/ld.so.preload.d" the changes should be made as files in the configuration directory.

> Therefore as you may know many applications support configuration drop-in
> folders. Examples are /etc/default/grub.d /etc/grub.d /etc/profile.d
> /etc/X11/Xsession.d and many more.

Yes, but we also support that.

We give distributions the flexibility to put this directory anywhere by using the "include" directive.

> Could you please add a new feature to parse /etc/ld.so.preload.d for
> configuration snippets?

What is missing from the existing support?
Comment 2 Florian Weimer 2019-08-19 13:55:17 UTC
(In reply to Carlos O'Donell from comment #1)
> (In reply to adrelanos from comment #0)
> > File /etc/ld.so.preload can be used to preload shard objects but there is no
> > /etc/ld.so.preload.d drop-in configuration folder supported yet.
> 
> Yes there is.
> 
> You just use "include ld.so.conf.d/*.conf" in the top-level configuration.

Sorry, /etc/ld.so.conf and /etc/ld.so.preload are two different files with different parsers and capabilities.  The dynamic loader does not read /etc/ld.so.conf  at all.
Comment 3 Carlos O'Donell 2019-08-19 14:04:15 UTC
(In reply to Florian Weimer from comment #2)
> (In reply to Carlos O'Donell from comment #1)
> > (In reply to adrelanos from comment #0)
> > > File /etc/ld.so.preload can be used to preload shard objects but there is no
> > > /etc/ld.so.preload.d drop-in configuration folder supported yet.
> > 
> > Yes there is.
> > 
> > You just use "include ld.so.conf.d/*.conf" in the top-level configuration.
> 
> Sorry, /etc/ld.so.conf and /etc/ld.so.preload are two different files with
> different parsers and capabilities.  The dynamic loader does not read
> /etc/ld.so.conf  at all.

Oh! I thought we used exactly the same parser internally for both. I see what you mean though in elf/rtld.c we have a completely different parser.
Comment 4 Carlos O'Donell 2019-08-19 14:07:28 UTC
(In reply to Carlos O'Donell from comment #3)
> (In reply to Florian Weimer from comment #2)
> > (In reply to Carlos O'Donell from comment #1)
> > > (In reply to adrelanos from comment #0)
> > > > File /etc/ld.so.preload can be used to preload shard objects but there is no
> > > > /etc/ld.so.preload.d drop-in configuration folder supported yet.
> > > 
> > > Yes there is.
> > > 
> > > You just use "include ld.so.conf.d/*.conf" in the top-level configuration.
> > 
> > Sorry, /etc/ld.so.conf and /etc/ld.so.preload are two different files with
> > different parsers and capabilities.  The dynamic loader does not read
> > /etc/ld.so.conf  at all.
> 
> Oh! I thought we used exactly the same parser internally for both. I see
> what you mean though in elf/rtld.c we have a completely different parser.

We can probably refactor some of parse_conf_include. I'd hate to have this code duplicated.