[PATCH v9 0/5] Add system-wide tunables
DJ Delorie
dj@redhat.com
Fri Jun 26 03:30:39 GMT 2026
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.
The fifth part is the manual additions.
Changes since v8:
- overwritable -> overridable
- style fixes
- parse unsigned values with %llu
- _dl_load_cache_tunables tests stricter, test flag_offset too
- add "none" filter, reject unknown filters
- use xmalloc in ldconfig
- fix onlysecure length
Changes since v7:
- added word-sized options to tunables.conf
- removed STRICT option
- make secure/insecure into onlysecure/anysecure/insecure
- add name/value length check
- unmap tmp cache if extensions are corrupt
- set initialized flag for string tunables
- make ldconfig -p more readable, including flag names.
- make "nonsecure" the default
- fix [proc:foo] parser
- no tunconf extension if no entries
- remove chroot_canon decl from tunconf.c
- make entry_list_next local
- warn for unrecognized tunables
Changes since v6:
- elf/tunconf.c : fix whitespace issues
- elf/cache.c : free tunable_data
- elf/cache.c : check extensions for overflow
- elf/dl-cache.c : fix tmp_cachesize logic
- elf/dl-cache.c : comment style tweaks
- elf/dl-cache.c : remove superfluous comment
- elf/dl-cache.c : additional data validation
- elf/tunconf.c : fix whitespace issues
- elf/tunconf.c : use error_at_line instead of printf
- elf/tunconf.c : fix buffer overflow, add comments.
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
Changes since v3/v4: printf cleanups, remove custom dl_str*()
functions, off-by-one error, new [proc:*] syntax.
Changes since v2: Added per-process filter. Rebased. Probably various
tweaks and minor changes.
Changes since v1: fixed format bug in error() and rebased. No other
changes.
DJ Delorie (5):
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
Add system-wide tunables: manual
csu/libc-start.c | 2 +-
elf/Makefile | 9 +
elf/cache.c | 108 ++++-
elf/dl-cache.c | 312 +++++++++----
elf/dl-tunables.c | 140 +++++-
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 | 14 +
elf/tst-tunconf1.root/ldconfig.run | 0
elf/tst-tunconf1.root/postclean.req | 0
elf/tunconf.c | 434 ++++++++++++++++++
elf/tunconf.h | 45 ++
manual/tunables.texi | 94 ++++
sysdeps/generic/dl-cache.h | 20 +
sysdeps/generic/ldconfig.h | 6 +-
sysdeps/mach/hurd/dl-sysdep.c | 2 +-
sysdeps/unix/sysv/linux/dl-sysdep.c | 2 +-
23 files changed, 1305 insertions(+), 97 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
--
2.47.3
More information about the Libc-alpha
mailing list