From patchwork Thu Oct 10 21:42:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 1995777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hk/RQKw2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XPjsy2Vlzz1xv0 for ; Fri, 11 Oct 2024 08:43:02 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E5D96385AC25 for ; Thu, 10 Oct 2024 21:42:59 +0000 (GMT) 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 850513858D37 for ; Thu, 10 Oct 2024 21:42:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 850513858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 850513858D37 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=1728596566; cv=none; b=G2sYnNLu84pdAtH40s4Gs9uJ8u1aqwLKb7lMTrdK1uON5kgg9neY4yameYXCTzKFCexaNWewNZcrOaA9IC3U0alxe65yitFto3VSqcXFTpdQ7V3KgR9EPU3UpNmW+CE3fzmJYUw34jG/B9OBwXYsd9xpm8VnjQ7jfQGX4mLzHUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728596566; c=relaxed/simple; bh=BFm1EQMfSA0N9cBZvr0bYKk4HvnX6mLSucY12GNoHkk=; h=DKIM-Signature:Date:From:To:Message-ID:Subject; b=ME54R2UWYFEHR9OjXvL146wT3UVT4XYduIcbFqA09NaqcLnJUWwS4xGa3g8/GbzP/jXaX0G1h1bQNhd8S72GOYMYlWA5Me9Mib+N45+I+4IYp5RH3zJH76KL7o0ULsytdw2CY5EYODPIYKBb7ByUbWV1RTvERgvzbboPCmxGuA0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728596563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type; bh=91oYs7SK8J+tEfBQsqaBeidGRCG2qunuIsjVXb1QepY=; b=hk/RQKw27zGmtrtU0FcH3XttnLJxaqpi2ABxoAs+vnqMlDUUYFKZHUlG+LjCRRqPhHKMoD Qc8HwvSoShSl5JiMXHxVBWkaKBF1IxmBSQ92UYFolZGJGs4ff1DW/LDKwkGYRzu5n4hiVN dzk56jOZeKlSi8Z5cvcNoUmQGRcGGbw= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-149-lcR5aKMuNWix6JRMja3Lzw-1; Thu, 10 Oct 2024 17:42:41 -0400 X-MC-Unique: lcR5aKMuNWix6JRMja3Lzw-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F34D91955EA8 for ; Thu, 10 Oct 2024 21:42:40 +0000 (UTC) Received: from greed.delorie.com (unknown [10.22.8.53]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C18819560AA for ; Thu, 10 Oct 2024 21:42:40 +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 49ALgcXH4137361 for ; Thu, 10 Oct 2024 17:42:38 -0400 Date: Thu, 10 Oct 2024 17:42:38 -0400 From: DJ Delorie To: libc-alpha@sourceware.org Message-ID: Subject: [PATCH v3 0/4] System-wide tunables X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-4.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, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.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~incoming=patchwork.ozlabs.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 [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. 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 | 5 + elf/cache.c | 66 +++- elf/dl-cache.c | 278 +++++++++---- elf/dl-tunables.c | 118 +++++- elf/dl-tunables.h | 2 +- elf/ldconfig.c | 21 +- elf/tst-tunconf1.c | 17 + elf/tst-tunconf1.root/etc/tunables.conf | 2 + elf/tst-tunconf1.root/ldconfig.run | 0 elf/tst-tunconf1.root/postclean.req | 0 elf/tunconf.c | 498 ++++++++++++++++++++++++ elf/tunconf.h | 43 ++ sysdeps/generic/dl-cache.h | 6 + sysdeps/generic/ldconfig.h | 2 + sysdeps/mach/hurd/dl-sysdep.c | 2 +- sysdeps/unix/sysv/linux/dl-sysdep.c | 2 +- 17 files changed, 970 insertions(+), 94 deletions(-) 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