From patchwork Fri Feb 5 08:41:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1436527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=fpktbZ6H; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DX86152GDz9sRR for ; Fri, 5 Feb 2021 19:41:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A4613971405; Fri, 5 Feb 2021 08:41:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A4613971405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612514486; bh=X/JS8rIzJfGfpAZV1zz5TMowNrTIdZrNmBRw0K/trBQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fpktbZ6HAe9koU/TmsvlFLQTbPnvh2xGgsRdKuIzuxj2vcnqX8f2zSO3HPuzw+RsR ZtKjSrixQ31yssD4AdFFPdjy0o7QvzgDQdRFeMJbEmyvC/dHNueKVDEKH08izLmstk ZM9M4cotNhT61rC+qS6uuqZo9UcdGhQFxunOcLQ0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from quail.birch.relay.mailchannels.net (quail.birch.relay.mailchannels.net [23.83.209.151]) by sourceware.org (Postfix) with ESMTPS id 06D2B3857C7B for ; Fri, 5 Feb 2021 08:41:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 06D2B3857C7B X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id BA67E4029DB; Fri, 5 Feb 2021 08:41:22 +0000 (UTC) Received: from pdx1-sub0-mail-a34.g.dreamhost.com (100-96-11-12.trex.outbound.svc.cluster.local [100.96.11.12]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 577E74028E9; Fri, 5 Feb 2021 08:41:22 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a34.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.11.12 (trex/6.0.2); Fri, 05 Feb 2021 08:41:22 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Robust-Thread: 2f28770e2a24b6fb_1612514482575_3567600454 X-MC-Loop-Signature: 1612514482575:1939737460 X-MC-Ingress-Time: 1612514482575 Received: from pdx1-sub0-mail-a34.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTP id 155CC7E0A8; Fri, 5 Feb 2021 00:41:22 -0800 (PST) Received: from rhbox.lan (unknown [103.199.173.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTPSA id 9FDF38B602; Fri, 5 Feb 2021 00:41:19 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a34 To: libc-alpha@sourceware.org Subject: [PATCH v2] tunables: Disallow negative values for some tunables Date: Fri, 5 Feb 2021 14:11:06 +0530 Message-Id: <20210205084106.4151072-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1170.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The glibc.malloc.mmap_max tunable as well as al of the INT_32 tunables don't have use for negative values, so pin the hardcoded limits in the non-negative range of INT. There's no real benefit in any of those use cases for the extended range of unsigned, so I have avoided added a new type to keep things simple. Reviewed-by: Carlos O'Donell --- Change from v1: Fix tst-rtld-list-tunables.exp. elf/dl-tunables.list | 6 ++++++ elf/tst-rtld-list-tunables.exp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list index 3cf0ad83ec..8ddd4a2314 100644 --- a/elf/dl-tunables.list +++ b/elf/dl-tunables.list @@ -64,6 +64,7 @@ glibc { type: INT_32 env_alias: MALLOC_MMAP_MAX_ security_level: SXID_IGNORE + minval: 0 } arena_max { type: SIZE_T @@ -109,22 +110,27 @@ glibc { skip_lock_busy { type: INT_32 default: 3 + minval: 0 } skip_lock_internal_abort { type: INT_32 default: 3 + minval: 0 } skip_lock_after_retries { type: INT_32 default: 3 + minval: 0 } tries { type: INT_32 default: 3 + minval: 0 } skip_trylock_internal_abort { type: INT_32 default: 3 + minval: 0 } } diff --git a/elf/tst-rtld-list-tunables.exp b/elf/tst-rtld-list-tunables.exp index 4f3f7ee4e3..9f66c52885 100644 --- a/elf/tst-rtld-list-tunables.exp +++ b/elf/tst-rtld-list-tunables.exp @@ -1,7 +1,7 @@ glibc.malloc.arena_max: 0x0 (min: 0x1, max: 0x[f]+) glibc.malloc.arena_test: 0x0 (min: 0x1, max: 0x[f]+) glibc.malloc.check: 0 (min: 0, max: 3) -glibc.malloc.mmap_max: 0 (min: -2147483648, max: 2147483647) +glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647) glibc.malloc.mmap_threshold: 0x0 (min: 0x0, max: 0x[f]+) glibc.malloc.mxfast: 0x0 (min: 0x0, max: 0x[f]+) glibc.malloc.perturb: 0 (min: 0, max: 255)