From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 26FAF38560AA for ; Tue, 10 Oct 2023 18:01:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 26FAF38560AA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c723f1c80fso38357475ad.1 for ; Tue, 10 Oct 2023 11:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696960886; x=1697565686; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=eSuMA4mgrZt7SdXvzgS9MfY7s68dpBZNh9Rn0TMYRHs=; b=BYTpfEKgdsOiZBXF19bapVrKmyDwy/rDQVapxTMDYeZj4cH/6Fg0XWeYTFi1LLmwn5 GxEcv76I4YJqREY1K3cLlFuoTALex7NvwhlUeiyOa7gZ9SeymP2Do28YCyybOd3uBmEq Hp8hhWEViAq5ZjoOlKki/Hp+SKSo+TAJqm7TQ/NrkD/IQoSf10axnDEJhFb73owYkFpK A9E6QTLQjhfyRz23MKu1NI2GhoFc9lWnRCfe5L63KwCAtef+u02bVDL1o/e3ewDOZtPc lr+8pKP6ogt0t8ZOPiq323Eyx+Y8QvE7lmq1DcaU4RkephkIHtcSaVDDlNXnAyiWYTCR nw1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696960886; x=1697565686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eSuMA4mgrZt7SdXvzgS9MfY7s68dpBZNh9Rn0TMYRHs=; b=aR3AMdLHOY2Gc4YWmbIwnMtB6l0eUvWbhnex8QALv/RmO9KmbGN5xjDKn5PML0eHtf 0fb3eBS6+Jv8f5k7w3ZWjjGQqCRHOxke8qJi9bF1SoXTDyJGiaEQ+NhfFih7g+4eQtxW qCHq4kZB1pEM/0T5V1tg1zM/DssD4vxMMdl3IH45XQ7l6QP3HudtRljLJP0A2FYT8lAJ 1DHjpAqxBz+y1GFmmg8+EuYRzcCD6Q+09JIghtA9/Jl1tyIesp+UJXEq92jC37+AjRZW wbC/bT1bM9xx6ZmVBcxminNEHfH8WcDFuRm2IgccNvYQ6ezWlmyDLkIiY/4Rs2ZkSr6E DlEw== X-Gm-Message-State: AOJu0Yx1tt+m1yWvnqZFbWjxUtREvzysv20rfqmqWUqyzrlrDgFfVkz/ jx34CdBWbTpWZKGzAHCoKMzsbHUUy/0VyMW0Wl70Lg== X-Google-Smtp-Source: AGHT+IGCu1igog1KLc1Ak1MWQla6TF/4L8cr3G59nCfhIIhUoQENrIe1G2xxm0SCmYofAkmwX14AzQ== X-Received: by 2002:a17:902:ea82:b0:1c9:c733:67c1 with SMTP id x2-20020a170902ea8200b001c9c73367c1mr710898plb.14.1696960886477; Tue, 10 Oct 2023 11:01:26 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:d09b:ef2e:7c42:5ecf:a4ef]) by smtp.gmail.com with ESMTPSA id 5-20020a170902c24500b001bb9d6b1baasm12088022plg.198.2023.10.10.11.01.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 11:01:25 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Siddhesh Poyarekar Subject: [PATCH 04/11] elf: Add GLIBC_TUNABLES to unsecvars Date: Tue, 10 Oct 2023 15:01:04 -0300 Message-Id: <20231010180111.561793-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010180111.561793-1-adhemerval.zanella@linaro.org> References: <20231010180111.561793-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_PASS,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: setuid/setgid process now ignores any glibc tunables, and filters out all environment variables that might changes its behavior. This patch also adds GLIBC_TUNABLES, so any spawned process by setuid/setgid processes should set tunable explicitly. Checked on x86_64-linux-gnu. --- elf/tst-env-setuid-tunables.c | 11 +++-------- sysdeps/generic/unsecvars.h | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/elf/tst-env-setuid-tunables.c b/elf/tst-env-setuid-tunables.c index 3232f6b4c1..39b3648aa6 100644 --- a/elf/tst-env-setuid-tunables.c +++ b/elf/tst-env-setuid-tunables.c @@ -64,15 +64,10 @@ test_child (int off) printf (" [%d] GLIBC_TUNABLES is %s\n", off, val); fflush (stdout); - if (val == NULL) - printf (" [%d] GLIBC_TUNABLES environment variable absent\n", off); + if (val != NULL) + printf (" [%d] Unexpected GLIBC_TUNABLES VALUE %s\n", off, val); else - { - if (strcmp (val, teststrings[off]) != 0) - printf (" [%d] Unexpected GLIBC_TUNABLES VALUE %s\n", off, val); - else - ret = 0; - } + ret = 0; fflush (stdout); int32_t check = TUNABLE_GET_FULL (glibc, malloc, check, int32_t, NULL); diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h index ca70e2e989..f7ebed60e5 100644 --- a/sysdeps/generic/unsecvars.h +++ b/sysdeps/generic/unsecvars.h @@ -4,6 +4,7 @@ #define UNSECURE_ENVVARS \ "GCONV_PATH\0" \ "GETCONF_DIR\0" \ + "GLIBC_TUNABLES\0" \ "HOSTALIASES\0" \ "LD_AUDIT\0" \ "LD_DEBUG\0" \ -- 2.34.1