Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp811002rbb; Sun, 25 Feb 2024 05:13:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVWhHSjA+8EX4tTsTeT1eU4gOPtBMyWfL0hFIOn0oR+zLV3Hp0B9AoK53YiJYwiyIdG43Yqc90nltF9xMR/+XjaedUBQyH/ZNs3tINyzw== X-Google-Smtp-Source: AGHT+IGnq7JlsXjJDlj8RXD97EzlGmbeU39/yQND9pR6moZ8gEC0ffOhcnWKp6xk13LYO/Dqsaop X-Received: by 2002:a05:6a00:4403:b0:6e5:265:fd38 with SMTP id br3-20020a056a00440300b006e50265fd38mr4133632pfb.18.1708866801253; Sun, 25 Feb 2024 05:13:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708866801; cv=pass; d=google.com; s=arc-20160816; b=HKRuiTTFzTFmiN53XK6gLhypzBJ4FLskgO2GASNoueysEPuWh27di9C7bl3+nkfdVb 16E2rH2R8j0zT02h84M42z77to/EVfOdlwMp1fZgLR35vhEyh2rr6v1eyNyK2niFFNrw t5pykt766hVh4yeb6XpxJIqzV1+i4kiwgDQ5tsisnvHR7z6ojhSDb8XnecGZw/p6ovv1 DUKn9HUNTlM7B63ikUkamQp59bg9S2WHVom13KZpGp8S20O+SOE+MhLpPV8RMtqteEbZ 7Qnq7moQpaVsBpvvQtslbpeL1GKSVvlaD4cNK78N0HUdpUNklhHWnPGwHtb9oEoMXvUM s8RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:user-agent:message-id:in-reply-to:date:references:cc:to :from; bh=JjBY2MFbEcswWFdI1P2yjqcn1DZhXMTm+6I+sI/IeT4=; fh=tnHAb1c7B5BrfG55Rc+hP2acWaE8jGntx39bIh8vc8A=; b=zRQ1U+K5uTePvzSDikhhis/Auxwam0HwrDRsql6ipRtsFpv0lsTuKNHnvC+gLb1aYY f7uO7Vyl7nMLhe9ZwaDZ5tsdzBnWBDjWVlnuns7tC0LEcufL5ewwHctrZ2CktwVxKc6N 9OdZqhiyZNGadMLqXclF/4cYhG1pWKK2PGCC1AUOetUtcyZ9QjpFMYVGciTaQX5HsSkl CWa7989GnxF3wPnXuoXRpVlHgoLUBv07N358i6gblwWc/Jn+a6fJGv4DcZe5Ng/KsSrG qwZ+XRAlC3eafOmcNnFT5eq6RRL111a7o70sxZm9MeraBSNBigeiUDSEvD5SqOsm9ous R3Pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=xmission.com dmarc=pass fromdomain=xmission.com); spf=pass (google.com: domain of linux-kernel+bounces-80069-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80069-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s36-20020a056a0017a400b006e4f2f95d4asi2239059pfg.64.2024.02.25.05.13.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 05:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80069-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=xmission.com dmarc=pass fromdomain=xmission.com); spf=pass (google.com: domain of linux-kernel+bounces-80069-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80069-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F1540281B4D for ; Sun, 25 Feb 2024 13:13:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88E78134C4; Sun, 25 Feb 2024 13:13:14 +0000 (UTC) Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53CE9134A9 for ; Sun, 25 Feb 2024 13:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.70.13.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708866794; cv=none; b=Akx65yo1++/b2THxhsDGdzr70X1IgMko8uqroKcGl877kQG7NXSktU+yysLFaFWgT7DneEUmrSs/TceHaSri/aeL4VZwgcyzgHTAhxK4BVs7t+87C42SswzT1qTP6b9Dur0MV/A/XLGu4DazXonEGrjoVs56dc04gA09P9LqgKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708866794; c=relaxed/simple; bh=9Vnj5mB1X8wGNKgZILN2wE3E/daqZClASQRspBp6Pn0=; h=From:To:Cc:References:Date:In-Reply-To:Message-ID:MIME-Version: Content-Type:Subject; b=s+lfF9GBZAGrmmRwjaFZWryyIRValgZtidAsCOow5LNr6ZGDa5CS1LXVOLCnvGg1ml9aPaO8rOxD9P+XuYin0Bk8DAzgp5Irc/wFCa8m2Bk/m5J1z9JzQQ8kTe9XMINOYOktBCUzCs+L/jLU2MQgIA0TSl4g3hGpX2vzdMROrKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com; spf=pass smtp.mailfrom=xmission.com; arc=none smtp.client-ip=166.70.13.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xmission.com Received: from in01.mta.xmission.com ([166.70.13.51]:35716) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1reDds-004xiu-1E; Sun, 25 Feb 2024 05:30:04 -0700 Received: from ip68-227-168-167.om.om.cox.net ([68.227.168.167]:52470 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1reDdq-00FXth-Qy; Sun, 25 Feb 2024 05:30:03 -0700 From: "Eric W. Biederman" To: wenyang.linux@foxmail.com Cc: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , linux-kernel@vger.kernel.org References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Date: Sun, 25 Feb 2024 06:29:33 -0600 In-Reply-To: (wenyang linux's message of "Sun, 25 Feb 2024 12:05:38 +0800") Message-ID: <875xyczpzm.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1reDdq-00FXth-Qy;;;mid=<875xyczpzm.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.168.167;;;frm=ebiederm@xmission.com;;;spf=pass X-XM-AID: U2FsdGVkX19Oi0Xj5vkAVdLGaHDmadvLSejfCvfPTGY= X-SA-Exim-Connect-IP: 68.227.168.167 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Level: *** X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 XM_Body_Dirty_Words Contains a dirty word * -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;wenyang.linux@foxmail.com X-Spam-Relay-Country: X-Spam-Timing: total 622 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 10 (1.5%), b_tie_ro: 8 (1.3%), parse: 0.96 (0.2%), extract_message_metadata: 26 (4.2%), get_uri_detail_list: 2.2 (0.3%), tests_pri_-2000: 45 (7.2%), tests_pri_-1000: 2.7 (0.4%), tests_pri_-950: 1.20 (0.2%), tests_pri_-900: 0.99 (0.2%), tests_pri_-90: 70 (11.2%), check_bayes: 67 (10.9%), b_tokenize: 15 (2.4%), b_tok_get_all: 10 (1.6%), b_comp_prob: 4.4 (0.7%), b_tok_touch_all: 34 (5.5%), b_finish: 1.04 (0.2%), tests_pri_0: 305 (49.0%), check_dkim_signature: 0.53 (0.1%), check_dkim_adsp: 3.4 (0.6%), poll_dns_idle: 134 (21.6%), tests_pri_10: 2.2 (0.4%), tests_pri_500: 155 (25.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 8/8] ucounts: delete these duplicate static variables ue_zero and ue_int_max X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) wenyang.linux@foxmail.com writes: > From: Wen Yang > > Since these static variables (ue_zero and ue_int_max) are only used for > boundary checks and will not be changed, remove it and use the ones in > our shared const array. What happened to the plans to kill the shared const array? You can still save a lot more by turning .extra1 and .extra2 into longs instead of keeping them as pointers and needing constants to be pointed at somewhere. As I recall the last version of this actually broke the code, (but not on little endian). This one if the constants are properly named looks better than that, but I don't see any reason why you want shared constants for such a handful of things. Especially when it has proven to be error prone in the past. The only people I can see who find a significant benefit by consolidating all of the constants into one place are people who know how to stomp kernel memory. Eric > > Signed-off-by: Wen Yang > Cc: Luis Chamberlain > Cc: Kees Cook > Cc: Joel Granados > Cc: Christian Brauner > Cc: "Eric W. Biederman" > Cc: Shuah Khan > Cc: linux-kernel@vger.kernel.org > --- > kernel/ucount.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/kernel/ucount.c b/kernel/ucount.c > index 4aa6166cb856..05bbba02ae4f 100644 > --- a/kernel/ucount.c > +++ b/kernel/ucount.c > @@ -58,17 +58,14 @@ static struct ctl_table_root set_root = { > .permissions = set_permissions, > }; > > -static long ue_zero = 0; > -static long ue_int_max = INT_MAX; > - > #define UCOUNT_ENTRY(name) \ > { \ > .procname = name, \ > .maxlen = sizeof(long), \ > .mode = 0644, \ > .proc_handler = proc_doulongvec_minmax, \ > - .extra1 = &ue_zero, \ > - .extra2 = &ue_int_max, \ > + .extra1 = SYSCTL_LONG_ZERO, \ > + .extra2 = SYSCTL_LONG_S32_MAX, \ > } > static struct ctl_table user_table[] = { > UCOUNT_ENTRY("max_user_namespaces"),