[v6,0/4] Add system-wide tunables

Message ID xn5x6vtfpb.fsf@greed.delorie.com (mailing list archive)
Headers
Series Add system-wide tunables |

Message

DJ Delorie March 17, 2026, 1:20 a.m. UTC
  This patch series is the initial implementation of system-wide
tunables, which I mentioned a while ago.

The first part has ldconfig read tunable information from
/etc/tunables.conf and store it to /etc/ld.so.cache.  Reusing ldconfig
means no new documentation or training would be required of sysadmins,
or reprogramming of distro packaging.

The second part optimizes the loading of /etc/ld.so.cache and allows
for it to be loaded independently of searching for libraries, so that
tunables information can be loaded as needed.

The third part applies the stored tunable information to the running
application.

The fourth part adds simple filtering, allowing the admin to override
or augment tunables on a per-process basis, like this:

	glibc.malloc.whatever=10
	[proc:/usr/bin/qemu]
	glibc.malloc.whatever=20

Note that such filters only last until EOF or the beginning of the
next included config file.

Changes since v1: fixed format bug in error() and rebased.  No other
  changes.

Changes since v2: Added per-process filter.  Rebased.  Probably various
  tweaks and minor changes.

Changes since v3/v4: printf cleanups, remove custom dl_str*()
  functions, off-by-one error, new [proc:*] syntax.

Changes since v5:
  - rebase on ldconfig parseconf breakout
    - makes callback's line non-const
  - use error_at_line instead of printf
  - fix tunable list length logic
  - add ld.so.cache caching test
  - optimize cache "dirty" logic
  - remove unneded -DUSE_LDCONFIG
  - add AT_SECURE logic and filters
  - ldconfig parser: pass NULL line at file boundaries

DJ Delorie (4):
  Add system-wide tunables: ldconfig part
  Add system-wide tunables: cache ld.so.cache
  Add system-wide tunables: Apply tunables part
  Add system-wide tunables: Filters

 csu/libc-start.c                              |   2 +-
 elf/Makefile                                  |   8 +
 elf/cache.c                                   |  66 ++-
 elf/dl-cache.c                                | 284 +++++++++----
 elf/dl-tunables.c                             | 137 ++++++-
 elf/dl-tunables.h                             |   2 +-
 elf/ldconfig-parse.c                          |   6 +-
 elf/ldconfig.c                                |  26 +-
 elf/tst-ldconfig-cache.c                      | 134 ++++++
 elf/tst-ldconfig-cache.root/etc/ld.so.conf    |   3 +
 elf/tst-ldconfig-cache.root/ldconfig.req      |   0
 .../tst-ldconfig-cache.script                 |   7 +
 elf/tst-tunconf1.c                            |  36 ++
 elf/tst-tunconf1.root/etc/tunables.conf       |  15 +
 elf/tst-tunconf1.root/ldconfig.run            |   0
 elf/tst-tunconf1.root/postclean.req           |   0
 elf/tunconf.c                                 | 381 ++++++++++++++++++
 elf/tunconf.h                                 |  46 +++
 sysdeps/generic/dl-cache.h                    |   6 +
 sysdeps/generic/ldconfig.h                    |   6 +-
 sysdeps/mach/hurd/dl-sysdep.c                 |   2 +-
 sysdeps/unix/sysv/linux/dl-sysdep.c           |   2 +-
 22 files changed, 1070 insertions(+), 99 deletions(-)
 create mode 100644 elf/tst-ldconfig-cache.c
 create mode 100644 elf/tst-ldconfig-cache.root/etc/ld.so.conf
 create mode 100644 elf/tst-ldconfig-cache.root/ldconfig.req
 create mode 100644 elf/tst-ldconfig-cache.root/tst-ldconfig-cache.script
 create mode 100644 elf/tst-tunconf1.c
 create mode 100644 elf/tst-tunconf1.root/etc/tunables.conf
 create mode 100644 elf/tst-tunconf1.root/ldconfig.run
 create mode 100644 elf/tst-tunconf1.root/postclean.req
 create mode 100644 elf/tunconf.c
 create mode 100644 elf/tunconf.h