From patchwork Mon Jul 6 21:14:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138612 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1DFD94BA23D7 for ; Mon, 6 Jul 2026 21:16:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DFD94BA23D7 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=z5ErcBx5 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id 66C6A4BA543C for ; Mon, 6 Jul 2026 21:15:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66C6A4BA543C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 66C6A4BA543C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1035 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372531; cv=none; b=YxO4RifWz8ibf5+28EIy4EDL5oO5RhP11EnTGjvaCUaNlR1U9MRc4G3Y4hFT7RIwOZiUq6jEL4NAxQjmt4RBMB73IxHXO4g1cr0cncNrvkB1D8WwxigfYzOTtmtzEacZxEpV3EIegAp8Ji0etxWWsNXFHnWnH0dMXYP9SdO7n/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372531; c=relaxed/simple; bh=c5W3ApQFFMO3M02nqtQEZVOPHBFVe155q0yblxbEGhs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cmvwvXJP+EkZ892nJkEdSVvrlgPagukeoFOksFuSnXcW3by4wPRL+bN7J+oYVcUIr70FzH2PnSlGQD+TLUWgtMAV37ZiPQQOlZBYEyM7gDg4Utr56IWuE/u6inKBkGVV6n7wCAZLHLL0g5u5oWdQP/vQlTBZb7WEr0U+am/L08c= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=z5ErcBx5 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66C6A4BA543C Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-3811f512167so3241381a91.3 for ; Mon, 06 Jul 2026 14:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372530; x=1783977330; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TAu9ew0LL1G+CYxAxZDDuRumxUB2s1Xzsb58NhX86iI=; b=z5ErcBx5BJgMQR/oZYhrL6xnn+8p9n89oP6sNGYF+h1F8nHIAHXTmPh1OfqxvuWqVZ EGpR1+7VRLYLeg3ahWSLaKI5jZK6BydU2PmEGhBx2yAbJy06iX9IiX+3Y+Jcwf4ErSEu wVZs5cOFyPsvcJTbw3CYSzW7ks0CINODgaE9vU/eANwoGR99FpPZQWVtGUBg0WRToloF /z6oIKV+16ZY1dt403LjBvj8O5vYA6gt6vlVGIP7GuPMrBAWJA4isnNHFNU+6VtB2dZy oOWbXgngPZ5eBEk5pG80f+L3IAh85+e6nMQ8dewESeXYzF64ezct/QL8JXvwIQ5Vm6ni AAfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372530; x=1783977330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TAu9ew0LL1G+CYxAxZDDuRumxUB2s1Xzsb58NhX86iI=; b=JDgVlwrZ8tcEEvYuVDlCSPxhlGPwMDZKGHPAWtFnn92B/SVFFiSvXQ8mTjodcfZgyq 6jkhkataDkA+7M281goK597hvHedP/548FRMneN71IUnKxaI3vsRxkVLIBiaHyFO4E3/ qGS4P6jc3yzeGb+eHva+uenoU301AomD5ulNf6JFrehonLDMJXJMLblREIYDsjEvR5zX xBfwOxVVVATz54Oj/0NfAzIQSKSLPZvlCFtfsDZsnANqKdisOEq0CUKcr/PqL4L8zELf Q6pfarecxQY0QMEEtwgg9K32YJ6Gow/ugKX7nuANGJl3v7LLDdY7DssumeGNNLXwXLK9 JHCQ== X-Gm-Message-State: AOJu0Yykuv18maRruReHDMtjz+9C3adebLNj0GQiAuCWuxkHZ8B52hXp x5IhrXJgs2atiqah0b+LhJ16TMzL+Y7X1VF/hBqxkWCAgeDd9UIfryoC9ESiKLulasbrJppyDM3 rJ72c X-Gm-Gg: AfdE7cnmeOhZ8S9Vt/t/1clwoRUwUf2bQE5195Yl22uG8b/8dv7gcyu09dIz2EixQKJ mx8I8J6U5Dru2QONctZJhm/IPlEbN/D18oJoE+KELSlvLB6jZWbSog+4uvRnh8ZqQyd/Q4t0yM3 fsQLsA1HNvbLS8wZg7H2yOtaSH//2DHA2JkiCTewG5YKnv9WEG0k7WY9ktU93XY/QcxHxPp3wta DoePlNSCBw+Uux8PaRAH4DtfvUwrSb0e0najBweldIlWLDGjWAWaAGGIl7s/qqGjSgmYoLSogzR 8sWoV3s3bmMvIKqcZn0hMlZD4aPmJjBZNtlZ7/QGe8A8fpvzF4GBDKzyPAXBDQZjbrlJWUMB2BQ DZL4stwvYUIaIoI3uuSGpr/n6pQuJBuLRntgJfl/3rwqiNoumxF35HWRgoV92SPnUGjnrOrzrDe v5jLxZIwxU4Cf3DPCNOiW5VGSLaRyqPUPLd3o= X-Received: by 2002:a17:90b:2752:b0:36a:fcf5:64bd with SMTP id 98e67ed59e1d1-3875650bb6cmr2278842a91.2.1783372530087; Mon, 06 Jul 2026 14:15:30 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:29 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 1/8] elf: Bound the tunable cache string table against the mapping size Date: Mon, 6 Jul 2026 18:14:37 -0300 Message-ID: <20260706211524.3801466-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 _dl_load_cache_tunables bounds each entry's string offsets against [s_start, start + cache_new->len_strings], but len_strings is an unvalidated 32-bit field from ld.so.cache and s_start/s_end were int. A corrupt cache with an oversized len_strings could make s_end exceed the mapping (or overflow), letting an offset point outside the mmap; the following strcmp/__strdup would then read unmapped memory. Compute the offsets as size_t and clamp s_end to cachesize, matching how the regular library lookup bounds string offsets against the mapping size. Checked on x86_64-linux-gnu and i686-linux-gnu. --- elf/dl-cache.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/elf/dl-cache.c b/elf/dl-cache.c index d05afe27004..5d8d3cae908 100644 --- a/elf/dl-cache.c +++ b/elf/dl-cache.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include #include @@ -649,9 +650,16 @@ _dl_load_cache_tunables (const char **data) != (void *) & tec[count]) return NULL; - /* Validate each entry. */ - int s_start = (const char *) (&cache_new->libs[cache_new->nlibs]) - *data; - int s_end = s_start + cache_new->len_strings; + /* Validate each entry. The string table lies between the file entries + and the end of the mapping; clamp its end to CACHESIZE so that a bogus + len_strings cannot make an offset point outside the mapped file. */ + size_t s_start = (const char *) (&cache_new->libs[cache_new->nlibs]) - *data; + size_t s_end; + if (s_start >= cachesize + || INT_ADD_WRAPV (s_start, cache_new->len_strings, &s_end)) + return NULL; + if (s_end > cachesize) + s_end = cachesize; for (i = 0; i < count; i ++) { if (thc->tunables[i].name_offset < s_start From patchwork Mon Jul 6 21:14:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138615 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 401614BA23D7 for ; Mon, 6 Jul 2026 21:16:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 401614BA23D7 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GbEdPowA X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id E2C3E4BA2E09 for ; Mon, 6 Jul 2026 21:15:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2C3E4BA2E09 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E2C3E4BA2E09 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372533; cv=none; b=PrCQui8VOhtfnYVWZfYWzLCbAt+ZhPPc2JttZmm7AZnWUNVkh7qJPLEy1pnj53c0X0H7Le4jMuS0tF3uZo1LYWV4yP09ZYUbnBMkWk3hJvzZ5rouT5nav9vkgBNZq7b51dBUYlC+7yjfmByzSEHpSi1jWbr/WT9rBZegeVXyYPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372533; c=relaxed/simple; bh=Eb0cSe0A6bxTx+FBDJzPV0vmS7jFivk/FvwzwAtPiTg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BeVv2HbtuBXIevoqWczEM1xQfQiL3YkJTsxAolyTdMOBD5BYYuuXn5oMMcx7pstvGRBjfFPVChG5LulRasbyKdHWJ+HPXIaE7nFXYPrESLzaCYfzQyj5YI/NaIDccBW3K2vAepVuUXmEN6XsDkOFAxjD7gSTNxpCeP8UqcoQ/jw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GbEdPowA DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2C3E4BA2E09 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-37fc02e660bso2825731a91.0 for ; Mon, 06 Jul 2026 14:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372532; x=1783977332; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j7TWkTeoCrMLBgcmqCawXcTd//kpMtXiAGvmHT1Uxig=; b=GbEdPowAW//94cZ3bOU3n7RzwLsDTgfLpYRaenSj1hprTuURqVNmoOv2u/W3wGQP7m YD8XSsBcBnZN+KbedIRFJgo1WuDLNHopbjkII5aUUlXRtusGBW0vYM1CZTWGbELjdn9M qnxrwCF5IIo6QH+WOefocLTDVeL4MUHQuZQwC9bOvbh8TVy1Jikdgkr6XPFJa3b2p5pb 9d2tW/Yiy3Hw1UBiy0IUXmy90MKGkAoTxFUDbkj4UxAJ80gwqrDS07lru5M/BV1Xm8TL sQLEIIt0N8J3dk7kKNky7SauBuZu+Bnx9KzBnry/eDfekyV/U+e540gUl5LrfCMfRt8I RLpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372532; x=1783977332; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=j7TWkTeoCrMLBgcmqCawXcTd//kpMtXiAGvmHT1Uxig=; b=aVFvamXbKRneSHwLiQ9EypCFgFebMbVWb3rYHVepk498RcZlQF+80LojZ3QskMBmoW 2whaoh0zvq7rfOleL2++rtJRlyQNLVXPXc4JaPIDTAF3U2a30WM5mV7KlpKNIamT5gIb TfK8WSSnpAddjk0uiPPCe5adj4OahGnm8WdUj6/XEI4+HOvP1rKfUo5F3u3hQ0Ffqdmk eC2WEMraLWISN5EevmMBSF0PS5M9Fn6ovLWAMEL0fMcSzYCN3B0ueF4lv/2/rr6z3S6t VILFfEAZhM6e2EjHG24Z4qTBJ3R1l3ao/KrU/Rnm9BHDnLdZgzPgoWIs5U3bWAHOhNJR a2Ng== X-Gm-Message-State: AOJu0YxDDFLlkuhoA8Nid99nxtoSxB+90U7IrJlNUkPfcv5iBHdNLOOb sJNtCjaD5KBLjrzSKoOIFezZQmKsaMPnX/9gM0nU+dv21w6TLwLDVRe76qMN8vZPxUVcQTM3ZcX otPr5 X-Gm-Gg: AfdE7cmV28VB8EIXY/lWFDolX+OUcwGuebi4mj//XuD1n7IVTrPyEkFC83aqCC8/i8I 86+TdK5YULfvgCF5WaAPR0IMsHh7WTSFE2zrC2tHARp1ho18DrbS5RrH4aHlxjyE3pmH5Z8li2f cZO9pfEzQYneXLKeQhDWuFHDdXgQO2DO4B0nIC82uZYh6mxrik7rGJrWDbAjH/6gYVyDW0mDbQ8 GZhsAFK9IpJViKhL/AMpIaaeE6GdvuxyUojZN9Y3/CzyNubDR++tftZpVglkw9UZwgAgtoKGeoM EYjg+7nUlRYgJNULhNZH9hXI9XYfLRstlsuIDczupDB+KaDYW/L+CRgD8XJTxkGUVpZnseZIguF 3pgYhQXr6UHlwrWj/I8C/mgE/kuKC8KxpjLEaxQDXySQ8xfJFR2n8tGp27JrK/MM4N4cK/ekDd+ OhBSfDW0vXXqd/n9ksKN7l1xxP X-Received: by 2002:a17:90b:2709:b0:380:9d0d:7af8 with SMTP id 98e67ed59e1d1-38758260ad3mr2276012a91.20.1783372531703; Mon, 06 Jul 2026 14:15:31 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:31 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 2/8] elf: Verify the tunable cache header signature and version Date: Mon, 6 Jul 2026 18:14:38 -0300 Message-ID: <20260706211524.3801466-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 The tunable header signature and version are written by ldconfig but never checked them on read, so the version field was inert. Reject the section unless both match. Checked on x86_64-linux-gnu and i686-linux-gnu. --- elf/dl-cache.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elf/dl-cache.c b/elf/dl-cache.c index 5d8d3cae908..498196d0aa3 100644 --- a/elf/dl-cache.c +++ b/elf/dl-cache.c @@ -642,6 +642,11 @@ _dl_load_cache_tunables (const char **data) thc = (struct tunable_header_cached *) ext.sections[cache_extension_tag_tunables].base; + + /* Reject data produced by a different tunable cache format. */ + if (thc->signature != TUNCONF_SIGNATURE || thc->version != TUNCONF_VERSION) + return NULL; + tec = thc->tunables; count = thc->num_tunables; From patchwork Mon Jul 6 21:14:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138616 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2780B4BA2E2B for ; Mon, 6 Jul 2026 21:17:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2780B4BA2E2B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=n6FaHl/l X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 9161B4BA2E14 for ; Mon, 6 Jul 2026 21:15:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9161B4BA2E14 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9161B4BA2E14 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::530 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372534; cv=none; b=UAtLuQoaN7xwTcDBymGwfCSgtNbAMzdHX3xxpiK4p0XkEfl/V8UAb0h19LkQxYxWG6hzt63kiE2NzoD7+7PNaCLkwMcJ7zDm3pqkNUpsGcrlai9/wBYeWZPnlDSQONBf+EjIG7hZ8wDG+rKEcZXAbkG0+Q1NqQSQkoHvyGTqGcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372534; c=relaxed/simple; bh=jJnjIbY8Kxu2sSKMM+cs4shLk7042RhlihG7HclTMEE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=k132pYs49TZjokBG4xowyO+bwevJ2/lrw+gZAVspLEJWim/AeFt4+5NLkp9cfiYHObEqFIpWzlbsrbBsHLKZ76O1LT2R4WDNeWcE0nJpGB2wuoYA2MWppeqMQdInf6VQHDsasWOQWwFEB+WacRD8Rd8Hs9ViFdVfPbHQY4x4Gsc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=n6FaHl/l DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9161B4BA2E14 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-c9cf07d2df6so2305134a12.2 for ; Mon, 06 Jul 2026 14:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372533; x=1783977333; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TfE3ubozfsTDyYWz4RVKoypK6AxOoNW1iX5f6CTwGQk=; b=n6FaHl/lXlFvuFbz8WTqEnQ/W3bhliit1acZ5cWCZuo2edA6zTTiOVYABd95pVmkSx JDYuxnowyRhNGB3VjdKlhgEPnx9/k9XWcinrheMazXnMJ1gtGewjO55fGU3DSO3Zfouf urY+6jNfCxCr5XpVi4QEgA8iVELjMc1j3s+eZKFdHTCM/j3nAPzzwy0SFBa3989UiW48 I3mliEau7VJy4SNyczEjxbNDS4FhN7WLQSELcQMHRLEpTeewRBU4YSPW1qPJYiOwEDi1 bu5ARCIAHzF+ct8BMuYboPU8UF5P0TneG+mKD6+MjEroGrD/YWrb6UelWx/xUMwuuC2F NdPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372533; x=1783977333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TfE3ubozfsTDyYWz4RVKoypK6AxOoNW1iX5f6CTwGQk=; b=bC3ozcyue3dhXaAJyX6nJHCys3LIltTeBv9v8+F8KDUyWGuyIQxzTyYmYwtWiIAw4o wsgF6fD5HSwx4NybJ6TN4JhoAo9c4mEFJ1BurCgtkZeUQ8eS5KGBmAFQeGgHhGbmWpXR UPQR6r+yT8xDEfCJUzTUorz/0KQKMUl++ltJXOYqiyptZa8aBa34RiCxOsGnGMBE0G47 /MTcs9V/iAASOiEsSWTw8C4+Y2RuSx+eT6CvccgimYFgzF1iEQnpU52uwpObY9UMty6V a0wFUmdHgcPh9xkWiBTa+P3/u+0Dv8rKB2h1s5QIWGebHHfzY4v0GRqn1jzPPEHPEZMG 0NIA== X-Gm-Message-State: AOJu0YyEi69+zlhyGSQRNCFnkY8++toRdeLz1P54TgIaXBNP1FAG9qJG wEL3FZKNBaFwbKcDdw13O2U0UYS9YAD0ETuY1zQTduaMVHLqYFIupq3heJxp0Jg/iTN/Uy7qEIh k4GUZ X-Gm-Gg: AfdE7cmhsXmWlCSk7CXN1iZBGcV6rC8NkZXtZcVBFZBspgJ0Z4NmIQwNvAZhVKOgWNW CXEsRidJg/avr1kb/mMQTsyJK3zkyhF3BBkksiT452kZvwMAq/ZXyBeNQuTlydnFEqdEuLIkpI2 6pUEOOB3PaHWehyS+Cs21nYzLemSBtH3amyhvC6tSaqTyZ48B25h7mn/dyG3fhSjKv3kjr/1PLY G841CL1SmfaVT5ejeLvv4N3W+Q5ThNPmRn8K00g7fNDJjV4K48qdDphVWu9kyq8uSiOIDgyc1wk 6kDBkuII5oWhg71MopHdD8uJt8lLj0Fle5q48S14j4Y54yDM3vON0O5ELnGlYpigIp6KbdYeEt7 wXLoyxkfd+KhfGaVAca3j8hUWPxL3hdMdY0Aq6m8oc8f06+wP/q1dENH7z0itsZcqun52Cs7MIQ V7T/Z/0aI5R3UiTCxbv9oC6b0k X-Received: by 2002:a05:6a20:6a24:b0:3bd:3800:7538 with SMTP id adf61e73a8af0-3c08eec7c4amr2796708637.33.1783372533432; Mon, 06 Jul 2026 14:15:33 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:32 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 3/8] elf: Avoid redundant ld.so.cache reload after first load Date: Mon, 6 Jul 2026 18:14:39 -0300 Message-ID: <20260706211524.3801466-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 _dl_check_ldsocache_needs_loading only stored the stat fields it compares (mtime, ino, size, dev) on the path where a cache was already loaded. On the very first call CACHE is NULL and the function returned "needs loading" without recording those fields, leaving new_cache_file_time zero. The next call then copied that zero value into cache_file_time and compared it against the freshly stat'd values, which always differed, forcing a second, unnecessary load (munmap + mmap + re-parse) of an unchanged cache at every startup. It can be shown with repro: $ cat << EOF > repro.c #include int main (void) { dlopen ("does-not-exist-xyz.so.99", RTLD_NOW); return 0; } EOF $ gcc repro.c -o repro $ strace -f -e trace=openat elf/ld.so --library-path . ./repro 2>&1 | grep -c "/etc/ld.so.cache" The result should be 1, instead of 2. Record the stat fields as soon as the stat succeeds, before the CACHE == NULL early return, so the following call has an accurate baseline and does not spuriously reload. --- elf/dl-cache.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/elf/dl-cache.c b/elf/dl-cache.c index 498196d0aa3..03bcd5bd06e 100644 --- a/elf/dl-cache.c +++ b/elf/dl-cache.c @@ -433,17 +433,20 @@ _dl_check_ldsocache_needs_loading (void) if (rv < 0) return false; - /* Any file is better than no file (likely the first time - through). */ - if (cache == NULL) - return true; - - /* Store the fields we check, in order they're likely to differ. */ + /* Store the fields we check, in order they're likely to differ. We + must do this even for the first load (CACHE == NULL below), so that + the next call copies an accurate NEW_CACHE_FILE_TIME into + CACHE_FILE_TIME and does not spuriously reload the unchanged cache. */ new_cache_file_time.mtime = new_cache_file_stat.st_mtime; new_cache_file_time.ino = new_cache_file_stat.st_ino; new_cache_file_time.size = new_cache_file_stat.st_size; new_cache_file_time.dev = new_cache_file_stat.st_dev; + /* Any file is better than no file (likely the first time + through). */ + if (cache == NULL) + return true; + /* At this point, NEW_CACHE_FILE_TIME is valid as well as CACHE_FILE_TIME, so we compare them. */ return (memcmp (&new_cache_file_time, &cache_file_time, From patchwork Mon Jul 6 21:14:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138618 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4BF0A4BA2E0B for ; Mon, 6 Jul 2026 21:18:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BF0A4BA2E0B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Xm0U+eHz X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 6AF574BA2E17 for ; Mon, 6 Jul 2026 21:15:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AF574BA2E17 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AF574BA2E17 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1036 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372536; cv=none; b=pcW54WdTHRslGXAgOT6BYZ8l4KXRI7LkgkYu6AmILnqDagRoxn39UMLnmIhe+NuKFRGi+CAB2mhQ0fnEhgVsiqATP8knzKCWkuqSu1yZ2dLHtoV4JDNoPB6K4OYaNmT5zhWeFojnVjIfL0pXvRvL27d68HpBFzlHummA18Ue0R0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372536; c=relaxed/simple; bh=mwVL/rHtyRpbwOH34M6iSJleYSY56/lrPi0iFtrV+dM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bZ1jojq/U1HyvCOdFO2xX1QsvW5g4CSWYXu+AOpC45j+cAXJvECs48+L39QksBTDvjfqMOCvFGzXdUomqWmcE+2Cfqy0tvdQWkzNqmpt43Un9Xgcpk1WxI9elGFMDsoSg0VKO2wrKgHSMZWqEquAh04fwkxMeihTffrQfnfuQPc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Xm0U+eHz DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AF574BA2E17 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-381c51fde6bso3752242a91.2 for ; Mon, 06 Jul 2026 14:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372535; x=1783977335; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zGO2HJrLcWZq6LEc7bYZ+Twtvyl36P9k/X+NZSG9l/4=; b=Xm0U+eHzXYe/mipEmCjdWfdGK7Nocg30Md8+r3p9kljtBmvr4CpWQ9RaZ4SHSQpKLt zIeMvGQxTyWAL+Wjc8f83YIZRebEXm5QBsgF2CkUMyfjlKCP6PgpTTnrSuJSZyxGIsFu 9cX7upCz1cEmy2C5sY2gKUnJ63K9jWB1aSzvtf2H+BvADhE6j83iJXQFEEbPt4OjQ3ax 6AQhvOm5eMyiUOVISOLK7VxVUXBIgy+ZQDowb7o1THEAKk+3TRzSiAWTNHbwkrTNTpSf 9yygVi9ZuNbv1yTrKqG5uXM7Alvb4RCd6WO1l/JkJZnnPC7Q5/TwSulvzW5D0wJv28YY NBlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372535; x=1783977335; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zGO2HJrLcWZq6LEc7bYZ+Twtvyl36P9k/X+NZSG9l/4=; b=hs3SweGHALyN0Lz0Ib66/LzhPT/hOW7vSNDQF72Y915cdZQbmWmCDwBPuDfXYrOeM8 FsAbzV96qltj29N9M++FrFU9nq2JDIsm2rf5aetUDdvttxi10Db3HkecvFc1r2hzcwN1 wg769ys7OvkWv58DBaFEd+vuBucxQc2UYqrP+A8XeuZPjkDauKvvkb5LYysiwFcuC8bM EbvzT+kHV9A/oX1MKXisq/PxUEk3u19ny/p99RDO04ACgKDr2JU414kC2E2A1CQP9j65 KE/4rfkYdVlOyUCRms6/5/OLLMV+6RepAVciV1m74X4iuaWnK2OohMdnaGgmvogoEh7F bEkQ== X-Gm-Message-State: AOJu0YxpguiyGLOkw64c0M5oZxF88bblQ5IoW9WwlPKiO9Wbb24ldsXi i/A+7pLg57oEWHsg1S6c/3l699B4LMGgrTaZOnHh8y1iTu5CN+oBXHuyFuw4ci+xsvwTXMQ1m1A f3JJw X-Gm-Gg: AfdE7ckua/GCDxj/APBRayZ9wCQFLGjyz9ngE7laAZjNrR76ipO9q/8GaHLSIMSOspx 9ygGU298PUKxobMiQHqLypaExM9mzrO9i41lYijwuKrnEM9vDaMDgMdFUj79krB9aB0O2mK2uom SO0NqLyBqLBigL4Zc8gCCtEPctQ0Rc+rwCWlFuLYVQecK5bfhGFRRx+U7teBp2H8WC81sfERWfa bmfJJ+7izbxx8FcgbHWrAB4EENqWQqNVX935a4UKQJaki46EmoYBAOXbGyE/R/eQgSqUTY7/wEe EVi8sEl071sdWUvLEkT3/q00QllrqYPEx1Rs0MyU/h9mHdj2cXwLJq3eEVPm9RNLO7iWAm8P9l0 HN/eJDsiNfadiVdVr2gKWARAjcQ/UscwoXxsmutIHGmAeMz9P1yazpGM8ZXIqEQe4CeHsMN9/NS JvLjauPVkFdd8zHMDdLcnieuKk X-Received: by 2002:a17:90b:5787:b0:36b:a2cc:485b with SMTP id 98e67ed59e1d1-38758a35efcmr2304379a91.21.1783372535176; Mon, 06 Jul 2026 14:15:35 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:34 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 4/8] elf: Let environment aliases override overridable system-wide tunables Date: Mon, 6 Jul 2026 18:14:40 -0300 Message-ID: <20260706211524.3801466-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 The environment-variable alias loop in __tunables_init skipped every tunable whose "initialized" flag was set, which was originally meant only to give the canonical GLIBC_TUNABLES form precedence over the legacy MALLOC_* aliases. Now that the cache also sets "initialized", a legacy alias could no longer override an *overridable* cache default, even though the canonical GLIBC_TUNABLES form still could -- an inconsistent and surprising asymmetry. Track separately the tunables that were set from GLIBC_TUNABLES during this call and skip only those in the alias loop Checked on x86_64-linux-gnu and i686-linux-gnu. --- elf/Makefile | 7 ++++++- elf/dl-tunables.c | 20 ++++++++++++++++++-- elf/tst-tunconf1.c | 24 ++++++++++++++++++++++++ elf/tst-tunconf1.root/etc/tunables.conf | 9 +++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/elf/Makefile b/elf/Makefile index c0bf3fd0d88..2c34827e241 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -351,7 +351,12 @@ tst-tunconf1-TUNABLES-only = \ glibc.malloc.tcache_count=5 \ :glibc.malloc.perturb=41 \ :glibc.malloc.mmap_threshold=10002 \ - :glibc.malloc.trim_threshold=10002 + :glibc.malloc.trim_threshold=10002 \ + :glibc.malloc.arena_max=300 +tst-tunconf1-ENV = \ + MALLOC_MMAP_MAX_=200 \ + MALLOC_TOP_PAD_=200 \ + MALLOC_ARENA_MAX=400 static-dlopen-environment = \ LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c index d19c2358c10..2ff87610eb4 100644 --- a/elf/dl-tunables.c +++ b/elf/dl-tunables.c @@ -179,6 +179,14 @@ struct tunable_toset_t enum { tunables_list_size = array_length (tunable_list) }; +/* Records tunables that were set from GLIBC_TUNABLES during this call, so + that a legacy environment-variable alias does not override themi (the + canonical GLIBC_TUNABLES form takes precedence over the aliases). + A tunable that was set only from the system-wide cache is deliberately not + recorded here, so an alias may still override an overridable cache default; + a nonoverridable one remains protected by tunable_t::locked. */ +static bool tunable_set_by_env[tunables_list_size]; + /* Parse the tunable string VALSTRING and set TUNABLES with the found tunables and their respective values. The VALSTRING is parsed in place, with the tunable start and size recorded in TUNABLES. @@ -288,6 +296,10 @@ parse_tunables (const char *valstring) if (!tunable_initialize (tunables[i].t, tunables[i].value, tunables[i].len)) parse_tunable_print_error (&tunables[i]); + else + /* GLIBC_TUNABLES set this tunable; a legacy alias must not + override it. */ + tunable_set_by_env[i] = true; } } @@ -498,9 +510,13 @@ __tunables_init (char **envp, char **argv) for (int i = 0; i < tunable_num_env_alias; i++) { - /* Skip over tunables that have either been set or already initialized. */ + /* Skip aliases whose tunable was already set through GLIBC_TUNABLES, + which takes precedence over the alias. A value coming only from the + system-wide cache does not block the alias here: an overridable cache + default may still be overridden, while a nonoverridable one is + protected by tunable_t::locked. */ if (tunables_env_alias[i].t == NULL - || tunables_env_alias[i].t->initialized) + || tunable_set_by_env[tunable_env_alias_list[i]]) continue; if (!tunable_initialize (tunables_env_alias[i].t, diff --git a/elf/tst-tunconf1.c b/elf/tst-tunconf1.c index 74f596d913b..2d245de84f1 100644 --- a/elf/tst-tunconf1.c +++ b/elf/tst-tunconf1.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include @@ -50,6 +51,29 @@ do_test (void) (long)trim_threshold); TEST_COMPARE ((long)trim_threshold, 10001); + /* Interaction with legacy environment-variable aliases (MALLOC_*). */ + int32_t mmap_max = TUNABLE_GET_FULL (glibc, malloc, mmap_max, int32_t, NULL); + size_t top_pad = TUNABLE_GET_FULL (glibc, malloc, top_pad, size_t, NULL); + size_t arena_max = TUNABLE_GET_FULL (glibc, malloc, arena_max, size_t, NULL); + + /* Overridable cache default (100); the MALLOC_MMAP_MAX_ alias overrides + it, just like GLIBC_TUNABLES would. */ + printf("mmap_max is %d (should be 200, from MALLOC_MMAP_MAX_ alias)\n", + mmap_max); + TEST_COMPARE (mmap_max, 200); + + /* Nonoverridable cache default (100); the MALLOC_TOP_PAD_ alias must not + override it. */ + printf("top_pad is %ld (should be 100, from /etc nonoverridable)\n", + (long)top_pad); + TEST_COMPARE ((long)top_pad, 100); + + /* Set both by GLIBC_TUNABLES (300) and by the MALLOC_ARENA_MAX alias + (400); the canonical GLIBC_TUNABLES form wins. */ + printf("arena_max is %ld (should be 300, from GLIBC_TUNABLES)\n", + (long)arena_max); + TEST_COMPARE ((long)arena_max, 300); + return 0; } diff --git a/elf/tst-tunconf1.root/etc/tunables.conf b/elf/tst-tunconf1.root/etc/tunables.conf index f708a8fce4a..b590635e135 100644 --- a/elf/tst-tunconf1.root/etc/tunables.conf +++ b/elf/tst-tunconf1.root/etc/tunables.conf @@ -13,6 +13,15 @@ $glibc.malloc.tcache_count=3 -glibc.malloc.mmap_threshold=10000 overridable glibc.malloc.trim_threshold=10000 +# Interaction with legacy environment-variable aliases (MALLOC_*), checked +# in the test case: +# - mmap_max: overridable cache default, must be overridable by the +# MALLOC_MMAP_MAX_ alias just like by GLIBC_TUNABLES. +# - top_pad: nonoverridable cache default, must NOT be overridable by the +# MALLOC_TOP_PAD_ alias. +glibc.malloc.mmap_max=100 +-glibc.malloc.top_pad=100 + [proc:/bin/ls] glibc.malloc.tcache_max=7 From patchwork Mon Jul 6 21:14:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138614 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF6FE4BA2E15 for ; Mon, 6 Jul 2026 21:16:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF6FE4BA2E15 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=EEvsM3LP X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 0D6944BA2E30 for ; Mon, 6 Jul 2026 21:15:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0D6944BA2E30 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0D6944BA2E30 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1030 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372538; cv=none; b=alIO/hy5OtvDL6ZP25QWevPjXYQv96JdOHJnAkDTiUVa4HjUDYyNLA3AH6OOben/Kh3BjpIet9Qfc8d6s/umBy5I/2CjZSi3C+hMJqBpmXhYvObwA+QH3o8YJddn7zdrBR0JUXAe313DFa6ODHHW0GMAfaQLlWA3q+FTedCrnrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372538; c=relaxed/simple; bh=cjKqQIecJ9YMJ7v/ztsuBuLKBsd4T1Q/Tq/bUtXh5ug=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YrCh60xSQNZLMUl7odBEvx8BKiiDWZa94bR7Ef9QPx4yIXnfWMMxKlaR2Bn7GfYmHHOhGwNKmxryIELnYTmo18YMAw2quL5/CKLf4Ll6b40bNDZZtTLvTmkOmpy0kHVFdYVNRWZLhSZ7+NFohKh+C/UqlMTF7FMjbKaAcJE5hC8= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=EEvsM3LP DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D6944BA2E30 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-38511175ad3so1532616a91.2 for ; Mon, 06 Jul 2026 14:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372537; x=1783977337; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lqJ0h47nr3KqSt7ayhRAp30vVbwj26NL3pZjYLflFyg=; b=EEvsM3LPAnIiEYkb/nOQrU5NOZnObOJ2jJG07ZxpYXPUDZpbNtaNh+baYUSuBKC8gc CxVvLj0qfcAH/Ge3L9/KoeRuHzqBP+/zNDJeKGIitKvd3th7FQQd5HGUAWOV6yiHCZ6s fZQIxdCWky+xm9Yp7z2i08z0V7FsJPwsM/kVO97eesUxE/CyemZzJSjPi2MrRosobjmZ W/PtrAGz8hNs/qYA6/9eMm0U4FbAYifeTqSwjJOQOAZi8/7K67VH6zov/woFlKif/Sys u0KKs/vSiM2eCAGaXqjX6Ga1npdkBdpPiDjkY4T4iAWY5xXl86pD7gwn3JR2lFEZmd2d 7yXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372537; x=1783977337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lqJ0h47nr3KqSt7ayhRAp30vVbwj26NL3pZjYLflFyg=; b=bneVtJREmKU63T1N8OzuaFsxQTpkYzt6679h0ksJBeckI9PDoRl5g0XMP/ee/afElv yHSJklJpVbxMiw1ePLunQtowGRHcKWX+vz7xfdpAcu6+Q6o8y3aMYt/cX2U1hGrnxuBD 4V4vt/PL972V5BUmKDhADRUPIN2wAqOb7E/HDJF0mw6Ibal3K6YMduHON9A2a8X+N6Ti cCvdxflgY5JUH2CdVOAU5plB+KT+/ygubaFM4DLMbv4YlEHqGiDMWvyoCVhe9vAKUU/W 3jGtTKgdtlal270HDnYrVXVaz3oOSem8+enUQmIWA07OlFvyJr0Cb2efV/vMu4geTIaF LzPQ== X-Gm-Message-State: AOJu0YzuIJVKWeg0EWQIzp8gucaJfe9uNGQWjo2yv3WZk9BMoQ9/7y3s hXTo3iSAkOoLPtzclo60CXpjvNlW8lJRD3Qo9Oag6mw59v/BUFKpUdDarl7umDQqQ76OzimTLle CLBot X-Gm-Gg: AfdE7cl6FlDYu2jGhfVVqIi2ya28rz4fcQJCmAV8/GDOUGeqtyakWaO2yRo06bvqGLP q4qHWj+3Qx/t9LXLsGqnkCCizpsaaKqxABfpLol6SLd72/0hXDISzwVKEWnrHVoGgenfjuGl2ei XSAfZCFan9aVMRtgesZhUcxzhQBod9100x83dwjMHMoXLqKK4C/lbhLIra3/5m1/2eFs7bupIAj pmp5H1j+ULpINH2LskvbzsS+FH8m+HlM/d29FU5FDfB4GVNhkgAjkehQWKkTiLk/6RmEDGN8RKV wejBzjPKZ10k9DyoeWKFXixUNeJ3PidAPrZtNqkg2M8zW0TcHraipC3ZeX2qefnjlD9gKc5jn1L Sr4TS8nKwt8d9ungmY1fCmq8FKUTQ10SfnqME9sYJ+zpHI+CEWWR0Wc/1bwMmWOB9tPmjQT6ukO jXwzr2ULLqlJoBDzizF7hO31OG X-Received: by 2002:a17:90b:4ec5:b0:380:9157:d6c with SMTP id 98e67ed59e1d1-387568fda40mr2101471a91.10.1783372536869; Mon, 06 Jul 2026 14:15:36 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:36 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 5/8] elf: Emit tunconf "not recognized" warning on stderr Date: Mon, 6 Jul 2026 18:14:41 -0300 Message-ID: <20260706211524.3801466-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 For consistency with other errors. Checked on x86_64-linux-gnu and i686-linux-gnu. --- elf/tunconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elf/tunconf.c b/elf/tunconf.c index c27b50b1de0..fa0d01b53e4 100644 --- a/elf/tunconf.c +++ b/elf/tunconf.c @@ -316,8 +316,8 @@ add_tunable (char *line, const char *filename, int lineno) break; } if (id == -1) - printf ("%s:%d: Warning: tunable %s not recognized.\n", - filename, lineno, name); + error_at_line (0, 0, filename, lineno, + "Warning: tunable %s not recognized", name); entry = (struct tunable_entry_int *) xcalloc (sizeof (struct tunable_entry_int), 1); entry->name = cache_store_string (name); From patchwork Mon Jul 6 21:14:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138613 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B7CA24BA2E0E for ; Mon, 6 Jul 2026 21:16:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7CA24BA2E0E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YwUQIoxX X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 31DE74BA2E28 for ; Mon, 6 Jul 2026 21:15:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31DE74BA2E28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 31DE74BA2E28 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372540; cv=none; b=EVeeiXTPRg+jWHlNpARHGZBWXFj7cuKAkeqQ/63+6MlzBis3tmh1zm3bci2J7Q4+VaCk3KScuqSLi996bJg8/S8LKBboDjlU7SsJGyIypEMFmGQvdIDDQ9VylaRYvO5bpX00Giif3VLRxyLVgxik6MASkXUvkDuC6K3Ev5B7IgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372540; c=relaxed/simple; bh=NyyXaJJHFqIcmFXoTBPUrW+X6eJ0UcnlBkX1F6xvqPs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=got5RZf4iaoAH1DaiBGD6ztI3F9faXmm9m3+i7g62Ywy7Y8njppYlai3wx7Awf4z0zvfvxAJ7J3EK/c882yWpFMWVvhhiZnjp0dYinaerwkkNtApHJausNybPhIzEKF4NjFvGpVB+HZKfjTAzxqGAzPcOacPwqzZ9tjTyIHMasI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YwUQIoxX DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31DE74BA2E28 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-847968ca62fso3631829b3a.2 for ; Mon, 06 Jul 2026 14:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372539; x=1783977339; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TJRZOogcTI2DitBt71GNByZmIvcyTbtiTg+92K6JqOQ=; b=YwUQIoxX//kmA6ca6f4qdkDceguZ31hWk8JpSJwOWV82EzywKAmj6D/1txbMX4dfpE /j09XvBH6cVuFU7VLybqIlbZJmu94VrIsKq0CBPUWRwXqCyf+vvRvT1I+2zf1EXuQiaA 7C5p7Ld1039iLxcvDU6708ILlt2ERKvFKPo83HxCRpvSeSSQGfbp2quOY5JpKOSdFJ3/ 4v4Y+Wip4QagL1PUMSnRVzx+MAP4T2qJcChiiZAIV4a44mMN5J+SSFg5yzpSRlhM9/ft owSEDR+tl5SrmRdGapTvQpteiHFrfDgINiTP3uPQy9StR97fmPz9AwV9RkFBTLdtytwS RoZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372539; x=1783977339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TJRZOogcTI2DitBt71GNByZmIvcyTbtiTg+92K6JqOQ=; b=XCX46jHJ5W2N3/8KHtV1/03MfjuNOWIdb2s2n8hcwm40xycLHoWQlFLUawF9TxWZew 3x6BWztA8M+wqCn3hbX0/spMsD/ECqG/vN+YYd+wwKHb6qcY/vNvw9tbTTB4gXYDOBC6 IoaFMWF9cEfjBOlhjaTvGyWuA2aovpkbQ+KMMayte8enZVjpT12hdxJgnh6kjeHdRgFY gYj6gI5S64SV+FykYUXMCseGu0ABaKS1S6RhUWIM/aZ9NsmGf3CfoECJPkIWViffqnDH jzVpuJBelHc8hlMqNP/CGhf7O22sWbfYwYG7NMxuBdI23EsoXLI4g7YEKc7rejc2nPVU RG4g== X-Gm-Message-State: AOJu0Yy86VZ/n7bQkuiKQzjimVYOL1Dkx77AAKluVDlk5FY5pvGZKyCZ EuTbrQTGmHm8rx85uyjoAa03XgyIcUd+qrgZs6D01A2bv03LEireRBWhHaX3y4LHPW21vTpBpZa b8Av3 X-Gm-Gg: AfdE7ckdQ0K3TfDMvd8TOmrRpqyU5JqIopyy32D9w+0u2bPIGTYt3pnQBncfaL9lw50 D1QMvQG+1N/dCpS3WzThuKmw+673kHkxbhtciq9DBuUDx1mPG0hoGA1nkEPd7zABeMfcFFBLAP9 I6mji/ddjRjG9gz9SjcpAbO3HcUW4gHq9iTKZpolNB2rZ//3YToz0QxHfH5MDCq6m8wpa2XKlA7 daagoTdFUDkGmFJTd8oqPVsqhwDIyMH7Jd8hQpNVzZZ0dUOJLNCy74f39vRToUJggLArFCODIVP /f9V5dSgMC68ArMm94PdEFEJU5B3rkL/oKGUpWTDcaRb39QOTKTRta4egQZv0/ewjGh3oNO/434 L4szOaXpMfuIG8mZ8EsvSY4Sj/l0ISlD2veHIRyySFNlPRtzrK5IJpBVZJ5tRspu2+2pIDsbdcI OP79Me3Q3YdlpPLC2rPEyzdZAH X-Received: by 2002:a05:6a20:cf88:b0:3bf:8f49:4038 with SMTP id adf61e73a8af0-3c08ef057a6mr2886494637.39.1783372538559; Mon, 06 Jul 2026 14:15:38 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:38 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 6/8] manual: Document default AT_SECURE handling for system-wide tunables Date: Mon, 6 Jul 2026 18:14:42 -0300 Message-ID: <20260706211524.3801466-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 A system-wide tunable without an onlysecure/nonsecure/anysecure prefix defaults to "nonsecure", i.e. it is not applied to AT_SECURE processes. This is a deliberate, conservative default but was not documented. --- manual/tunables.texi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/manual/tunables.texi b/manual/tunables.texi index 828c68151ad..457dbb1d18b 100644 --- a/manual/tunables.texi +++ b/manual/tunables.texi @@ -143,6 +143,22 @@ processes. @end table +When none of the @code{onlysecure}, @code{nonsecure} or @code{anysecure} +prefixes is given, a tunable behaves as if @code{nonsecure} had been +specified: it applies only to processes that are not AT_SECURE. Use +@code{anysecure} or @code{onlysecure} to affect AT_SECURE (setuid, +setgid, or capability-elevated) processes. + +The @code{GLIBC_TUNABLES} environment variable is ignored entirely for +AT_SECURE processes, so the system-wide file is the only way to set a +tunable for such a process. A tunable applied this way is not subject to +any per-tunable security screening, so @code{onlysecure} and +@code{anysecure} must be used deliberately: they can enable +security-sensitive tunables (for example @code{glibc.malloc.check}) in +every setuid or setgid program. The file is therefore trusted to the same +degree as @file{/etc/ld.so.cache} and must only be writable by the system +administrator. + Filters make the system-wide tunables only affect certain programs. This allows having a non-overridable default for most of the system but a different, overridable, value for certain programs that might From patchwork Mon Jul 6 21:14:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138619 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 126064BA2E36 for ; Mon, 6 Jul 2026 21:18:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 126064BA2E36 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=mjklC4qC X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 8A2764BA5439 for ; Mon, 6 Jul 2026 21:15:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A2764BA5439 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8A2764BA5439 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372541; cv=none; b=gif0PzcHR+rGxgfYGlqZIbjVPtgM91tRfl8IEcaL2WKJJvDUyYYE9uzL3EL0BhYlH8Wwzz2poGYLfALFYa3+tMpM2ZeYHAak7TD6BHC5LWf+pbFr+2vYIMRzZ6QPdaaZkJbabM7lYIj5G9lPc36NQRzUkvGnHafXQkEDNp9vwU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372541; c=relaxed/simple; bh=LMVIaJYVMtab3XEyqfsr09kusQGEeC6BJpihwvUvCzQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mPdUDdLTIGS4WsvVWDDY8s4xaH6nUBWIhtE7VTBF4cH9/qm2csci85smq9cr3ruanozkODCqu7Z5iyd5zLMr3jkwLPtUwcHKmIvGzfIJkfiVdwDDm5rEifcO6W+fFeaiZ9XChHuyQq5ElbyCiv3Vcu8T0UaG50+SyIMXeticMkE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=mjklC4qC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A2764BA5439 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-84780c95e2eso2725654b3a.3 for ; Mon, 06 Jul 2026 14:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372540; x=1783977340; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jw5at4bZ4BM6JS40yzBe2G85j4njjKbRcG6Sqnowz6Q=; b=mjklC4qC+YAUUbDeeVzIpyGNv3GCmksWqhdDt6cxZP7Ru4p1JeTSAIagB0y+cA1yrG 9OspnAP8JZgE1G0/daA5JQC8aNHGIHIxVTcJmChqKfl3TBPnZF8odw+YxUWiatNihJed FotcxJqGsSifT2l0LvHxcvIM1/anJK3R1WRJc5BjurIUEo+9xpqqkUkD0yxG7HMQQkEe hqSK99SPaPKLfJ57Y6IjNHJcZe7ZjGVMTkWOUIkXYtEVjynqegbeGwt8/AxzV3hQo7h8 LCd/v09AQ5jzyUPdWlO7opjC7MVgd5f9JfKBgtKTiCRq6NSsN/ey+xC+q332ko8v01Ca dk1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372540; x=1783977340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=jw5at4bZ4BM6JS40yzBe2G85j4njjKbRcG6Sqnowz6Q=; b=O8LmVID+NggkjZ1zw0/q7RvgADesntEDQKLv6yjniy/VqXbEs4QINlTk8buAAIvXl9 T+tXDvcWwRRbkTKEHPuVvf7cqxDgv2uzPM33ttI3RKKO7caKzxwsZNO+OmanmLkrJymq CQFp1UyrihK5bWoKcHQeszlUVqTvY5wIcyWZ6cDuOMGIO/vn+PfNEiTeWks/pXxPGCb2 wMM1/FKGZ6FlKWOqXfPggi+0XX3covxnX3UpapAjuiUbFCFGfHuvbzQPpCSBKFllSP8r WRMlSHv2JDLNVPH0HdKOXTg/ao9amAvDqfh6zZf365EidwWPGQff4Kh6s4gGO4yITSuL QDnw== X-Gm-Message-State: AOJu0YwqOhqxl/+50+Iw+1KuEJKk/T8pSI2KUS4u5oYDCmYc7hwVZd8N EP7J94zP7u1HJIqUH39Wwc8opNq3UCIGwO5GhTR2lVtOhGXWo43I/glHB1WmhTbhAwPqYwe5nTb QtLaf X-Gm-Gg: AfdE7clILxElVqLb+edVKyDwXO8soJtBOlQx0a01WTjaykQ5QVj55neqeLUoiVy/Y9p t9p0IcS2JJOVsCDVAKI1uDC7JDRwU0TSvmAw3lyGFNxC9F0sylxH4O80Jx69coFkuUycqKmUrJ9 Zw9k+vGyp2u91NjXS8ey69pR1jTNr8HCT8eZDBG6CWfpF3jLYY7YmLyc0eF0xyd0IfhT7Jmik3w iIcNgwcSUErjJJrriQMzQ53ofWiBJevp5G9vqXHp9P0g/82ak7r84dQTXSP6FoBnWvvEKgjfOsm IgJA9BlWD1gSBB+L17Jtoa3fhTmXToJfjLLq4KxYZI8Js01gTsxd6KDHppqljO0dEHEBAiGheBh xBX0ujWMO+Qa/qfpv9/IuYVlbzXK8XuYb5AA5lSRaHnAoZJwUinZ7U3cR8Vx64t9yRPwZB8jrHV uD/MrYw/OSmndpTNiLqxGr4O90 X-Received: by 2002:a05:6300:91:b0:3a2:7ef4:81df with SMTP id adf61e73a8af0-3c08ed55631mr2741137637.26.1783372540378; Mon, 06 Jul 2026 14:15:40 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:39 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 7/8] elf: Remove _dl_unload_cache Date: Mon, 6 Jul 2026 18:14:43 -0300 Message-ID: <20260706211524.3801466-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 It is a no-op since b9957a70b82. --- elf/dl-cache.c | 13 ------------- elf/dl-open.c | 5 ----- elf/rtld.c | 5 ----- sysdeps/generic/ldsodefs.h | 6 ------ 4 files changed, 29 deletions(-) diff --git a/elf/dl-cache.c b/elf/dl-cache.c index 03bcd5bd06e..c6820a9f414 100644 --- a/elf/dl-cache.c +++ b/elf/dl-cache.c @@ -606,19 +606,6 @@ _dl_load_cache_lookup (const char *name) return result; } -#ifndef MAP_COPY -/* If the system does not support MAP_COPY we cannot leave the file open - all the time since this would create problems when the file is replaced. - Therefore we provide this function to close the file and open it again - once needed. */ -void -_dl_unload_cache (void) -{ - /* Functionality is no longer needed, but kept for internal ABI for - now. */ -} -#endif - const struct tunable_header_cached * _dl_load_cache_tunables (const char **data) { diff --git a/elf/dl-open.c b/elf/dl-open.c index cf4749694f9..87fcee8b028 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -898,11 +898,6 @@ no more namespaces available for dlmopen()")); struct dl_exception exception; int errcode = _dl_catch_exception (&exception, dl_open_worker, &args); -#if defined USE_LDCONFIG && !defined MAP_COPY - /* We must unmap the cache file. */ - _dl_unload_cache (); -#endif - /* Do this for both the error and success cases. The old value has only been determined if the namespace ID was assigned (i.e., it is not __LM_ID_CALLER). In the success case, we actually may diff --git a/elf/rtld.c b/elf/rtld.c index e5ba71fef18..fc053df8586 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -2371,11 +2371,6 @@ dl_main (const ElfW(Phdr) *phdr, /* Auditing checkpoint: we have added all objects. */ _dl_audit_activity_nsid (LM_ID_BASE, LA_ACT_CONSISTENT); -#if defined USE_LDCONFIG && !defined MAP_COPY - /* We must munmap() the cache file. */ - _dl_unload_cache (); -#endif - /* Once we return, _dl_sysdep_start will invoke the DT_INIT functions and then *USER_ENTRY. */ } diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index f94247ad9fb..c0deb11c02e 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -1151,12 +1151,6 @@ const struct r_strlenpair *_dl_important_hwcaps (const char *prepend, or null if none is found. Caller must free returned string. */ extern char *_dl_load_cache_lookup (const char *name) attribute_hidden; -/* If the system does not support MAP_COPY we cannot leave the file open - all the time since this would create problems when the file is replaced. - Therefore we provide this function to close the file and open it again - once needed. */ -extern void _dl_unload_cache (void) attribute_hidden; - /* System-dependent function to read a file's whole contents in the most convenient manner available. *SIZEP gets the size of the file. On error MAP_FAILED is returned. */ From patchwork Mon Jul 6 21:14:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 138617 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F18B44BA2E28 for ; Mon, 6 Jul 2026 21:18:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F18B44BA2E28 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=KsDfJ2LC X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id B46454BA2E1C for ; Mon, 6 Jul 2026 21:15:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B46454BA2E1C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B46454BA2E1C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372543; cv=none; b=liWX3tKbUq6OGlreNabC2OcF0sRiJOfattAELfm0hayZtmpCmRPV5tNbJcqJcFiIzvALZ3qUnZ0lW/AOcsoxXSeoDVzPwTBlFMk0BcGBmtDvVcbKsXQGqCWEl6lD+UvDZqvx79U96kelT71Gu7mxnA/U83Ilj0iHBDhlE/GXR7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783372543; c=relaxed/simple; bh=wRfH0OpD2LK1bpjV1OeZqIh8fprR6iYYBxbZrf2hheY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OjnFCmMV9Wko/NJWEUTTXjBMn+xxaE6mvomSNNKeOYyyU2eYhf4kF2B0xCUK6BJ8TSpVClJEQ17vpI3WWV4LG+PlND/98ajWCe9DVg/a98WTiVgT4tuqmR9mWytL5/BD5SaSXWgH0HUpXjn4383RbNnUYLMuWPe2Klgrgd0Mvmc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=KsDfJ2LC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B46454BA2E1C Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2ca7aaa4b85so32396475ad.3 for ; Mon, 06 Jul 2026 14:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783372543; x=1783977343; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=D/HLgwSoqz8U1vs0sSvQwSEaXpU7H67ghmCwJksurgE=; b=KsDfJ2LC2RqcvNbd5tgmuwkiWqyoHXJHFzqRST+pjz3yJ0zfT4AWVuyMnbC10Gpq/d ant5qI/5djDbqqXWdhaCjA1C3+lN7kOv7G1Azu34DatC+RWjRZVLBcxyjtD0OZ4n94Zj GiI99RbmZLzeoZ5rTdJq2O7PIArvAMLApg2esxknH1t1EozauA1AdHO/1V11BcEkQPlz 0Ie6iu6NpfBFC9g1WQIpaf79rfdiLYmqWZA+t/6wzr83H1ItgrDCteqT3Ig2G4Ow81ia 21o5+mXeJQ88PZtaPI8vBbQXTbXbLDifCCNol5Cwt/Sby5cJQ9yDDv+aT7iT9BlOz8Fl 6ThQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783372543; x=1783977343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=D/HLgwSoqz8U1vs0sSvQwSEaXpU7H67ghmCwJksurgE=; b=nJajnc5M63F3LHXsebHr8GhA/BW2wFpXCHmAuAUkse24UxmQ9MLG+/WqcqddNvJ4Lp tzy4Wf44YzR73VK2BvPpdf1y4kG6c3w7dEQWedUBAr/Oi8lynzhkFBmGCRETA/pB+JmK CHFKTQY7a9ayHzfzrK/7swNltBVzqG8bpE3fqtGVHHbYaO1JqSRh+gIqCBruhkOiQbka NtzsoGGsQrLNH074LxRNQgMZW98TP37fzdQVLoUFXAOrE1mHIuIeGB/UTaVGAmYf8N2U VFV8UusUPVDBWTqvJCgSRyTU+6e/GogcJbhyBLx/ecwOXf7hKDjkrc2EefPw88r6W4kX ucKQ== X-Gm-Message-State: AOJu0YyzDresX0SU12imqLr/o3FEqaU6nOfTZ4cMR5pgd9EgqxdhRWBC +N5pcYqZ+hxpInE/A2aC5g83gm1xsjZD2asMO2zyb0u4twB/K5pLxdTMeJP2Ggme+4yh/HCc1UR K85Qt X-Gm-Gg: AfdE7cllOlN4sowx7/ENXQhkilJQ68jA20nCizhhkC/1Q1O/rs+9GHxpdGJpcTX/br9 nRD4l4EZVIwjNogBQX/iHfSfTshUODdeqh7p+vJKhHGW+wSbhtvic/5bcw6iqFwWqsfWbEbI887 SSSM+b6SGNI7+d2liU8i9VPimQGA8hNPvEwHXmB/bHkiZX9n0dlI082FBnVKcmo+oDKpypd1CD0 gy2AD5Eg5UmVRgYij5Sgh4bx7yR/N9sjMAhLnkN+cZFAXgdWRzvZ6PkmJzP/tzdYDULoT3kO48H WkZMrV1pcfq05oChFU3FWxS4JFdwhCXuaV0MZW/ngRjfTBo56RGI/MQSdemW/RIxXRb9csti1Pg 37jU4gpQnwH3f61lw1kkGpoPBY4PHMSbPFOmJRfwjFRmi/4+AkwavqzmXis1ma6qx+sqUkW1LcP djqO3xMgykgo675daNOjjBIHK4 X-Received: by 2002:a05:6a21:32a2:b0:39f:2dd0:65d5 with SMTP id adf61e73a8af0-3c08ee785a4mr3104223637.39.1783372542620; Mon, 06 Jul 2026 14:15:42 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:2485:a9ff:45ba:83f5:84f5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f598dsm517650eec.6.2026.07.06.14.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:15:41 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Andreas K . Huettel" , DJ Delorie Subject: [PATCH 8/8] elf: Remove unused tunable_seclevel_t Date: Mon, 6 Jul 2026 18:14:44 -0300 Message-ID: <20260706211524.3801466-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> References: <20260706211524.3801466-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham 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 The per-tunable security level is no longer part of struct _tunable and no tunable in dl-tunables.list declares one. --- elf/dl-tunable-types.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/elf/dl-tunable-types.h b/elf/dl-tunable-types.h index 3506eee5120..7440b6c5ce3 100644 --- a/elf/dl-tunable-types.h +++ b/elf/dl-tunable-types.h @@ -42,20 +42,6 @@ typedef struct tunable_num_t max; } tunable_type_t; -/* Security level for tunables. This decides what to do with individual - tunables for AT_SECURE binaries. */ -typedef enum -{ - /* Erase the tunable for AT_SECURE binaries so that child processes don't - read it. */ - TUNABLE_SECLEVEL_SXID_ERASE = 0, - /* Ignore the tunable for AT_SECURE binaries, but don't erase it, so that - child processes can read it. */ - TUNABLE_SECLEVEL_SXID_IGNORE = 1, - /* Read the tunable. */ - TUNABLE_SECLEVEL_NONE = 2, -} tunable_seclevel_t; - /* A tunable. */ struct _tunable {