From patchwork Tue Mar 17 01:20:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 59822 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id DE8624BB5920 for ; Tue, 17 Mar 2026 01:20:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE8624BB5920 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cjAHvgyN X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 7D4AF4BB590A for ; Tue, 17 Mar 2026 01:20:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7D4AF4BB590A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7D4AF4BB590A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773710406; cv=none; b=dCikmHOm5RB6hPHIFfSp9eWpGf/H0iLjEhixW6TBGmqE4gyM6cyCVIwo7nZSfP2uyZxG9Fr5SJwFGf3T4p8Jhe5Ro+LqK5Gz29GfFy7jLLKlK7L/DINzsLs5gBTU6DQA4eKWzpNN/X9wSqNT+3aW45VJysW7V+Vbi8Ql1S6Hw0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773710406; c=relaxed/simple; bh=taO2EwZRJK2HEpCAMa2pfWJ9GCnwXMf4tng5hmVc8e4=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=SNW5HIF5Wotu2mvLKoSiffRlE/dIYGKXPNAQSI2WEerpSf05ovMJNMWMQ/UZSlS5hiX8KXbTvY6EE9/0ANEiTD3BqPF67jSN3p03zBx2tPF7vqbVMpNV8MtPDaUCCdJjgEu02ciJCpZuwaMMELFrYrBI0edDhXBBPnAvR+DvEFg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D4AF4BB590A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773710406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type; bh=F5SctPAQs1i2ACp1or7g36Qo39enpQzrA0RHMPy8iS8=; b=cjAHvgyN7AxuP2YWaEYL0jvS3egLyBx0RXXA87xdoEcMEdIxf3Lm8uEDwoncy6WNS8cjhd bw/IgO/7jdYP/JsJihAdU3oxtz4g2fyuFsKpbmMKgoTISQnvOcS743bWwVYoicwfOKCmL0 ChGAufn4dpLqeZlSNqTeueGULiMzqJc= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-FuRqv2WVNn-0WEfW_mhgDg-1; Mon, 16 Mar 2026 21:20:04 -0400 X-MC-Unique: FuRqv2WVNn-0WEfW_mhgDg-1 X-Mimecast-MFC-AGG-ID: FuRqv2WVNn-0WEfW_mhgDg_1773710404 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE3F21800281 for ; Tue, 17 Mar 2026 01:20:03 +0000 (UTC) Received: from greed.delorie.com (unknown [10.22.88.83]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8BDFC180035F for ; Tue, 17 Mar 2026 01:20:02 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.16.1/8.16.1) with ESMTP id 62H1K0ha1582638 for ; Mon, 16 Mar 2026 21:20:00 -0400 Date: Mon, 16 Mar 2026 21:20:00 -0400 Message-Id: From: DJ Delorie To: libc-alpha@sourceware.org Subject: [PATCH v6 0/4] Add system-wide tunables X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: l54ASCU0HCiL-AUih8hZyEoTEnp5P-Kap6RVgmfA2ww_1773710404 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org 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